From b52c48a24b8446197b9ae49669f0d78cfe41c082 Mon Sep 17 00:00:00 2001 From: Alexandr Ogarkov Date: Tue, 11 Dec 2018 18:22:37 +0300 Subject: [PATCH 1/4] Translate context and docs --- .../kibana/public/context/api/anchor.js | 6 +- .../kibana/public/context/app.html | 78 +++++++++++++------ .../core_plugins/kibana/public/context/app.js | 7 +- .../kibana/public/context/query/actions.js | 10 ++- .../core_plugins/kibana/public/doc/index.html | 52 ++++++++----- 5 files changed, 104 insertions(+), 49 deletions(-) diff --git a/src/legacy/core_plugins/kibana/public/context/api/anchor.js b/src/legacy/core_plugins/kibana/public/context/api/anchor.js index 4c541845251f6..c1d4823346b16 100644 --- a/src/legacy/core_plugins/kibana/public/context/api/anchor.js +++ b/src/legacy/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/legacy/core_plugins/kibana/public/context/app.html b/src/legacy/core_plugins/kibana/public/context/app.html index e1bca77170672..2a36f3be47c69 100644 --- a/src/legacy/core_plugins/kibana/public/context/app.html +++ b/src/legacy/core_plugins/kibana/public/context/app.html @@ -1,9 +1,16 @@
-
- Surrounding Documents in {{ contextApp.state.queryParameters.indexPatternId }} -
+
@@ -25,31 +32,34 @@
- - 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 +80,13 @@ icon="'fa-chevron-up'" ng-click="contextApp.actions.fetchMorePredecessorRows()" > - Load {{ contextApp.state.queryParameters.defaultStepSize }} more + - newer documents + -
- Loading… -
+
@@ -136,7 +157,13 @@ icon="'fa-chevron-down'" ng-click="contextApp.actions.fetchMoreSuccessorRows()" > - Load {{ contextApp.state.queryParameters.defaultStepSize }} more + -
older documents
+
-
- 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… -
+
From 5bf72140fd9c38bf8e1ee2d3b8cdc425ec266b1d Mon Sep 17 00:00:00 2001 From: Alexandr Ogarkov Date: Thu, 13 Dec 2018 10:37:56 +0300 Subject: [PATCH 2/4] Fix issues --- src/legacy/core_plugins/kibana/public/context/app.html | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) diff --git a/src/legacy/core_plugins/kibana/public/context/app.html b/src/legacy/core_plugins/kibana/public/context/app.html index 2a36f3be47c69..85df7e2e8d19c 100644 --- a/src/legacy/core_plugins/kibana/public/context/app.html +++ b/src/legacy/core_plugins/kibana/public/context/app.html @@ -47,7 +47,7 @@ i18n-default-message="No searchable tiebreaker field could be found in the index pattern {indexPatternId}. Please change the advanced setting {tieBreakerFields} to include a valid field for this index pattern." i18n-values="{ indexPatternId: contextApp.state.queryParameters.indexPatternId, - tieBreakerFields: 'context:tieBreakerFields' + html_tieBreakerFields: 'context:tieBreakerFields' }" > @@ -57,7 +57,7 @@ i18n-id="kbn.context.pleaseReloadPageDescription" i18n-default-message="Please reload or visit {navigationLink} to select a valid anchor document." i18n-values="{ - navigationLink: '' + contextApp.discover + '' + html_navigationLink: '' + contextApp.discover + '' }" > From 7c76c50a7301e1eac90bc6f5eb2c871e4cc8c21b Mon Sep 17 00:00:00 2001 From: Alexandr Ogarkov Date: Thu, 13 Dec 2018 12:11:46 +0300 Subject: [PATCH 3/4] Fix issues --- src/legacy/core_plugins/kibana/public/context/app.html | 2 +- src/legacy/core_plugins/kibana/public/context/app.js | 2 +- 2 files changed, 2 insertions(+), 2 deletions(-) diff --git a/src/legacy/core_plugins/kibana/public/context/app.html b/src/legacy/core_plugins/kibana/public/context/app.html index 85df7e2e8d19c..b315a34fd1db3 100644 --- a/src/legacy/core_plugins/kibana/public/context/app.html +++ b/src/legacy/core_plugins/kibana/public/context/app.html @@ -57,7 +57,7 @@ i18n-id="kbn.context.pleaseReloadPageDescription" i18n-default-message="Please reload or visit {navigationLink} to select a valid anchor document." i18n-values="{ - html_navigationLink: '' + contextApp.discover + '' + html_navigationLink: '' + contextApp.discoverLinkLabel + '' }" > diff --git a/src/legacy/core_plugins/kibana/public/context/app.js b/src/legacy/core_plugins/kibana/public/context/app.js index 4409b3bad56ff..8cdbb0ed1c23c 100644 --- a/src/legacy/core_plugins/kibana/public/context/app.js +++ b/src/legacy/core_plugins/kibana/public/context/app.js @@ -138,7 +138,7 @@ function ContextAppController($scope, config, Private, i18n) { }, ); - this.discover = i18n('kbn.context.discoverDescription', { + this.discoverLinkLabel = i18n('kbn.context.discoverLinkLabel', { defaultMessage: 'Discover' }); } From a48e205b064117015fec3369173a6e20821e374f Mon Sep 17 00:00:00 2001 From: Alexandr Ogarkov Date: Thu, 13 Dec 2018 14:43:44 +0300 Subject: [PATCH 4/4] Fix issues --- .../kibana/public/context/app.html | 24 ++++++++++++++----- .../core_plugins/kibana/public/context/app.js | 6 +---- 2 files changed, 19 insertions(+), 11 deletions(-) diff --git a/src/legacy/core_plugins/kibana/public/context/app.html b/src/legacy/core_plugins/kibana/public/context/app.html index b315a34fd1db3..022e343df0a79 100644 --- a/src/legacy/core_plugins/kibana/public/context/app.html +++ b/src/legacy/core_plugins/kibana/public/context/app.html @@ -54,12 +54,24 @@
+ > + + + + diff --git a/src/legacy/core_plugins/kibana/public/context/app.js b/src/legacy/core_plugins/kibana/public/context/app.js index 8cdbb0ed1c23c..bfa4ae5bb6da2 100644 --- a/src/legacy/core_plugins/kibana/public/context/app.js +++ b/src/legacy/core_plugins/kibana/public/context/app.js @@ -67,7 +67,7 @@ module.directive('contextApp', function ContextApp() { }; }); -function ContextAppController($scope, config, Private, i18n) { +function ContextAppController($scope, config, Private) { const queryParameterActions = Private(QueryParameterActionsProvider); const queryActions = Private(QueryActionsProvider); @@ -137,10 +137,6 @@ function ContextAppController($scope, config, Private, i18n) { _.assign(this, newParameters); }, ); - - this.discoverLinkLabel = i18n('kbn.context.discoverLinkLabel', { - defaultMessage: 'Discover' - }); }