[i18n] Translate ML - util (#27971)

* Translate public -> util folder

* Add translations for register_feature.js and breadcrumbs.js

* Resolve issues from review comments
This commit is contained in:
Nox911 2019-01-04 15:26:42 +03:00 committed by GitHub
parent bb3bd2a16d
commit 3496dff912
No known key found for this signature in database
GPG key ID: 4AEE18F83AFDEB23
4 changed files with 29 additions and 9 deletions

View file

@ -4,8 +4,11 @@
* you may not use this file except in compliance with the Elastic License.
*/
import { i18n } from '@kbn/i18n';
export const ML_BREADCRUMB = Object.freeze({
text: 'Machine Learning',
text: i18n.translate('xpack.ml.machineLearningBreadcrumbLabel', {
defaultMessage: 'Machine Learning'
}),
href: '#/'
});

View file

@ -8,11 +8,15 @@
import { FeatureCatalogueRegistryProvider, FeatureCatalogueCategory } from 'ui/registry/feature_catalogue';
FeatureCatalogueRegistryProvider.register(() => {
FeatureCatalogueRegistryProvider.register(i18n => {
return {
id: 'ml',
title: 'Machine Learning',
description: 'Automatically model the normal behavior of your time series data to detect anomalies.',
title: i18n('xpack.ml.machineLearningTitle', {
defaultMessage: 'Machine Learning'
}),
description: i18n('xpack.ml.machineLearningDescription', {
defaultMessage: 'Automatically model the normal behavior of your time series data to detect anomalies.'
}),
icon: 'machineLearningApp',
path: '/app/ml',
showOnHomePage: true,

View file

@ -8,6 +8,7 @@
import { toastNotifications } from 'ui/notify';
import { SavedObjectsClientProvider } from 'ui/saved_objects';
import { i18n } from '@kbn/i18n';
let indexPatternCache = [];
let fullIndexPatterns = [];
@ -91,8 +92,13 @@ export function timeBasedIndexCheck(indexPattern, showNotification = false) {
if (indexPattern.isTimeBased() === false) {
if (showNotification) {
toastNotifications.addWarning({
title: `The index pattern ${indexPattern.title} is not based on a time series`,
text: 'Anomaly detection only runs over time-based indices',
title: i18n.translate('xpack.ml.indexPatternNotBasedOnTimeSeriesNotificationTitle', {
defaultMessage: 'The index pattern {indexPatternTitle} is not based on a time series',
values: { indexPatternTitle: indexPattern.title }
}),
text: i18n.translate('xpack.ml.indexPatternNotBasedOnTimeSeriesNotificationDescription', {
defaultMessage: 'Anomaly detection only runs over time-based indices'
}),
});
}
return false;

View file

@ -9,6 +9,7 @@
// utility functions for managing which links get added to kibana's recently accessed list
import { recentlyAccessed } from 'ui/persisted_log';
import { i18n } from '@kbn/i18n';
export function addItemToRecentlyAccessed(page, itemId, url) {
let pageLabel = '';
@ -16,13 +17,19 @@ export function addItemToRecentlyAccessed(page, itemId, url) {
switch (page) {
case 'explorer':
pageLabel = 'Anomaly Explorer';
pageLabel = i18n.translate('xpack.ml.anomalyExplorerPageLabel', {
defaultMessage: 'Anomaly Explorer'
});
break;
case 'timeseriesexplorer':
pageLabel = 'Single Metric Viewer';
pageLabel = i18n.translate('xpack.ml.singleMetricViewerPageLabel', {
defaultMessage: 'Single Metric Viewer'
});
break;
case 'jobs/new_job/datavisualizer':
pageLabel = 'Data Visualizer';
pageLabel = i18n.translate('xpack.ml.dataVisualizerPageLabel', {
defaultMessage: 'Data Visualizer'
});
id = `ml-datavisualizer-${itemId}`;
break;
default: