From d7da13bb6322ea30245dca09b6581ab8c61f05c3 Mon Sep 17 00:00:00 2001 From: Nox911 Date: Tue, 30 Oct 2018 18:46:52 +0300 Subject: [PATCH] Feature/translate new nav bar breadcrumb state (#24327) Translate new_nav_bar breadcrumbState --- .../kibana/public/dashboard/dashboard_app.js | 8 +++++++- src/core_plugins/kibana/public/dashboard/index.js | 7 ++++++- .../kibana/public/discover/controllers/discover.js | 14 ++++++++++++-- .../public/visualize/listing/visualize_listing.js | 7 ++++++- 4 files changed, 31 insertions(+), 5 deletions(-) diff --git a/src/core_plugins/kibana/public/dashboard/dashboard_app.js b/src/core_plugins/kibana/public/dashboard/dashboard_app.js index b69fab6c43635..e087048912e5f 100644 --- a/src/core_plugins/kibana/public/dashboard/dashboard_app.js +++ b/src/core_plugins/kibana/public/dashboard/dashboard_app.js @@ -56,6 +56,7 @@ import { timefilter } from 'ui/timefilter'; import { getUnhashableStatesProvider } from 'ui/state_management/state_hashing'; import { DashboardViewportProvider } from './viewport/dashboard_viewport_provider'; +import { i18n } from '@kbn/i18n'; const app = uiModules.get('app/dashboard', [ 'elasticsearch', @@ -182,7 +183,12 @@ app.directive('dashboardApp', function ($injector) { // Push breadcrumbs to new header navigation const updateBreadcrumbs = () => { breadcrumbState.set([ - { text: 'Dashboard', href: $scope.landingPageUrl() }, + { + text: i18n.translate('kbn.dashboard.dashboardAppBreadcrumbsTitle', { + defaultMessage: 'Dashboard', + }), + href: $scope.landingPageUrl() + }, { text: $scope.getDashTitle() } ]); }; diff --git a/src/core_plugins/kibana/public/dashboard/index.js b/src/core_plugins/kibana/public/dashboard/index.js index eadcefe96872c..3c302ec41bb67 100644 --- a/src/core_plugins/kibana/public/dashboard/index.js +++ b/src/core_plugins/kibana/public/dashboard/index.js @@ -34,6 +34,7 @@ import { recentlyAccessed } from 'ui/persisted_log'; import { SavedObjectRegistryProvider } from 'ui/saved_objects/saved_object_registry'; import { DashboardListing, EMPTY_FILTER } from './listing/dashboard_listing'; import { uiModules } from 'ui/modules'; +import { i18n } from '@kbn/i18n'; const app = uiModules.get('app/dashboard', [ 'ngRoute', @@ -63,7 +64,11 @@ uiRoutes }; $scope.hideWriteControls = dashboardConfig.getHideWriteControls(); $scope.initialFilter = ($location.search()).filter || EMPTY_FILTER; - breadcrumbState.set([{ text: 'Dashboards' }]); + breadcrumbState.set([{ + text: i18n.translate('kbn.dashboard.dashboardBreadcrumbsTitle', { + defaultMessage: 'Dashboards', + }), + }]); }, resolve: { dash: function ($route, Private, redirectWhenMissing, kbnUrl) { diff --git a/src/core_plugins/kibana/public/discover/controllers/discover.js b/src/core_plugins/kibana/public/discover/controllers/discover.js index 57b40182c70a3..850ffdb4600c3 100644 --- a/src/core_plugins/kibana/public/discover/controllers/discover.js +++ b/src/core_plugins/kibana/public/discover/controllers/discover.js @@ -63,6 +63,7 @@ import { showOpenSearchPanel } from '../top_nav/show_open_search_panel'; import { tabifyAggResponse } from 'ui/agg_response/tabify'; import { showSaveModal } from 'ui/saved_objects/show_saved_object_save_modal'; import { SavedObjectSaveModal } from 'ui/saved_objects/components/saved_object_save_modal'; +import { i18n } from '@kbn/i18n'; const app = uiModules.get('apps/discover', [ 'kibana/notify', @@ -295,10 +296,19 @@ function discoverController( const pageTitleSuffix = savedSearch.id && savedSearch.title ? `: ${savedSearch.title}` : ''; docTitle.change(`Discover${pageTitleSuffix}`); + const discoverBreadcrumbsTitle = i18n.translate('kbn.discover.discoverBreadcrumbsTitle', { + defaultMessage: 'Discover', + }); + if (savedSearch.id && savedSearch.title) { - breadcrumbState.set([{ text: 'Discover', href: '#/discover' }, { text: savedSearch.title }]); + breadcrumbState.set([{ + text: discoverBreadcrumbsTitle, + href: '#/discover' + }, { text: savedSearch.title }]); } else { - breadcrumbState.set([{ text: 'Discover' }]); + breadcrumbState.set([{ + text: discoverBreadcrumbsTitle, + }]); } let stateMonitor; diff --git a/src/core_plugins/kibana/public/visualize/listing/visualize_listing.js b/src/core_plugins/kibana/public/visualize/listing/visualize_listing.js index 0f8808e11fde8..a6f839a8481c1 100644 --- a/src/core_plugins/kibana/public/visualize/listing/visualize_listing.js +++ b/src/core_plugins/kibana/public/visualize/listing/visualize_listing.js @@ -22,6 +22,7 @@ import 'ui/pager_control'; import 'ui/pager'; import { uiModules } from 'ui/modules'; import { timefilter } from 'ui/timefilter'; +import { i18n } from '@kbn/i18n'; import { VisualizeListingTable } from './visualize_listing_table'; @@ -60,6 +61,10 @@ export function VisualizeListingController($injector) { .catch(error => notify.error(error)); }; - breadcrumbState.set([{ text: 'Visualize' }]); + breadcrumbState.set([{ + text: i18n.translate('kbn.visualize.visualizeListingBreadcrumbsTitle', { + defaultMessage: 'Visualize', + }) + }]); config.watch('k7design', (val) => this.showPluginBreadcrumbs = !val); }