From 3e6062f4fd7759dc5c1d6c0131a471de96926a91 Mon Sep 17 00:00:00 2001 From: tibmt Date: Fri, 30 Nov 2018 12:46:13 +0300 Subject: [PATCH 1/5] translate additional part of Kibana --- src/core_plugins/kibana/index.js | 49 +++++++++--- .../kibana/public/context/api/anchor.js | 6 +- .../kibana/public/context/app.html | 79 +++++++++++++------ src/core_plugins/kibana/public/context/app.js | 6 +- .../kibana/public/context/query/actions.js | 18 +++-- .../dashboard_listing.test.js.snap | 8 +- .../dashboard/listing/dashboard_listing.js | 5 +- .../kibana/public/dev_tools/index.js | 10 ++- .../field_chooser/discover_field.js | 4 +- .../kibana/public/discover/index.html | 2 +- src/core_plugins/kibana/public/doc/index.html | 52 +++++++----- .../__snapshots__/tutorial.test.js.snap | 42 +++++++--- .../components/tutorial/instruction_set.js | 7 +- .../home/components/tutorial/introduction.js | 7 +- .../components/tutorial/parameter_form.js | 7 +- .../home/components/tutorial/tutorial.js | 21 ++++- .../home/components/tutorial_directory.js | 2 +- .../loading_indices.test.js.snap | 4 +- .../loading_indices/loading_indices.js | 4 +- .../step_time_field.test.js.snap | 2 +- .../__snapshots__/time_field.test.js.snap | 2 +- .../components/time_field/time_field.js | 2 +- .../step_time_field/step_time_field.js | 2 +- 23 files changed, 246 insertions(+), 95 deletions(-) diff --git a/src/core_plugins/kibana/index.js b/src/core_plugins/kibana/index.js index c7a44ac2b04bd..0badf46c89a3d 100644 --- a/src/core_plugins/kibana/index.js +++ b/src/core_plugins/kibana/index.js @@ -17,6 +17,7 @@ * under the License. */ +import { i18n } from '@kbn/i18n'; import Promise from 'bluebird'; import { mkdirp as mkdirpNode } from 'mkdirp'; @@ -64,32 +65,46 @@ export default function (kibana) { ], app: { id: 'kibana', - title: 'Kibana', + title: i18n.translate('kbn.kibanaTitle', { + defaultMessage: 'Kibana' + }), listed: false, - description: 'the kibana you know and love', + description: i18n.translate('kbn.kibanaDescription', { + defaultMessage: 'the kibana you know and love' + }), main: 'plugins/kibana/kibana', }, styleSheetPaths: `${__dirname}/public/index.scss`, links: [ { id: 'kibana:discover', - title: 'Discover', + title: i18n.translate('kbn.discoverTitle', { + defaultMessage: 'Discover' + }), order: -1003, url: `${kbnBaseUrl}#/discover`, - description: 'interactively explore your data', + description: i18n.translate('kbn.discoverDescription', { + defaultMessage: 'interactively explore your data' + }), icon: 'plugins/kibana/assets/discover.svg', euiIconType: 'discoverApp', }, { id: 'kibana:visualize', - title: 'Visualize', + title: i18n.translate('kbn.visualizeTitle', { + defaultMessage: 'Visualize' + }), order: -1002, url: `${kbnBaseUrl}#/visualize`, - description: 'design data visualizations', + description: i18n.translate('kbn.visualizeDescription', { + defaultMessage: 'design data visualizations' + }), icon: 'plugins/kibana/assets/visualize.svg', euiIconType: 'visualizeApp', }, { id: 'kibana:dashboard', - title: 'Dashboard', + title: i18n.translate('kbn.dashboardTitle', { + defaultMessage: 'Dashboard' + }), order: -1001, url: `${kbnBaseUrl}#/dashboards`, // The subUrlBase is the common substring of all urls for this app. If not given, it defaults to the url @@ -98,23 +113,33 @@ export default function (kibana) { // the url above in order to preserve the original url for BWC. The subUrlBase helps the Chrome api nav // to determine what url to use for the app link. subUrlBase: `${kbnBaseUrl}#/dashboard`, - description: 'compose visualizations for much win', + description: i18n.translate('kbn.dashboardDescription', { + defaultMessage: 'compose visualizations for much win' + }), icon: 'plugins/kibana/assets/dashboard.svg', euiIconType: 'dashboardApp', }, { id: 'kibana:dev_tools', - title: 'Dev Tools', + title: i18n.translate('kbn.devToolsTitle', { + defaultMessage: 'Dev Tools' + }), order: 9001, url: '/app/kibana#/dev_tools', - description: 'development tools', + description: i18n.translate('kbn.devToolsDescription', { + defaultMessage: 'development tools' + }), icon: 'plugins/kibana/assets/wrench.svg', euiIconType: 'devToolsApp', }, { id: 'kibana:management', - title: 'Management', + title: i18n.translate('kbn.managementTitle', { + defaultMessage: 'Management' + }), order: 9003, url: `${kbnBaseUrl}#/management`, - description: 'define index patterns, change config, and more', + description: i18n.translate('kbn.managementDescription', { + defaultMessage: 'define index patterns, change config, and more' + }), icon: 'plugins/kibana/assets/settings.svg', euiIconType: 'managementApp', linkToLastSubUrl: false diff --git a/src/core_plugins/kibana/public/context/api/anchor.js b/src/core_plugins/kibana/public/context/api/anchor.js index 4c541845251f6..c1d4823346b16 100644 --- a/src/core_plugins/kibana/public/context/api/anchor.js +++ b/src/core_plugins/kibana/public/context/api/anchor.js @@ -21,7 +21,7 @@ import _ from 'lodash'; import { SearchSourceProvider } from 'ui/courier'; -export function fetchAnchorProvider(indexPatterns, Private) { +export function fetchAnchorProvider(indexPatterns, Private, i18n) { const SearchSource = Private(SearchSourceProvider); return async function fetchAnchor( @@ -54,7 +54,9 @@ export function fetchAnchorProvider(indexPatterns, Private) { const response = await searchSource.fetch(); if (_.get(response, ['hits', 'total'], 0) < 1) { - throw new Error('Failed to load anchor document.'); + throw new Error(i18n('kbn.context.failedToLoadAnchorDocumentErrorDescription', { + defaultMessage: 'Failed to load anchor document.' + })); } return { diff --git a/src/core_plugins/kibana/public/context/app.html b/src/core_plugins/kibana/public/context/app.html index d2ef919657727..6947d0f7ce738 100644 --- a/src/core_plugins/kibana/public/context/app.html +++ b/src/core_plugins/kibana/public/context/app.html @@ -1,9 +1,16 @@
-
- Surrounding Documents in {{ contextApp.state.queryParameters.indexPatternId }} -
+
@@ -25,31 +32,35 @@
- - Failed to load the anchor document - +
- No searchable tiebreaker field could be found in the index pattern - {{ contextApp.state.queryParameters.indexPatternId}}. - - Please change the advanced setting - context:tieBreakerFields to include a valid field for this - index pattern. +
- Please reload or visit - Discover - to select a valid anchor document. -
+ i18n-id="kbn.context.pleaseReloadPageDescription" + i18n-default-message="Please reload or visit {navigationLink} to select a valid anchor document." + i18n-values="{ + navigationLink: '' + contextApp.discover + '' + }" + >
@@ -70,7 +81,13 @@ icon="'fa-chevron-up'" ng-click="contextApp.actions.fetchMorePredecessorRows()" > - Load {{ contextApp.state.queryParameters.defaultStepSize }} more + - newer documents + -
- Loading… -
+
@@ -136,7 +158,13 @@ icon="'fa-chevron-down'" ng-click="contextApp.actions.fetchMoreSuccessorRows()" > - Load {{ contextApp.state.queryParameters.defaultStepSize }} more + -
older documents
+
, "listingLimitText": - listingLimit + , "listingLimitValue": 1, "totalDashboards": 2, diff --git a/src/core_plugins/kibana/public/dashboard/listing/dashboard_listing.js b/src/core_plugins/kibana/public/dashboard/listing/dashboard_listing.js index b7af6a616ba26..1d7a68968015e 100644 --- a/src/core_plugins/kibana/public/dashboard/listing/dashboard_listing.js +++ b/src/core_plugins/kibana/public/dashboard/listing/dashboard_listing.js @@ -257,7 +257,10 @@ class DashboardListingUi extends React.Component { listingLimitValue: this.props.listingLimit, listingLimitText: ( - listingLimit + ), advancedSettingsLink: ( diff --git a/src/core_plugins/kibana/public/dev_tools/index.js b/src/core_plugins/kibana/public/dev_tools/index.js index f46369a1b9215..18eb4afae2475 100644 --- a/src/core_plugins/kibana/public/dev_tools/index.js +++ b/src/core_plugins/kibana/public/dev_tools/index.js @@ -32,11 +32,15 @@ uiRoutes } }); -FeatureCatalogueRegistryProvider.register(() => { +FeatureCatalogueRegistryProvider.register((i18n) => { return { id: 'console', - title: 'Console', - description: 'Skip cURL and use this JSON interface to work with your data directly.', + title: i18n('kbn.devTools.consoleTitle', { + defaultMessage: 'Console' + }), + description: i18n('kbn.devTools.consoleDescription', { + defaultMessage: 'Skip cURL and use this JSON interface to work with your data directly.' + }), icon: 'consoleApp', path: '/app/kibana#/dev_tools/console', showOnHomePage: true, diff --git a/src/core_plugins/kibana/public/discover/components/field_chooser/discover_field.js b/src/core_plugins/kibana/public/discover/components/field_chooser/discover_field.js index 8ff6e3a5751f6..66b8eb8ab6cd2 100644 --- a/src/core_plugins/kibana/public/discover/components/field_chooser/discover_field.js +++ b/src/core_plugins/kibana/public/discover/components/field_chooser/discover_field.js @@ -60,7 +60,9 @@ app.directive('discoverField', function ($compile, i18n) { let warnings = []; if (field.scripted) { - warnings.push('Scripted fields can take a long time to execute.'); + warnings.push(i18n('kbn.discover.fieldChooser.discoverField.scriptedFieldsTakeLongExecuteDescription', { + defaultMessage: 'Scripted fields can take a long time to execute.', + })); } if (warnings.length > 1) { diff --git a/src/core_plugins/kibana/public/discover/index.html b/src/core_plugins/kibana/public/discover/index.html index a267544bdffcb..f0db90a2f7d10 100644 --- a/src/core_plugins/kibana/public/discover/index.html +++ b/src/core_plugins/kibana/public/discover/index.html @@ -119,7 +119,7 @@

- {{timeRange.from | moment}} - {{timeRange.to | moment}} + {{timeRange.from | moment}} - {{timeRange.to | moment}} — diff --git a/src/core_plugins/kibana/public/doc/index.html b/src/core_plugins/kibana/public/doc/index.html index d4c4cf6726177..ca9637b47bfc7 100644 --- a/src/core_plugins/kibana/public/doc/index.html +++ b/src/core_plugins/kibana/public/doc/index.html @@ -2,9 +2,11 @@
-
- Single Document -
+
@@ -17,7 +19,9 @@
Unknown Id
+ i18n-id="kbn.doc.unknownIdTitle" + i18n-default-message="Unknown Id" + >
@@ -28,14 +32,18 @@
- - Failed to locate document - +
-
- Unfortunately I could not find any documents matching that id, of that type, in that index. I tried really hard. I wanted it to be there. Sometimes I swear documents grow legs and just walk out of the index. Sneaky. I wish I could offer some advice here, something to make you feel better -
+
@@ -45,14 +53,18 @@
- - Failed to execute query - +
-
- Oh no. Something went very wrong. Its not just that I couldn't find your document, I couldn't even try. The index was missing, or the type. Go check out Elasticsearch, something isn't quite right here. -
+
@@ -60,9 +72,11 @@
-
- Loading… -
+
diff --git a/src/core_plugins/kibana/public/home/components/tutorial/__snapshots__/tutorial.test.js.snap b/src/core_plugins/kibana/public/home/components/tutorial/__snapshots__/tutorial.test.js.snap index 84a98a3a7b784..99302e7d9f7f7 100644 --- a/src/core_plugins/kibana/public/home/components/tutorial/__snapshots__/tutorial.test.js.snap +++ b/src/core_plugins/kibana/public/home/components/tutorial/__snapshots__/tutorial.test.js.snap @@ -14,15 +14,23 @@ exports[`isCloudEnabled is false should not render instruction toggle when ON_PR href="#/home" type="button" > - Home + - / + / - Add Data + - Home + - / + / - Add Data + - Home + - / + / - Add Data + + } url={previewUrl} /> ); diff --git a/src/core_plugins/kibana/public/home/components/tutorial/parameter_form.js b/src/core_plugins/kibana/public/home/components/tutorial/parameter_form.js index 401511936c206..3511de4b854d2 100644 --- a/src/core_plugins/kibana/public/home/components/tutorial/parameter_form.js +++ b/src/core_plugins/kibana/public/home/components/tutorial/parameter_form.js @@ -48,7 +48,12 @@ export class ParameterForm extends React.Component { /> ); default: - throw new Error(`Unhandled parameter type ${param.type}`); + throw new Error(this.props.intl.formatMessage({ + id: 'kbn.home.tutorial.unhandledParameterTypeErrorDescription', + defaultMessage: 'Unhandled parameter type {type}' + }, { + type: param.type + })); } }); } diff --git a/src/core_plugins/kibana/public/home/components/tutorial/tutorial.js b/src/core_plugins/kibana/public/home/components/tutorial/tutorial.js index 847265af794d8..cc2943a359580 100644 --- a/src/core_plugins/kibana/public/home/components/tutorial/tutorial.js +++ b/src/core_plugins/kibana/public/home/components/tutorial/tutorial.js @@ -104,7 +104,12 @@ class TutorialUi extends React.Component { case INSTRUCTIONS_TYPE.ON_PREM_ELASTIC_CLOUD: return this.state.tutorial.onPremElasticCloud; default: - throw new Error(`Unhandled instruction type ${this.state.visibleInstructions}`); + throw new Error(this.props.intl.formatMessage({ + id: 'kbn.home.tutorial.unhandledInstructionTypeErrorDescription', + defaultMessage: 'Unhandled instruction type {visibleInstructions}' + }, { + visibleInstructions: this.state.visibleInstructions + })); } }; @@ -354,7 +359,19 @@ class TutorialUi extends React.Component {
- Home / Add Data + + + + / + + +
{content} diff --git a/src/core_plugins/kibana/public/home/components/tutorial_directory.js b/src/core_plugins/kibana/public/home/components/tutorial_directory.js index 63e0ca2d71a8b..740076c8924a7 100644 --- a/src/core_plugins/kibana/public/home/components/tutorial_directory.js +++ b/src/core_plugins/kibana/public/home/components/tutorial_directory.js @@ -195,7 +195,7 @@ class TutorialDirectoryUi extends React.Component {

diff --git a/src/core_plugins/kibana/public/management/sections/indices/create_index_pattern_wizard/components/step_index_pattern/components/loading_indices/__jest__/__snapshots__/loading_indices.test.js.snap b/src/core_plugins/kibana/public/management/sections/indices/create_index_pattern_wizard/components/step_index_pattern/components/loading_indices/__jest__/__snapshots__/loading_indices.test.js.snap index ddad76b12b74f..74e8350e4bfe2 100644 --- a/src/core_plugins/kibana/public/management/sections/indices/create_index_pattern_wizard/components/step_index_pattern/components/loading_indices/__jest__/__snapshots__/loading_indices.test.js.snap +++ b/src/core_plugins/kibana/public/management/sections/indices/create_index_pattern_wizard/components/step_index_pattern/components/loading_indices/__jest__/__snapshots__/loading_indices.test.js.snap @@ -31,7 +31,7 @@ exports[`LoadingIndices should render normally 1`] = ` component="span" > @@ -51,7 +51,7 @@ exports[`LoadingIndices should render normally 1`] = ` component="span" > diff --git a/src/core_plugins/kibana/public/management/sections/indices/create_index_pattern_wizard/components/step_index_pattern/components/loading_indices/loading_indices.js b/src/core_plugins/kibana/public/management/sections/indices/create_index_pattern_wizard/components/step_index_pattern/components/loading_indices/loading_indices.js index bcf25cd363973..377a65003751d 100644 --- a/src/core_plugins/kibana/public/management/sections/indices/create_index_pattern_wizard/components/step_index_pattern/components/loading_indices/loading_indices.js +++ b/src/core_plugins/kibana/public/management/sections/indices/create_index_pattern_wizard/components/step_index_pattern/components/loading_indices/loading_indices.js @@ -44,7 +44,7 @@ export const LoadingIndices = ({ ...rest }) => ( @@ -53,7 +53,7 @@ export const LoadingIndices = ({ ...rest }) => ( diff --git a/src/core_plugins/kibana/public/management/sections/indices/create_index_pattern_wizard/components/step_time_field/__jest__/__snapshots__/step_time_field.test.js.snap b/src/core_plugins/kibana/public/management/sections/indices/create_index_pattern_wizard/components/step_time_field/__jest__/__snapshots__/step_time_field.test.js.snap index 98f052372b81e..65725439490dd 100644 --- a/src/core_plugins/kibana/public/management/sections/indices/create_index_pattern_wizard/components/step_time_field/__jest__/__snapshots__/step_time_field.test.js.snap +++ b/src/core_plugins/kibana/public/management/sections/indices/create_index_pattern_wizard/components/step_time_field/__jest__/__snapshots__/step_time_field.test.js.snap @@ -46,7 +46,7 @@ exports[`StepTimeField should render a loading state when creating the index pat size="m" > diff --git a/src/core_plugins/kibana/public/management/sections/indices/create_index_pattern_wizard/components/step_time_field/components/time_field/__jest__/__snapshots__/time_field.test.js.snap b/src/core_plugins/kibana/public/management/sections/indices/create_index_pattern_wizard/components/step_time_field/components/time_field/__jest__/__snapshots__/time_field.test.js.snap index 1014cf86962de..524990c5daf8e 100644 --- a/src/core_plugins/kibana/public/management/sections/indices/create_index_pattern_wizard/components/step_time_field/components/time_field/__jest__/__snapshots__/time_field.test.js.snap +++ b/src/core_plugins/kibana/public/management/sections/indices/create_index_pattern_wizard/components/step_time_field/components/time_field/__jest__/__snapshots__/time_field.test.js.snap @@ -68,7 +68,7 @@ exports[`TimeField should render a loading state 1`] = ` options={ Array [ Object { - "text": "Loading...", + "text": "Loading…", "value": "", }, ] diff --git a/src/core_plugins/kibana/public/management/sections/indices/create_index_pattern_wizard/components/step_time_field/components/time_field/time_field.js b/src/core_plugins/kibana/public/management/sections/indices/create_index_pattern_wizard/components/step_time_field/components/time_field/time_field.js index 0e87d80e5316c..77a541d1ff7af 100644 --- a/src/core_plugins/kibana/public/management/sections/indices/create_index_pattern_wizard/components/step_time_field/components/time_field/time_field.js +++ b/src/core_plugins/kibana/public/management/sections/indices/create_index_pattern_wizard/components/step_time_field/components/time_field/time_field.js @@ -100,7 +100,7 @@ export const TimeFieldComponent = ({ { text: intl.formatMessage({ id: 'kbn.management.createIndexPattern.stepTime.field.loadingDropDown', - defaultMessage: 'Loading...' + defaultMessage: 'Loading…' }), value: '' } diff --git a/src/core_plugins/kibana/public/management/sections/indices/create_index_pattern_wizard/components/step_time_field/step_time_field.js b/src/core_plugins/kibana/public/management/sections/indices/create_index_pattern_wizard/components/step_time_field/step_time_field.js index 13353d41e5ad0..2b2e588da78a2 100644 --- a/src/core_plugins/kibana/public/management/sections/indices/create_index_pattern_wizard/components/step_time_field/step_time_field.js +++ b/src/core_plugins/kibana/public/management/sections/indices/create_index_pattern_wizard/components/step_time_field/step_time_field.js @@ -138,7 +138,7 @@ export class StepTimeFieldComponent extends Component { From 73bb8b967fab7e660fa4dd9c4ad903ff6d8be9b8 Mon Sep 17 00:00:00 2001 From: Alexandr Ogarkov Date: Thu, 6 Dec 2018 18:30:34 +0300 Subject: [PATCH 2/5] Add translations --- .../kibana/public/management/index.js | 10 +++++++--- .../kibana/public/management/landing.html | 7 ++++++- .../components/header/__jest__/header.test.js | 16 ++++++++-------- .../components/header/header.js | 14 +++++++++++--- .../components/create_button/create_button.js | 9 ++++++++- .../management/sections/objects/_objects.js | 6 +++++- .../components/objects_table/objects_table.js | 5 ++++- .../sections/settings/components/field/field.js | 12 +++++++++++- .../public/management/sections/settings/index.js | 8 ++++++-- 9 files changed, 66 insertions(+), 21 deletions(-) diff --git a/src/legacy/core_plugins/kibana/public/management/index.js b/src/legacy/core_plugins/kibana/public/management/index.js index 6b327686366c6..a977b66c46df4 100644 --- a/src/legacy/core_plugins/kibana/public/management/index.js +++ b/src/legacy/core_plugins/kibana/public/management/index.js @@ -86,11 +86,15 @@ uiModules }; }); -FeatureCatalogueRegistryProvider.register(() => { +FeatureCatalogueRegistryProvider.register((i18n) => { return { id: 'management', - title: 'Management', - description: 'Your center console for managing the Elastic Stack.', + title: i18n('kbn.management.managementLabel', { + defaultMessage: 'Management', + }), + description: i18n('kbn.management.managementDescription', { + defaultMessage: 'Your center console for managing the Elastic Stack.', + }), icon: 'managementApp', path: '/app/kibana#/management', showOnHomePage: false, diff --git a/src/legacy/core_plugins/kibana/public/management/landing.html b/src/legacy/core_plugins/kibana/public/management/landing.html index 3171e6c3226fe..d0f4081b3541f 100644 --- a/src/legacy/core_plugins/kibana/public/management/landing.html +++ b/src/legacy/core_plugins/kibana/public/management/landing.html @@ -2,7 +2,12 @@
-
Version: {{::kbnVersion}}
+
diff --git a/src/legacy/core_plugins/kibana/public/management/sections/indices/create_index_pattern_wizard/components/header/__jest__/header.test.js b/src/legacy/core_plugins/kibana/public/management/sections/indices/create_index_pattern_wizard/components/header/__jest__/header.test.js index 70f3642e3da20..e6a21c5e11ca8 100644 --- a/src/legacy/core_plugins/kibana/public/management/sections/indices/create_index_pattern_wizard/components/header/__jest__/header.test.js +++ b/src/legacy/core_plugins/kibana/public/management/sections/indices/create_index_pattern_wizard/components/header/__jest__/header.test.js @@ -18,13 +18,13 @@ */ import React from 'react'; -import { Header } from '../header'; -import { shallow } from 'enzyme'; +import { HeaderComponent } from '../header'; +import { shallowWithIntl } from 'test_utils/enzyme_helpers'; describe('Header', () => { it('should render normally', () => { - const component = shallow( -
{}} /> @@ -34,8 +34,8 @@ describe('Header', () => { }); it('should render without including system indices', () => { - const component = shallow( -
{}} /> @@ -45,8 +45,8 @@ describe('Header', () => { }); it('should render a different name, prompt, and beta tag if provided', () => { - const component = shallow( -
{}} prompt={
Test prompt
} diff --git a/src/legacy/core_plugins/kibana/public/management/sections/indices/create_index_pattern_wizard/components/header/header.js b/src/legacy/core_plugins/kibana/public/management/sections/indices/create_index_pattern_wizard/components/header/header.js index cefd6141e63f5..47b0430c1bb05 100644 --- a/src/legacy/core_plugins/kibana/public/management/sections/indices/create_index_pattern_wizard/components/header/header.js +++ b/src/legacy/core_plugins/kibana/public/management/sections/indices/create_index_pattern_wizard/components/header/header.js @@ -30,15 +30,16 @@ import { EuiSwitch, } from '@elastic/eui'; -import { FormattedMessage } from '@kbn/i18n/react'; +import { FormattedMessage, injectI18n } from '@kbn/i18n/react'; -export const Header = ({ +export const HeaderComponent = ({ prompt, indexPatternName, showSystemIndices, isIncludingSystemIndices, onChangeIncludingSystemIndices, isBeta, + intl, }) => (
@@ -53,7 +54,12 @@ export const Header = ({ { isBeta ? ( {' '} - + ) : null }

@@ -98,3 +104,5 @@ export const Header = ({ ); + +export const Header = injectI18n(HeaderComponent); diff --git a/src/legacy/core_plugins/kibana/public/management/sections/indices/index_pattern_list/components/create_button/create_button.js b/src/legacy/core_plugins/kibana/public/management/sections/indices/index_pattern_list/components/create_button/create_button.js index 5e20bf6f60dfd..717a13d729285 100644 --- a/src/legacy/core_plugins/kibana/public/management/sections/indices/index_pattern_list/components/create_button/create_button.js +++ b/src/legacy/core_plugins/kibana/public/management/sections/indices/index_pattern_list/components/create_button/create_button.js @@ -33,6 +33,8 @@ import { rgbToHex, } from '@elastic/eui'; +import { FormattedMessage } from '@kbn/i18n/react'; + export class CreateButton extends Component { constructor(props) { super(props); @@ -64,7 +66,12 @@ export class CreateButton extends Component { renderBetaBadge = () => { const color = rgbToHex(euiColorAccent); return ( - Beta + + + ); }; diff --git a/src/legacy/core_plugins/kibana/public/management/sections/objects/_objects.js b/src/legacy/core_plugins/kibana/public/management/sections/objects/_objects.js index d707596bdc049..caf146adff875 100644 --- a/src/legacy/core_plugins/kibana/public/management/sections/objects/_objects.js +++ b/src/legacy/core_plugins/kibana/public/management/sections/objects/_objects.js @@ -29,6 +29,7 @@ import { render, unmountComponentAtNode } from 'react-dom'; import { ObjectsTable } from './components/objects_table'; import { getInAppUrl } from './lib/get_in_app_url'; import { I18nProvider } from '@kbn/i18n/react'; +import { i18n } from '@kbn/i18n'; import { getIndexBreadcrumbs } from './breadcrumbs'; @@ -70,7 +71,10 @@ function updateObjectsTable($scope, $injector) { } const serviceName = typeToServiceName(type); if (!serviceName) { - toastNotifications.addWarning(`Unknown saved object type: ${type}`); + toastNotifications.addWarning(i18n.translate('kbn.management.objects.unknownSavedObjectTypeNotificationMessage', { + defaultMessage: 'Unknown saved object type: {type}', + values: { type } + })); return null; } diff --git a/src/legacy/core_plugins/kibana/public/management/sections/objects/components/objects_table/objects_table.js b/src/legacy/core_plugins/kibana/public/management/sections/objects/components/objects_table/objects_table.js index 0680ea22b2259..d3407b115d212 100644 --- a/src/legacy/core_plugins/kibana/public/management/sections/objects/components/objects_table/objects_table.js +++ b/src/legacy/core_plugins/kibana/public/management/sections/objects/components/objects_table/objects_table.js @@ -191,7 +191,10 @@ class ObjectsTableUI extends Component { }); } toastNotifications.addDanger({ - title: `Unable find saved objects`, + title: this.props.intl.formatMessage({ + id: 'kbn.management.objects.objectsTable.unableFindSavedObjectsNotificationMessage', + defaultMessage: 'Unable find saved objects' + }), text: `${error}`, }); return; diff --git a/src/legacy/core_plugins/kibana/public/management/sections/settings/components/field/field.js b/src/legacy/core_plugins/kibana/public/management/sections/settings/components/field/field.js index 54b72c0d2fece..6724fe59c5146 100644 --- a/src/legacy/core_plugins/kibana/public/management/sections/settings/components/field/field.js +++ b/src/legacy/core_plugins/kibana/public/management/sections/settings/components/field/field.js @@ -354,7 +354,17 @@ class FieldUI extends PureComponent { case 'boolean': return ( + ) : ( + + )} checked={!!unsavedValue} onChange={this.onFieldChange} disabled={loading || isOverridden} diff --git a/src/legacy/core_plugins/kibana/public/management/sections/settings/index.js b/src/legacy/core_plugins/kibana/public/management/sections/settings/index.js index 60ccaf50d2c40..50a07fe32d559 100644 --- a/src/legacy/core_plugins/kibana/public/management/sections/settings/index.js +++ b/src/legacy/core_plugins/kibana/public/management/sections/settings/index.js @@ -88,8 +88,12 @@ management.getSection('kibana').register('settings', { FeatureCatalogueRegistryProvider.register(() => { return { id: 'advanced_settings', - title: 'Advanced Settings', - description: 'Directly edit settings that control behavior in Kibana.', + title: i18n.translate('kbn.management.settings.advancedSettingsLabel', { + defaultMessage: 'Advanced Settings', + }), + description: i18n.translate('kbn.management.settings.advancedSettingsDescription', { + defaultMessage: 'Directly edit settings that control behavior in Kibana.', + }), icon: 'advancedSettingsApp', path: '/app/kibana#/management/kibana/settings', showOnHomePage: false, From d08ca38905ab5b0d44ec6811c48db750e7fbe515 Mon Sep 17 00:00:00 2001 From: maryia-lapata Date: Mon, 10 Dec 2018 13:33:16 +0300 Subject: [PATCH 3/5] Update snapshots --- .../dashboard_listing.test.js.snap | 2 +- .../field/__snapshots__/field.test.js.snap | 32 ++++++++++++++++--- 2 files changed, 29 insertions(+), 5 deletions(-) diff --git a/src/legacy/core_plugins/kibana/public/dashboard/listing/__snapshots__/dashboard_listing.test.js.snap b/src/legacy/core_plugins/kibana/public/dashboard/listing/__snapshots__/dashboard_listing.test.js.snap index 03a7446065aa7..efdc9de5c3b3f 100644 --- a/src/legacy/core_plugins/kibana/public/dashboard/listing/__snapshots__/dashboard_listing.test.js.snap +++ b/src/legacy/core_plugins/kibana/public/dashboard/listing/__snapshots__/dashboard_listing.test.js.snap @@ -532,7 +532,7 @@ exports[`after fetch renders warning when listingLimit is exceeded 1`] = ` >

+ } onChange={[Function]} onKeyDown={[Function]} /> @@ -552,7 +558,13 @@ exports[`Field for boolean setting should render custom setting icon if it is cu checked={true} data-test-subj="advancedSetting-editField-boolean:test:setting" disabled={false} - label="On" + label={ + + } onChange={[Function]} onKeyDown={[Function]} /> @@ -623,7 +635,13 @@ exports[`Field for boolean setting should render default value if there is no us checked={true} data-test-subj="advancedSetting-editField-boolean:test:setting" disabled={false} - label="On" + label={ + + } onChange={[Function]} onKeyDown={[Function]} /> @@ -736,7 +754,13 @@ exports[`Field for boolean setting should render user value if there is user val checked={false} data-test-subj="advancedSetting-editField-boolean:test:setting" disabled={false} - label="Off" + label={ + + } onChange={[Function]} onKeyDown={[Function]} /> From 00e96dea25dc21467af6ca10133dafe894355730 Mon Sep 17 00:00:00 2001 From: Alexandr Ogarkov Date: Mon, 10 Dec 2018 18:21:47 +0300 Subject: [PATCH 4/5] Fix issues --- .../core_plugins/kibana/public/context/query/actions.js | 8 ++++---- .../public/home/components/tutorial/parameter_form.js | 7 +------ .../components/header/__jest__/header.test.js | 8 ++++---- .../components/header/header.js | 4 ++-- .../objects/components/objects_table/objects_table.js | 4 ++-- 5 files changed, 13 insertions(+), 18 deletions(-) diff --git a/src/legacy/core_plugins/kibana/public/context/query/actions.js b/src/legacy/core_plugins/kibana/public/context/query/actions.js index da55dcb32e885..c5a46b35ed18a 100644 --- a/src/legacy/core_plugins/kibana/public/context/query/actions.js +++ b/src/legacy/core_plugins/kibana/public/context/query/actions.js @@ -27,7 +27,7 @@ import { fetchContextProvider } from '../api/context'; import { QueryParameterActionsProvider } from '../query_parameters'; import { FAILURE_REASONS, LOADING_STATUS } from './constants'; -export function QueryActionsProvider(courier, Private, Promise) { +export function QueryActionsProvider(courier, Private, Promise, i18n) { const fetchAnchor = Private(fetchAnchorProvider); const { fetchPredecessors, fetchSuccessors } = Private(fetchContextProvider); const { @@ -58,7 +58,7 @@ export function QueryActionsProvider(courier, Private, Promise) { } ); - const fetchAnchorRow = (state, i18n) => () => { + const fetchAnchorRow = (state) => () => { const { queryParameters: { indexPatternId, anchorType, anchorId, sort, tieBreakerField } } = state; if (!tieBreakerField) { @@ -91,7 +91,7 @@ export function QueryActionsProvider(courier, Private, Promise) { ); }; - const fetchPredecessorRows = (state, i18n) => () => { + const fetchPredecessorRows = (state) => () => { const { queryParameters: { indexPatternId, filters, predecessorCount, sort, tieBreakerField }, rows: { anchor }, @@ -137,7 +137,7 @@ export function QueryActionsProvider(courier, Private, Promise) { ); }; - const fetchSuccessorRows = (state, i18n) => () => { + const fetchSuccessorRows = (state) => () => { const { queryParameters: { indexPatternId, filters, sort, successorCount, tieBreakerField }, rows: { anchor }, diff --git a/src/legacy/core_plugins/kibana/public/home/components/tutorial/parameter_form.js b/src/legacy/core_plugins/kibana/public/home/components/tutorial/parameter_form.js index 3511de4b854d2..401511936c206 100644 --- a/src/legacy/core_plugins/kibana/public/home/components/tutorial/parameter_form.js +++ b/src/legacy/core_plugins/kibana/public/home/components/tutorial/parameter_form.js @@ -48,12 +48,7 @@ export class ParameterForm extends React.Component { /> ); default: - throw new Error(this.props.intl.formatMessage({ - id: 'kbn.home.tutorial.unhandledParameterTypeErrorDescription', - defaultMessage: 'Unhandled parameter type {type}' - }, { - type: param.type - })); + throw new Error(`Unhandled parameter type ${param.type}`); } }); } diff --git a/src/legacy/core_plugins/kibana/public/management/sections/indices/create_index_pattern_wizard/components/header/__jest__/header.test.js b/src/legacy/core_plugins/kibana/public/management/sections/indices/create_index_pattern_wizard/components/header/__jest__/header.test.js index e6a21c5e11ca8..a6766eb865605 100644 --- a/src/legacy/core_plugins/kibana/public/management/sections/indices/create_index_pattern_wizard/components/header/__jest__/header.test.js +++ b/src/legacy/core_plugins/kibana/public/management/sections/indices/create_index_pattern_wizard/components/header/__jest__/header.test.js @@ -18,13 +18,13 @@ */ import React from 'react'; -import { HeaderComponent } from '../header'; +import { Header } from '../header'; import { shallowWithIntl } from 'test_utils/enzyme_helpers'; describe('Header', () => { it('should render normally', () => { const component = shallowWithIntl( - {}} /> @@ -35,7 +35,7 @@ describe('Header', () => { it('should render without including system indices', () => { const component = shallowWithIntl( - {}} /> @@ -46,7 +46,7 @@ describe('Header', () => { it('should render a different name, prompt, and beta tag if provided', () => { const component = shallowWithIntl( - {}} prompt={

Test prompt
} diff --git a/src/legacy/core_plugins/kibana/public/management/sections/indices/create_index_pattern_wizard/components/header/header.js b/src/legacy/core_plugins/kibana/public/management/sections/indices/create_index_pattern_wizard/components/header/header.js index 47b0430c1bb05..26e13638a18dc 100644 --- a/src/legacy/core_plugins/kibana/public/management/sections/indices/create_index_pattern_wizard/components/header/header.js +++ b/src/legacy/core_plugins/kibana/public/management/sections/indices/create_index_pattern_wizard/components/header/header.js @@ -32,7 +32,7 @@ import { import { FormattedMessage, injectI18n } from '@kbn/i18n/react'; -export const HeaderComponent = ({ +const HeaderUi = ({ prompt, indexPatternName, showSystemIndices, @@ -105,4 +105,4 @@ export const HeaderComponent = ({ ); -export const Header = injectI18n(HeaderComponent); +export const Header = injectI18n(HeaderUi); diff --git a/src/legacy/core_plugins/kibana/public/management/sections/objects/components/objects_table/objects_table.js b/src/legacy/core_plugins/kibana/public/management/sections/objects/components/objects_table/objects_table.js index d3407b115d212..7158e3113ec3f 100644 --- a/src/legacy/core_plugins/kibana/public/management/sections/objects/components/objects_table/objects_table.js +++ b/src/legacy/core_plugins/kibana/public/management/sections/objects/components/objects_table/objects_table.js @@ -164,7 +164,7 @@ class ObjectsTableUI extends Component { } debouncedFetch = debounce(async () => { - const { savedObjectsClient } = this.props; + const { intl, savedObjectsClient } = this.props; const { activeQuery: query, page, perPage } = this.state; const { queryText, visibleTypes } = parseQuery(query); const findOptions = { @@ -191,7 +191,7 @@ class ObjectsTableUI extends Component { }); } toastNotifications.addDanger({ - title: this.props.intl.formatMessage({ + title: intl.formatMessage({ id: 'kbn.management.objects.objectsTable.unableFindSavedObjectsNotificationMessage', defaultMessage: 'Unable find saved objects' }), From a56096a257633f674a7979ba56368c78b4bbec7f Mon Sep 17 00:00:00 2001 From: Alexandr Ogarkov Date: Tue, 11 Dec 2018 13:37:53 +0300 Subject: [PATCH 5/5] Fix issues --- .../__snapshots__/tutorial.test.js.snap | 12 +++------ .../home/components/tutorial/introduction.js | 27 +++++++++++-------- .../components/tutorial/introduction.test.js | 12 ++++----- 3 files changed, 26 insertions(+), 25 deletions(-) diff --git a/src/legacy/core_plugins/kibana/public/home/components/tutorial/__snapshots__/tutorial.test.js.snap b/src/legacy/core_plugins/kibana/public/home/components/tutorial/__snapshots__/tutorial.test.js.snap index 96a7ae1a4079d..673fe4bcfcb95 100644 --- a/src/legacy/core_plugins/kibana/public/home/components/tutorial/__snapshots__/tutorial.test.js.snap +++ b/src/legacy/core_plugins/kibana/public/home/components/tutorial/__snapshots__/tutorial.test.js.snap @@ -35,9 +35,8 @@ exports[`isCloudEnabled is false should not render instruction toggle when ON_PR />
-
-
-
- - } + alt={intl.formatMessage({ + id: 'kbn.home.tutorial.introduction.imageAltDescription', + defaultMessage: 'screenshot of primary dashboard.' + })} url={previewUrl} /> ); @@ -80,7 +78,12 @@ export function Introduction({ description, previewUrl, title, exportedFieldsUrl let betaBadge; if (isBeta) { betaBadge = ( - + ); } return ( @@ -114,7 +117,7 @@ export function Introduction({ description, previewUrl, title, exportedFieldsUrl ); } -Introduction.propTypes = { +IntroductionUI.propTypes = { description: PropTypes.string.isRequired, title: PropTypes.string.isRequired, previewUrl: PropTypes.string, @@ -123,6 +126,8 @@ Introduction.propTypes = { isBeta: PropTypes.bool, }; -Introduction.defaultProps = { +IntroductionUI.defaultProps = { isBeta: false }; + +export const Introduction = injectI18n(IntroductionUI); diff --git a/src/legacy/core_plugins/kibana/public/home/components/tutorial/introduction.test.js b/src/legacy/core_plugins/kibana/public/home/components/tutorial/introduction.test.js index b90a020275225..ba7e5febc50f8 100644 --- a/src/legacy/core_plugins/kibana/public/home/components/tutorial/introduction.test.js +++ b/src/legacy/core_plugins/kibana/public/home/components/tutorial/introduction.test.js @@ -18,12 +18,12 @@ */ import React from 'react'; -import { shallow } from 'enzyme'; +import { shallowWithIntl } from 'test_utils/enzyme_helpers'; import { Introduction } from './introduction'; test('render', () => { - const component = shallow(); @@ -32,7 +32,7 @@ test('render', () => { describe('props', () => { test('iconType', () => { - const component = shallow( { }); test('exportedFieldsUrl', () => { - const component = shallow( { }); test('previewUrl', () => { - const component = shallow( { }); test('isBeta', () => { - const component = shallow(