From 6247189bb6b6faf56fab9f7cdde10f301c263fdb Mon Sep 17 00:00:00 2001 From: Nox911 Date: Fri, 19 Oct 2018 20:47:05 +0300 Subject: [PATCH] Feature/translate watcher(part_1) (#23989) * translate watcher(pad_1) * fix test * fix issues * fix the same id name * fix default message * fix issues --- .i18nrc.json | 3 +- .../action_status_table.html | 11 +- .../components/watch_detail/watch_detail.html | 38 ++++--- .../components/watch_detail/watch_detail.js | 19 +++- .../watch_history/watch_history.html | 4 +- .../watch_history_range_filter.html | 42 ++++++-- .../watch_history_table.html | 6 +- .../json_watch_edit/json_watch_edit.html | 24 +++-- .../json_watch_edit/json_watch_edit.js | 51 +++++++-- .../threshold_watch_edit.html | 13 ++- .../threshold_watch_edit.js | 31 +++++- .../watch_action_mode_table.html | 21 +++- .../watch_edit_actions_execute_summary.html | 35 +++++- .../watch_edit_detail/watch_edit_detail.html | 47 ++++---- .../watch_edit_detail/watch_edit_detail.js | 4 +- .../watch_edit_execute_detail.html | 56 +++++----- .../watch_edit_execute_info_panel.html | 16 +-- .../watch_edit_title_bar.html | 26 +++-- .../watch_edit_title_panel.html | 100 ++++++++++-------- .../watch_edit_title_panel.js | 7 +- .../watch_edit_watch_execute_summary.html | 5 +- .../watch_history_item.html | 5 +- .../watch_history_item_actions_summary.html | 28 ++++- .../watch_history_item_watch_summary.html | 5 +- .../components/watch_list/watch_list.html | 30 +++--- .../components/watch_list/watch_list.js | 31 ++++-- .../components/watch_table/watch_table.html | 19 ++-- .../watch_list/register_management_section.js | 21 +++- 28 files changed, 466 insertions(+), 232 deletions(-) diff --git a/.i18nrc.json b/.i18nrc.json index cba5a18f6c959d..2b15e16458650d 100644 --- a/.i18nrc.json +++ b/.i18nrc.json @@ -8,7 +8,8 @@ "metricVis": "src/core_plugins/metric_vis", "statusPage": "src/core_plugins/status_page", "tagCloud": "src/core_plugins/tagcloud", - "xpack.idxMgmt": "x-pack/plugins/index_management" + "xpack.idxMgmt": "x-pack/plugins/index_management", + "xpack.watcher": "x-pack/plugins/watcher" }, "exclude": [ "src/ui/ui_render/bootstrap/app_bootstrap.js", diff --git a/x-pack/plugins/watcher/public/sections/watch_detail/components/action_status_table/action_status_table.html b/x-pack/plugins/watcher/public/sections/watch_detail/components/action_status_table/action_status_table.html index d620ea054483cc..1e89ebd0998077 100644 --- a/x-pack/plugins/watcher/public/sections/watch_detail/components/action_status_table/action_status_table.html +++ b/x-pack/plugins/watcher/public/sections/watch_detail/components/action_status_table/action_status_table.html @@ -8,7 +8,7 @@ sort-field="actionStatusTable.sortField" sort-reverse="actionStatusTable.sortReverse" > - Action + {{ 'xpack.watcher.sections.watchDetail.actionStatusTable.actionColumnLabel' | i18n: { defaultMessage: 'Action' } }} @@ -18,7 +18,7 @@ sort-field="actionStatusTable.sortField" sort-reverse="actionStatusTable.sortReverse" > - State + {{ 'xpack.watcher.sections.watchDetail.actionStatusTable.stateColumnLabel' | i18n: { defaultMessage: 'State' } }} @@ -45,12 +45,15 @@ diff --git a/x-pack/plugins/watcher/public/sections/watch_detail/components/watch_detail/watch_detail.html b/x-pack/plugins/watcher/public/sections/watch_detail/components/watch_detail/watch_detail.html index 256f1288ba02ed..5e4397a825c63f 100644 --- a/x-pack/plugins/watcher/public/sections/watch_detail/components/watch_detail/watch_detail.html +++ b/x-pack/plugins/watcher/public/sections/watch_detail/components/watch_detail/watch_detail.html @@ -10,9 +10,11 @@
-

- Current Status -

+

@@ -22,24 +24,24 @@

ng-click="watchDetail.onWatchDeactivate()" class="kuiButton kuiButton--basic" data-test-subj="btnDeactivateWatch" - > - Deactivate - + i18n-id="xpack.watcher.sections.watchDetail.deactivateButtonLabel" + i18n-default-message="Deactivate" + > + i18n-id="xpack.watcher.sections.watchDetail.activateButtonLabel" + i18n-default-message="Activate" + > + i18n-id="xpack.watcher.sections.watchDetail.deleteButtonLabel" + i18n-default-message="Delete" + >

@@ -56,14 +58,18 @@

sort-reverse="watchDetail.actionStatusTableSortReverse" on-sort-change="watchDetail.onActionSortChange" > - No actions found. + + {{ 'xpack.watcher.sections.watchDetail.noActionsFoundText' | i18n: { defaultMessage: 'No actions found.' } }} +
-

- Watch History -

+

diff --git a/x-pack/plugins/watcher/public/sections/watch_detail/components/watch_detail/watch_detail.js b/x-pack/plugins/watcher/public/sections/watch_detail/components/watch_detail/watch_detail.js index 498e7279122f23..41cb264c1d916e 100644 --- a/x-pack/plugins/watcher/public/sections/watch_detail/components/watch_detail/watch_detail.js +++ b/x-pack/plugins/watcher/public/sections/watch_detail/components/watch_detail/watch_detail.js @@ -22,7 +22,7 @@ import { REFRESH_INTERVALS } from 'plugins/watcher/../common/constants'; const app = uiModules.get('xpack/watcher'); -app.directive('watchDetail', function ($injector) { +app.directive('watchDetail', function ($injector, i18n) { const watchService = $injector.get('xpackWatcherWatchService'); const licenseService = $injector.get('xpackWatcherLicenseService'); @@ -152,17 +152,28 @@ app.directive('watchDetail', function ($injector) { onWatchDelete = () => { const confirmModalOptions = { - confirmButtonText: 'Delete Watch', + confirmButtonText: i18n('xpack.watcher.sections.watchDetail.deleteConfirmModal.deleteWatchButtonLabel', { + defaultMessage: 'Delete Watch' } + ), onConfirm: this.deleteWatch }; - return confirmModal('This will permanently delete the watch. Are you sure?', confirmModalOptions); + return confirmModal( + i18n('xpack.watcher.sections.watchDetail.deleteConfirmModal.description', { + defaultMessage: 'This will permanently delete the watch. Are you sure?' } + ), + confirmModalOptions); } deleteWatch = () => { return watchService.deleteWatch(this.watch.id) .then(() => { - toastNotifications.addSuccess(`Deleted '${this.watch.displayName}'`); + toastNotifications.addSuccess( + i18n('xpack.watcher.sections.watchDetail.deleteWatchSuccessNotificationText', { + defaultMessage: 'Deleted {watchName}', + values: { watchName: this.watch.displayName } } + ), + ); this.close(); }) .catch(err => { diff --git a/x-pack/plugins/watcher/public/sections/watch_detail/components/watch_history/watch_history.html b/x-pack/plugins/watcher/public/sections/watch_detail/components/watch_history/watch_history.html index 68927530e60851..79238eb4838bd2 100644 --- a/x-pack/plugins/watcher/public/sections/watch_detail/components/watch_history/watch_history.html +++ b/x-pack/plugins/watcher/public/sections/watch_detail/components/watch_history/watch_history.html @@ -27,10 +27,10 @@ - Loading watch history… + {{ 'xpack.watcher.sections.watchDetail.watchHistory.watchHistoryLoadingText' | i18n: { defaultMessage: 'Loading watch history' } }}… - No watch history found. + {{ 'xpack.watcher.sections.watchDetail.watchHistory.watchHistoryNotFoundText' | i18n: { defaultMessage: 'No watch history found.' } }} - - - - - - - + + + + + + + diff --git a/x-pack/plugins/watcher/public/sections/watch_detail/components/watch_history_table/watch_history_table.html b/x-pack/plugins/watcher/public/sections/watch_detail/components/watch_history_table/watch_history_table.html index 708730940d911e..e87c1e57f11be1 100644 --- a/x-pack/plugins/watcher/public/sections/watch_detail/components/watch_history_table/watch_history_table.html +++ b/x-pack/plugins/watcher/public/sections/watch_detail/components/watch_history_table/watch_history_table.html @@ -8,7 +8,7 @@ sort-field="watchHistoryTable.sortField" sort-reverse="watchHistoryTable.sortReverse" > - Trigger Time + {{ 'xpack.watcher.sections.watchDetail.watchHistoryTable.triggerTimeColumnLabel' | i18n: { defaultMessage: 'Trigger Time' } }} @@ -18,7 +18,7 @@ sort-field="watchHistoryTable.sortField" sort-reverse="watchHistoryTable.sortReverse" > - State + {{ 'xpack.watcher.sections.watchDetail.watchHistoryTable.stateColumnLabel' | i18n: { defaultMessage: 'State' } }} @@ -28,7 +28,7 @@ sort-field="watchHistoryTable.sortField" sort-reverse="watchHistoryTable.sortReverse" > - Comment + {{ 'xpack.watcher.sections.watchDetail.watchHistoryTable.commentColumnLabel' | i18n: { defaultMessage: 'Comment' } }} diff --git a/x-pack/plugins/watcher/public/sections/watch_edit/components/json_watch_edit/json_watch_edit.html b/x-pack/plugins/watcher/public/sections/watch_edit/components/json_watch_edit/json_watch_edit.html index 3d02c6a72bdaa3..824117b3d415c4 100644 --- a/x-pack/plugins/watcher/public/sections/watch_edit/components/json_watch_edit/json_watch_edit.html +++ b/x-pack/plugins/watcher/public/sections/watch_edit/components/json_watch_edit/json_watch_edit.html @@ -22,22 +22,22 @@ > - Edit + {{ 'xpack.watcher.sections.watchEdit.json.editTabLabel' | i18n: { defaultMessage: 'Edit' } }} - Simulate + {{ 'xpack.watcher.sections.watchEdit.json.simulateTabLabel' | i18n: { defaultMessage: 'Simulate' } }} - Simulation Results + {{ 'xpack.watcher.sections.watchEdit.json.simulateResultsTabLabel' | i18n: { defaultMessage: 'Simulation Results' } }}
@@ -79,8 +79,11 @@ ng-click="jsonWatchEdit.onWatchExecute()" data-test-subj="btnSimulateWatch" > - - Simulate Watch + @@ -104,7 +107,10 @@
- + diff --git a/x-pack/plugins/watcher/public/sections/watch_edit/components/json_watch_edit/json_watch_edit.js b/x-pack/plugins/watcher/public/sections/watch_edit/components/json_watch_edit/json_watch_edit.js index 970d2bd587e17f..9ff9382f8a9995 100644 --- a/x-pack/plugins/watcher/public/sections/watch_edit/components/json_watch_edit/json_watch_edit.js +++ b/x-pack/plugins/watcher/public/sections/watch_edit/components/json_watch_edit/json_watch_edit.js @@ -21,7 +21,7 @@ import 'plugins/watcher/services/license'; const app = uiModules.get('xpack/watcher'); -app.directive('jsonWatchEdit', function ($injector) { +app.directive('jsonWatchEdit', function ($injector, i18n) { const watchService = $injector.get('xpackWatcherWatchService'); const licenseService = $injector.get('xpackWatcherLicenseService'); const kbnUrl = $injector.get('kbnUrl'); @@ -112,11 +112,25 @@ app.directive('jsonWatchEdit', function ($injector) { const confirmModalOptions = { onConfirm: this.saveWatch, - confirmButtonText: 'Overwrite Watch' + confirmButtonText: i18n('xpack.watcher.sections.watchEdit.json.saveConfirmModal.overwriteWatchButtonLabel', { + defaultMessage: 'Overwrite Watch', + }), }; - const watchNameMessageFragment = existingWatch.name ? ` (name: "${existingWatch.name}")` : ''; - const message = `Watch with ID "${this.watch.id}"${watchNameMessageFragment} already exists. Do you want to overwrite it?`; + const message = i18n('xpack.watcher.sections.watchEdit.json.saveConfirmModal.description', { + defaultMessage: 'Watch with ID "{watchId}" {watchNameMessageFragment} already exists. Do you want to overwrite it?', + values: { + watchId: this.watch.id, + watchNameMessageFragment: existingWatch.name + ? i18n('xpack.watcher.sections.watchEdit.json.saveConfirmModal.descriptionFragmentText', { + defaultMessage: '(name: "{existingWatchName}")', + values: { + existingWatchName: existingWatch.name + } + }) + : '' + } + }); return confirmModal(message, confirmModalOptions); }) .catch(err => toastNotifications.addDanger(err)); @@ -142,7 +156,14 @@ app.directive('jsonWatchEdit', function ($injector) { return watchService.saveWatch(this.watch) .then(() => { this.watch.isNew = false; // without this, the message displays 'New Watch' - toastNotifications.addSuccess(`Saved '${this.watch.displayName}'`); + toastNotifications.addSuccess( + i18n('xpack.watcher.sections.watchEdit.json.saveSuccessNotificationText', { + defaultMessage: 'Saved \'{watchDisplayName}\'', + values: { + watchDisplayName: this.watch.displayName + } + }), + ); this.onClose(); }) .catch(err => { @@ -154,16 +175,30 @@ app.directive('jsonWatchEdit', function ($injector) { onWatchDelete = () => { const confirmModalOptions = { onConfirm: this.deleteWatch, - confirmButtonText: 'Delete Watch' + confirmButtonText: i18n('xpack.watcher.sections.watchEdit.json.deleteConfirmModal.overwriteWatchButtonLabel', { + defaultMessage: 'Delete Watch', + }), }; - return confirmModal('This will permanently delete the watch. Are you sure?', confirmModalOptions); + return confirmModal( + i18n('xpack.watcher.sections.watchEdit.json.deleteConfirmModal.description', { + defaultMessage: 'This will permanently delete the watch. Are you sure?', + }), + confirmModalOptions + ); } deleteWatch = () => { return watchService.deleteWatch(this.watch.id) .then(() => { - toastNotifications.addSuccess(`Deleted '${this.watch.displayName}'`); + toastNotifications.addSuccess( + i18n('xpack.watcher.sections.watchEdit.json.deleteSuccessNotificationText', { + defaultMessage: 'Deleted \'{watchDisplayName}\'', + values: { + watchDisplayName: this.watch.displayName + } + }), + ); this.onClose(); }) .catch(err => { diff --git a/x-pack/plugins/watcher/public/sections/watch_edit/components/threshold_watch_edit/threshold_watch_edit.html b/x-pack/plugins/watcher/public/sections/watch_edit/components/threshold_watch_edit/threshold_watch_edit.html index 2eb1c348c034ea..171efb25c312ea 100644 --- a/x-pack/plugins/watcher/public/sections/watch_edit/components/threshold_watch_edit/threshold_watch_edit.html +++ b/x-pack/plugins/watcher/public/sections/watch_edit/components/threshold_watch_edit/threshold_watch_edit.html @@ -22,9 +22,11 @@ >
-

- Matching the following condition -

+

@@ -93,7 +95,10 @@

ng-disabled="thresholdWatchEdit.saveDisabled" ng-click="thresholdWatchEdit.onWatchSave()"> - Save + diff --git a/x-pack/plugins/watcher/public/sections/watch_edit/components/threshold_watch_edit/threshold_watch_edit.js b/x-pack/plugins/watcher/public/sections/watch_edit/components/threshold_watch_edit/threshold_watch_edit.js index 622e3aebc07fa0..086afaae1847cc 100644 --- a/x-pack/plugins/watcher/public/sections/watch_edit/components/threshold_watch_edit/threshold_watch_edit.js +++ b/x-pack/plugins/watcher/public/sections/watch_edit/components/threshold_watch_edit/threshold_watch_edit.js @@ -29,7 +29,7 @@ import { REFRESH_INTERVALS } from 'plugins/watcher/../common/constants'; const app = uiModules.get('xpack/watcher'); -app.directive('thresholdWatchEdit', function ($injector) { +app.directive('thresholdWatchEdit', function ($injector, i18n) { const watchService = $injector.get('xpackWatcherWatchService'); const fieldsService = $injector.get('xpackWatcherFieldsService'); const timezoneService = $injector.get('xpackWatcherTimezoneService'); @@ -261,11 +261,25 @@ app.directive('thresholdWatchEdit', function ($injector) { const confirmModalOptions = { onConfirm: this.saveWatch, - confirmButtonText: 'Overwrite Watch' + confirmButtonText: i18n('xpack.watcher.sections.watchEdit.threshold.saveConfirmModal.overwriteWatchButtonLabel', { + defaultMessage: 'Overwrite Watch', + }), }; - const watchNameMessageFragment = existingWatch.name ? ` (name: "${existingWatch.name}")` : ''; - const message = `Watch with ID "${this.watch.id}"${watchNameMessageFragment} already exists. Do you want to overwrite it?`; + const message = i18n('xpack.watcher.sections.watchEdit.threshold.saveConfirmModal.description', { + defaultMessage: 'Watch with ID "{watchId}" {watchNameMessageFragment} already exists. Do you want to overwrite it?', + values: { + watchId: this.watch.id, + watchNameMessageFragment: existingWatch.name + ? i18n('xpack.watcher.sections.watchEdit.threshold.saveConfirmModal.descriptionFragmentText', { + defaultMessage: '(name: "{existingWatchName}")', + values: { + existingWatchName: existingWatch.name + } + }) + : '' + } + }); return confirmModal(message, confirmModalOptions); }) .catch(err => toastNotifications.addDanger(err)); @@ -291,7 +305,14 @@ app.directive('thresholdWatchEdit', function ($injector) { return watchService.saveWatch(this.watch) .then(() => { this.watch.isNew = false; // without this, the message displays 'New Watch' - toastNotifications.addSuccess(`Saved '${this.watch.displayName}'`); + toastNotifications.addSuccess( + i18n('xpack.watcher.sections.watchEdit.threshold.saveSuccessNotificationText', { + defaultMessage: 'Saved \'{watchDisplayName}\'', + values: { + watchDisplayName: this.watch.displayName + } + }), + ); this.onClose(); }) .catch(err => { diff --git a/x-pack/plugins/watcher/public/sections/watch_edit/components/watch_action_mode_table/watch_action_mode_table.html b/x-pack/plugins/watcher/public/sections/watch_edit/components/watch_action_mode_table/watch_action_mode_table.html index c8d4fff5aeed50..efa392a7f18b95 100644 --- a/x-pack/plugins/watcher/public/sections/watch_edit/components/watch_action_mode_table/watch_action_mode_table.html +++ b/x-pack/plugins/watcher/public/sections/watch_edit/components/watch_action_mode_table/watch_action_mode_table.html @@ -1,9 +1,24 @@ - - - + + + diff --git a/x-pack/plugins/watcher/public/sections/watch_edit/components/watch_edit_actions_execute_summary/watch_edit_actions_execute_summary.html b/x-pack/plugins/watcher/public/sections/watch_edit/components/watch_edit_actions_execute_summary/watch_edit_actions_execute_summary.html index 06ca7045570070..e1b4f473c5c14e 100644 --- a/x-pack/plugins/watcher/public/sections/watch_edit/components/watch_edit_actions_execute_summary/watch_edit_actions_execute_summary.html +++ b/x-pack/plugins/watcher/public/sections/watch_edit/components/watch_edit_actions_execute_summary/watch_edit_actions_execute_summary.html @@ -1,11 +1,36 @@
ActionTypeMode
- - - - - + + + + + diff --git a/x-pack/plugins/watcher/public/sections/watch_edit/components/watch_edit_detail/watch_edit_detail.html b/x-pack/plugins/watcher/public/sections/watch_edit/components/watch_edit_detail/watch_edit_detail.html index d0bd735c5a0a0e..6f9263234513ec 100644 --- a/x-pack/plugins/watcher/public/sections/watch_edit/components/watch_edit_detail/watch_edit_detail.html +++ b/x-pack/plugins/watcher/public/sections/watch_edit/components/watch_edit_detail/watch_edit_detail.html @@ -3,9 +3,9 @@ + i18n-id="xpack.watcher.sections.watchEdit.detail.idLabel" + i18n-default-message="ID" + > - ID must begin with a letter or underscore and contain only letters, underscores, dashes, and numbers. - + i18n-id="xpack.watcher.sections.watchEdit.detail.idNamingDescription" + i18n-default-message="ID must begin with a letter or underscore and contain only letters, underscores, dashes, and numbers." + >
- ID is required. -
+ i18n-id="xpack.watcher.sections.watchEdit.detail.idIsRequiredValidationMessage" + i18n-default-message="ID is required." + >
+ i18n-id="xpack.watcher.sections.watchEdit.detail.nameLabel" + i18n-default-message="Name" + >
- + - Invalid JSON -
+ i18n-id="xpack.watcher.sections.watchEdit.detail.invalidJSONErrorMessage" + i18n-default-message="Invalid JSON" + >
diff --git a/x-pack/plugins/watcher/public/sections/watch_edit/components/watch_edit_detail/watch_edit_detail.js b/x-pack/plugins/watcher/public/sections/watch_edit/components/watch_edit_detail/watch_edit_detail.js index 50875982ef485f..81c1bfe24e98ea 100644 --- a/x-pack/plugins/watcher/public/sections/watch_edit/components/watch_edit_detail/watch_edit_detail.js +++ b/x-pack/plugins/watcher/public/sections/watch_edit/components/watch_edit_detail/watch_edit_detail.js @@ -11,7 +11,7 @@ import { documentationLinks } from 'plugins/watcher/lib/documentation_links'; const app = uiModules.get('xpack/watcher'); -app.directive('watchEditDetail', function () { +app.directive('watchEditDetail', function (i18n) { return { restrict: 'E', template: template, @@ -36,7 +36,7 @@ app.directive('watchEditDetail', function () { $scope.$watch('watchEditDetail.form.$valid', () => { this.updateIsValid(); }); - + this.syntaxLinkLabel = i18n('xpack.watcher.sections.watchEdit.detail.syntaxLinkLabel', { defaultMessage: 'Syntax' }); this.documentationLinks = documentationLinks; } diff --git a/x-pack/plugins/watcher/public/sections/watch_edit/components/watch_edit_execute_detail/watch_edit_execute_detail.html b/x-pack/plugins/watcher/public/sections/watch_edit/components/watch_edit_execute_detail/watch_edit_execute_detail.html index 7277370f7e6db6..684d5ac5de59b6 100644 --- a/x-pack/plugins/watcher/public/sections/watch_edit/components/watch_edit_execute_detail/watch_edit_execute_detail.html +++ b/x-pack/plugins/watcher/public/sections/watch_edit/components/watch_edit_execute_detail/watch_edit_execute_detail.html @@ -1,40 +1,39 @@
+ i18n-id="xpack.watcher.sections.watchEdit.executeDetail.triggerOverrides.triggeredTimeLabel" + i18n-default-message="Triggered Time" + >
+ i18n-id="xpack.watcher.sections.watchEdit.executeDetail.triggerOverrides.scheduledTimeLabel" + i18n-default-message="Scheduled Time" + >
@@ -42,7 +41,7 @@ @@ -50,16 +49,16 @@ - Invalid JSON - + i18n-id="xpack.watcher.sections.watchEdit.executeDetail.inputOverrides.invalidJSONErrorMessage" + i18n-default-message="Invalid JSON" + > @@ -95,9 +94,9 @@ type="checkbox" ng-model="watchEditExecuteDetail.executeDetails.ignoreCondition" class="kuiCheckBox" - > - Ignore Condition (Condition is always true) - + i18n-id="xpack.watcher.sections.watchEdit.executeDetail.conditionOverrides.ignoreConditionLabel" + i18n-default-message="Ignore Condition (Condition is always true)" + > @@ -105,14 +104,15 @@
- +
- - Test your watch execution - +
-
- To modify how the watch is executed, expand the sections below -
+
diff --git a/x-pack/plugins/watcher/public/sections/watch_edit/components/watch_edit_title_bar/watch_edit_title_bar.html b/x-pack/plugins/watcher/public/sections/watch_edit/components/watch_edit_title_bar/watch_edit_title_bar.html index 557fca309567b5..8efd0cb3672c4c 100644 --- a/x-pack/plugins/watcher/public/sections/watch_edit/components/watch_edit_title_bar/watch_edit_title_bar.html +++ b/x-pack/plugins/watcher/public/sections/watch_edit/components/watch_edit_title_bar/watch_edit_title_bar.html @@ -1,6 +1,10 @@
-

New watch

+

@@ -9,25 +13,25 @@

New watch

ng-disabled="!watchEditTitleBar.isWatchValid" ng-click="watchEditTitleBar.onWatchSave()" data-test-subj="btnSaveWatch" - > - Save - + i18n-id="xpack.watcher.sections.watchEdit.titleBar.saveButtonLabel" + i18n-default-message="Save" + > + i18n-id="xpack.watcher.sections.watchEdit.titleBar.cancelButtonLabel" + i18n-default-message="Cancel" + > + i18n-id="xpack.watcher.sections.watchEdit.titleBar.deleteButtonLabel" + i18n-default-message="Delete" + >
diff --git a/x-pack/plugins/watcher/public/sections/watch_edit/components/watch_edit_title_panel/watch_edit_title_panel.html b/x-pack/plugins/watcher/public/sections/watch_edit/components/watch_edit_title_panel/watch_edit_title_panel.html index 9e31e77e7f5d0d..b4762c1770c733 100644 --- a/x-pack/plugins/watcher/public/sections/watch_edit/components/watch_edit_title_panel/watch_edit_title_panel.html +++ b/x-pack/plugins/watcher/public/sections/watch_edit/components/watch_edit_title_panel/watch_edit_title_panel.html @@ -12,8 +12,11 @@

input-focus required ng-model="watchEditTitlePanel.watch.name" - placeholder="My Threshold Watch" + placeholder="{{'xpack.watcher.sections.watchEdit.titlePanel.watchNamePlaceholder' | i18n: { defaultMessage: 'My Threshold Watch' } }}" >
@@ -33,9 +36,9 @@

xpack-aria-describes="{{watchEditTitlePanel.makeId('watchName')}}" class="kuiInputNote kuiInputNote--danger" ng-if="watchEditTitlePanel.isValidationMessageVisible('watchName', 'required')" - > - Name is required -

+ i18n-id="xpack.watcher.sections.watchEdit.titlePanel.watchNameIsRequiredValidationMessage" + i18n-default-message="Name is required" + >
  @@ -44,8 +47,10 @@

xpack-aria-describes="{{watchEditTitlePanel.makeId('indexSelectSearchBox')}}" class="kuiInputNote kuiInputNote--danger" ng-if="watchEditTitlePanel.showRequiredIndexSelectionValidationMessage()" - > - Enter one or more indices -
+ i18n-id="xpack.watcher.sections.watchEdit.titlePanel.enterOneOrMoreIndicesValidationMessage" + i18n-default-message="Enter one or more indices" + >
- Your index query does not match any valid indices -
+ i18n-id="xpack.watcher.sections.watchEdit.titlePanel.queryDoesNotMatchAnyValidIndicesValidationMessage" + i18n-default-message="Your index query does not match any valid indices" + >
- Your index query does not have an associated time field -
- Use * to broaden your search query + i18n-id="xpack.watcher.sections.watchEdit.titlePanel.associatedTimeFieldIsMissedInIndexQueryValidationMessage" + i18n-default-message="Your index query does not have an associated time field" + > +
+ class="kuiLabel kuiVerticalRhythmSmall" + i18n-id="xpack.watcher.sections.watchEdit.titlePanel.timeFieldLabel" + i18n-default-message="Time field" + >
@@ -113,9 +126,9 @@

xpack-aria-describes="{{watchEditTitlePanel.makeId('timeField')}}" class="kuiInputNote kuiInputNote--danger" ng-if="watchEditTitlePanel.isValidationMessageVisible('timeField', 'required')" - > - A time field is required -

+ i18n-id="xpack.watcher.sections.watchEdit.titlePanel.timeFieldIsRequiredValidationText" + i18n-default-message="A time field is required" + >
  @@ -125,9 +138,9 @@

id="durationSelectTriggerIntervalSizeLabel" for="durationSelectTriggerIntervalSize" class="kuiLabel kuiVerticalRhythmSmall" - > - Run watch every - + i18n-id="xpack.watcher.sections.watchEdit.titlePanel.watchIntervalLabel" + i18n-default-message="Run watch every" + >
xpack-aria-describes="durationSelectTriggerIntervalSize" class="kuiInputNote kuiInputNote--danger" ng-if="watchEditTitlePanel.isValidationMessageVisible('durationSelectTriggerIntervalSize', 'required')" - > - Interval size is required -
+ i18n-id="xpack.watcher.sections.watchEdit.titlePanel.intervalSizeIsRequiredValidationMessage" + i18n-default-message="Interval size is required" + >
- Interval size cannot be a negative number -
+ i18n-id="xpack.watcher.sections.watchEdit.titlePanel.intervalSizeNegativeNumberValidationMessage" + i18n-default-message="Interval size cannot be a negative number" + >
- Interval size must be a valid number -
+ i18n-id="xpack.watcher.sections.watchEdit.titlePanel.intervalSizeValidNumberValidationMessage" + i18n-default-message="Interval size must be a valid number" + >
- An interval size is required -
+ i18n-id="xpack.watcher.sections.watchEdit.titlePanel.intervalSizeUnitIsRequiredValidationMessage" + i18n-default-message="An interval size is required" + >
- The minimum duration is {{watchEditTitlePanel.triggerIntervalMinimumSize}}{{watchEditTitlePanel.triggerIntervalMinimumUnit}} -
+ i18n-id="xpack.watcher.sections.watchEdit.titlePanel.intervalSizeMinimumDurationValidationMessage" + i18n-default-message=" The minimum duration is {minSize}{minUnit}" + i18n-values="{ minSize: watchEditTitlePanel.triggerIntervalMinimumSize, minUnit: watchEditTitlePanel.triggerIntervalMinimumUnit }" + > diff --git a/x-pack/plugins/watcher/public/sections/watch_edit/components/watch_edit_title_panel/watch_edit_title_panel.js b/x-pack/plugins/watcher/public/sections/watch_edit/components/watch_edit_title_panel/watch_edit_title_panel.js index e1ca7cadc006c1..3e85d8aa612c51 100644 --- a/x-pack/plugins/watcher/public/sections/watch_edit/components/watch_edit_title_panel/watch_edit_title_panel.js +++ b/x-pack/plugins/watcher/public/sections/watch_edit/components/watch_edit_title_panel/watch_edit_title_panel.js @@ -19,7 +19,7 @@ const app = uiModules.get('xpack/watcher'); const VALID_NORMALIZED_TYPES = ['date']; -app.directive('watchEditTitlePanel', function ($injector) { +app.directive('watchEditTitlePanel', function ($injector, i18n) { const htmlIdGeneratorFactory = $injector.get('xpackWatcherHtmlIdGeneratorFactory'); return { @@ -90,7 +90,10 @@ app.directive('watchEditTitlePanel', function ($injector) { get title() { if (this.watch.isNew) { const typeName = this.watch.typeName.toLowerCase(); - return `Create a new ${typeName}`; + return i18n('xpack.watcher.sections.watchEdit.titlePanel.createNewTypeOfWatchTitle', { + defaultMessage: 'Create a new {typeName}', + values: { typeName }, + }); } else { return this.watch.name; } diff --git a/x-pack/plugins/watcher/public/sections/watch_edit/components/watch_edit_watch_execute_summary/watch_edit_watch_execute_summary.html b/x-pack/plugins/watcher/public/sections/watch_edit/components/watch_edit_watch_execute_summary/watch_edit_watch_execute_summary.html index 3a04f389f2b38e..c4a59628729a36 100644 --- a/x-pack/plugins/watcher/public/sections/watch_edit/components/watch_edit_watch_execute_summary/watch_edit_watch_execute_summary.html +++ b/x-pack/plugins/watcher/public/sections/watch_edit/components/watch_edit_watch_execute_summary/watch_edit_watch_execute_summary.html @@ -1,5 +1,8 @@
- + {{ watchEditWatchExecuteSummary.watchHistoryItem.watchStatus.state }}
diff --git a/x-pack/plugins/watcher/public/sections/watch_history_item/components/watch_history_item/watch_history_item.html b/x-pack/plugins/watcher/public/sections/watch_history_item/components/watch_history_item/watch_history_item.html index bc838eba0a02af..8a16b5fdddeeb2 100644 --- a/x-pack/plugins/watcher/public/sections/watch_history_item/components/watch_history_item/watch_history_item.html +++ b/x-pack/plugins/watcher/public/sections/watch_history_item/components/watch_history_item/watch_history_item.html @@ -16,7 +16,10 @@ >
- +
diff --git a/x-pack/plugins/watcher/public/sections/watch_history_item/components/watch_history_item_actions_summary/watch_history_item_actions_summary.html b/x-pack/plugins/watcher/public/sections/watch_history_item/components/watch_history_item_actions_summary/watch_history_item_actions_summary.html index 96512ca2438236..fce54f9faa4adb 100644 --- a/x-pack/plugins/watcher/public/sections/watch_history_item/components/watch_history_item_actions_summary/watch_history_item_actions_summary.html +++ b/x-pack/plugins/watcher/public/sections/watch_history_item/components/watch_history_item_actions_summary/watch_history_item_actions_summary.html @@ -1,10 +1,30 @@

ActionTypeModeStateReason
- - - - + + + + diff --git a/x-pack/plugins/watcher/public/sections/watch_history_item/components/watch_history_item_watch_summary/watch_history_item_watch_summary.html b/x-pack/plugins/watcher/public/sections/watch_history_item/components/watch_history_item_watch_summary/watch_history_item_watch_summary.html index 514407b31c75e8..0b63aeb42562ed 100644 --- a/x-pack/plugins/watcher/public/sections/watch_history_item/components/watch_history_item_watch_summary/watch_history_item_watch_summary.html +++ b/x-pack/plugins/watcher/public/sections/watch_history_item/components/watch_history_item_watch_summary/watch_history_item_watch_summary.html @@ -1,5 +1,8 @@
- + diff --git a/x-pack/plugins/watcher/public/sections/watch_list/components/watch_list/watch_list.html b/x-pack/plugins/watcher/public/sections/watch_list/components/watch_list/watch_list.html index 47bb434dcb9a55..cd36b118449177 100644 --- a/x-pack/plugins/watcher/public/sections/watch_list/components/watch_list/watch_list.html +++ b/x-pack/plugins/watcher/public/sections/watch_list/components/watch_list/watch_list.html @@ -1,7 +1,7 @@
- You do not have permission to manage watches. + {{ 'xpack.watcher.sections.watchList.noPermissionToManageWatchesText' | i18n: { defaultMessage: 'You do not have permission to manage watches.' } }}
- Create threshold alert - + tooltip="{{ 'xpack.watcher.sections.watchList.createThresholdAlertButtonTooltip' | i18n: { defaultMessage: 'Send an alert on a specific condition' } }}" + i18n-id="xpack.watcher.sections.watchList.createThresholdAlertButtonLabel" + i18n-default-message="Create threshold alert" + > + tooltip="{{ 'xpack.watcher.sections.watchList.createAdvancedWatchTooltip' | i18n: { defaultMessage: 'Set up a custom watch in raw JSON' } }}" + i18n-id="xpack.watcher.sections.watchList.createAdvancedWatchButtonLabel" + i18n-default-message="Create advanced watch" + >
@@ -43,9 +43,9 @@ ng-disabled="!watchList.hasSelectedWatches" ng-click="watchList.onSelectedWatchesDelete()" data-test-subj="btnDeleteWatches" - > - Delete - + i18n-id="xpack.watcher.sections.watchList.deleteWatchButtonLabel" + i18n-default-message="Delete" + >
@@ -75,15 +75,15 @@ - No watches found. + {{ 'xpack.watcher.sections.watchList.watchesNotFoundText' | i18n: { defaultMessage: 'No watches found.' } }}
diff --git a/x-pack/plugins/watcher/public/sections/watch_list/components/watch_list/watch_list.js b/x-pack/plugins/watcher/public/sections/watch_list/components/watch_list/watch_list.js index 35740e908f5ce5..548581ea6be7a5 100644 --- a/x-pack/plugins/watcher/public/sections/watch_list/components/watch_list/watch_list.js +++ b/x-pack/plugins/watcher/public/sections/watch_list/components/watch_list/watch_list.js @@ -4,7 +4,6 @@ * you may not use this file except in compliance with the Elastic License. */ -import pluralize from 'pluralize'; import { uiModules } from 'ui/modules'; import { InitAfterBindingsWorkaround } from 'ui/compat'; import { toastNotifications } from 'ui/notify'; @@ -22,7 +21,7 @@ import 'plugins/watcher/services/license'; const app = uiModules.get('xpack/watcher'); -app.directive('watchList', function ($injector) { +app.directive('watchList', function ($injector, i18n) { const pagerFactory = $injector.get('pagerFactory'); const watchesService = $injector.get('xpackWatcherWatchesService'); const licenseService = $injector.get('xpackWatcherLicenseService'); @@ -137,10 +136,15 @@ app.directive('watchList', function ($injector) { onSelectedWatchesDelete = () => { const watchesBeingDeleted = this.selectedWatches; const numWatchesToDelete = watchesBeingDeleted.length; - const watchesStr = pluralize('Watch', numWatchesToDelete); - const confirmModalText = `This will permanently delete ${numWatchesToDelete} ${watchesStr}. Are you sure?`; - const confirmButtonText = `Delete ${numWatchesToDelete} ${watchesStr}`; + const confirmModalText = i18n('xpack.watcher.sections.watchList.deleteSelectedWatchesConfirmModal.descriptionText', { + defaultMessage: 'This will permanently delete {numWatchesToDelete, plural, one {# Watch} other {# Watches}}. Are you sure?', + values: { numWatchesToDelete } + }); + const confirmButtonText = i18n('xpack.watcher.sections.watchList.deleteSelectedWatchesConfirmModal.deleteButtonLabel', { + defaultMessage: 'Delete {numWatchesToDelete, plural, one {# Watch} other {# Watches}} ', + values: { numWatchesToDelete } + }); const confirmModalOptions = { confirmButtonText, @@ -154,7 +158,6 @@ app.directive('watchList', function ($injector) { this.watchesBeingDeleted = watchesBeingDeleted; const numWatchesToDelete = this.watchesBeingDeleted.length; - const watchesStr = pluralize('Watch', numWatchesToDelete); const watchIds = this.watchesBeingDeleted.map(watch => watch.id); return watchesService.deleteWatches(watchIds) @@ -164,11 +167,23 @@ app.directive('watchList', function ($injector) { const numTotal = numWatchesToDelete; if (numSuccesses > 0) { - toastNotifications.addSuccess(`Deleted ${numSuccesses} out of ${numTotal} selected ${watchesStr}`); + toastNotifications.addSuccess( + i18n('xpack.watcher.sections.watchList.deleteSelectedWatchesSuccessNotification.descriptionText', { + defaultMessage: + 'Deleted {numSuccesses} out of {numTotal} selected {numWatchesToDelete, plural, one {# watch} other {# watches}}', + values: { numSuccesses, numTotal, numWatchesToDelete } + }) + ); } if (numErrors > 0) { - toastNotifications.addError(`Couldn't delete ${numErrors} out of ${numTotal} selected ${watchesStr}`); + toastNotifications.addError( + i18n('xpack.watcher.sections.watchList.deleteSelectedWatchesErrorNotification.descriptionText', { + defaultMessage: + 'Couldn\'t delete {numErrors} out of {numTotal} selected {numWatchesToDelete, plural, one {# watch} other {# watches}}', + values: { numErrors, numTotal, numWatchesToDelete } + }) + ); } this.loadWatches(); diff --git a/x-pack/plugins/watcher/public/sections/watch_list/components/watch_table/watch_table.html b/x-pack/plugins/watcher/public/sections/watch_list/components/watch_table/watch_table.html index e6509619b326b6..b4c0adb60435d9 100644 --- a/x-pack/plugins/watcher/public/sections/watch_list/components/watch_table/watch_table.html +++ b/x-pack/plugins/watcher/public/sections/watch_list/components/watch_table/watch_table.html @@ -16,7 +16,7 @@ sort-field="watchTable.sortField" sort-reverse="watchTable.sortReverse" > - ID + {{ 'xpack.watcher.sections.watchList.watchTable.idColumnLabel' | i18n: { defaultMessage: 'ID' } }}
@@ -155,13 +155,16 @@ diff --git a/x-pack/plugins/watcher/public/sections/watch_list/register_management_section.js b/x-pack/plugins/watcher/public/sections/watch_list/register_management_section.js index 11947851f719d2..5b8265f981ddce 100644 --- a/x-pack/plugins/watcher/public/sections/watch_list/register_management_section.js +++ b/x-pack/plugins/watcher/public/sections/watch_list/register_management_section.js @@ -5,16 +5,21 @@ */ import { management } from 'ui/management'; +import { i18n } from '@kbn/i18n'; import 'plugins/watcher/services/license'; management.getSection('elasticsearch').register('watcher', { - display: 'Watcher', + display: i18n.translate('xpack.watcher.sections.watchList.managementSection.watcherDisplayName', { + defaultMessage: 'Watcher' } + ), order: 4, url: '#/management/elasticsearch/watcher/' }); management.getSection('elasticsearch/watcher').register('watches', { - display: 'Watches', + display: i18n.translate('xpack.watcher.sections.watchList.managementSection.watchesDisplayName', { + defaultMessage: 'Watches' } + ), order: 1 }); @@ -23,19 +28,25 @@ management.getSection('elasticsearch/watcher').register('watch', { }); management.getSection('elasticsearch/watcher/watch').register('status', { - display: 'Status', + display: i18n.translate('xpack.watcher.sections.watchList.managementSection.statusDisplayName', { + defaultMessage: 'Status' } + ), order: 1, visible: false }); management.getSection('elasticsearch/watcher/watch').register('edit', { - display: 'Edit', + display: i18n.translate('xpack.watcher.sections.watchList.managementSection.editDisplayName', { + defaultMessage: 'Edit' } + ), order: 2, visible: false }); management.getSection('elasticsearch/watcher/watch').register('new', { - display: 'New Watch', + display: i18n.translate('xpack.watcher.sections.watchList.managementSection.newWatchDisplayName', { + defaultMessage: 'New Watch' } + ), order: 1, visible: false });
ActionTypeStateReason
@@ -26,7 +26,7 @@ sort-field="watchTable.sortField" sort-reverse="watchTable.sortReverse" > - Name + {{ 'xpack.watcher.sections.watchList.watchTable.nameColumnLabel' | i18n: { defaultMessage: 'Name' } }} @@ -36,7 +36,7 @@ sort-field="watchTable.sortField" sort-reverse="watchTable.sortReverse" > - State + {{ 'xpack.watcher.sections.watchList.watchTable.stateColumnLabel' | i18n: { defaultMessage: 'State' } }} @@ -46,7 +46,7 @@ sort-field="watchTable.sortField" sort-reverse="watchTable.sortReverse" > - Comment + {{ 'xpack.watcher.sections.watchList.watchTable.commentColumnLabel' | i18n: { defaultMessage: 'Comment' } }} @@ -56,7 +56,7 @@ sort-field="watchTable.sortField" sort-reverse="watchTable.sortReverse" > - Last Fired + {{ 'xpack.watcher.sections.watchList.watchTable.lastFiredColumnLabel' | i18n: { defaultMessage: 'Last Fired' } }} @@ -66,7 +66,7 @@ sort-field="watchTable.sortField" sort-reverse="watchTable.sortReverse" > - Last Triggered + {{ 'xpack.watcher.sections.watchList.watchTable.lastTriggeredColumnLabel' | i18n: { defaultMessage: 'Last Triggered' } }}