From 55881e65958d7ccc8c6401431ca779f62f819c06 Mon Sep 17 00:00:00 2001 From: Maryia Lapata Date: Sat, 20 Oct 2018 15:19:06 +0300 Subject: [PATCH] Feature/translate watcher(part_2) (#24017) (#24276) * translate watcher(pad_2) * fix issues * fix issues --- .../threshold_watch_agg_field.html | 12 ++++--- .../threshold_watch_agg_field.js | 11 ++++-- .../threshold_watch_agg_type.html | 6 ++-- .../threshold_watch_agg_type.js | 6 ++-- .../threshold_watch_group_by.html | 30 +++++++++------- .../threshold_watch_group_by.js | 12 +++++-- .../threshold_watch_threshold_level.html | 12 +++---- .../threshold_watch_time_window.html | 32 ++++++++--------- .../threshold_watch_time_window.js | 6 ++-- .../lib/comparators.js | 10 ++++-- .../lib/group_by_types.js | 10 ++++-- .../lib/time_units.js | 34 +++++++++++++----- .../threshold_watch_expression.html | 6 ++-- .../tool_bar_selected_count.html | 3 +- .../components/watch_action/watch_action.html | 14 ++++---- .../watch_email_action.html | 36 +++++++++---------- .../watch_logging_action.html | 12 +++---- .../watch_slack_action.html | 24 ++++++------- .../watch_actions/watch_actions.html | 9 +++-- .../watcher/public/constants/time_units.js | 33 ++++++++++++----- .../public/models/action/base_action.js | 20 ++++++++--- .../public/models/action/email_action.js | 35 ++++++++++++++---- .../public/models/action/logging_action.js | 29 +++++++++++---- .../public/models/action/slack_action.js | 34 ++++++++++++++---- .../watcher/public/models/watch/base_watch.js | 20 ++++++++--- .../watcher/public/models/watch/json_watch.js | 9 +++-- .../public/models/watch/threshold_watch.js | 22 +++++++++--- 27 files changed, 334 insertions(+), 153 deletions(-) diff --git a/x-pack/plugins/watcher/public/components/threshold_watch_expression/components/threshold_watch_agg_field/threshold_watch_agg_field.html b/x-pack/plugins/watcher/public/components/threshold_watch_expression/components/threshold_watch_agg_field/threshold_watch_agg_field.html index f220d73ac3e32f..a103fbecfc5881 100644 --- a/x-pack/plugins/watcher/public/components/threshold_watch_expression/components/threshold_watch_agg_field/threshold_watch_agg_field.html +++ b/x-pack/plugins/watcher/public/components/threshold_watch_expression/components/threshold_watch_agg_field/threshold_watch_agg_field.html @@ -16,9 +16,9 @@ xpack-aria-describes="{{thresholdWatchAggField.makeId('aggField')}}" class="kuiInputNote kuiInputNote--danger" ng-if="thresholdWatchAggField.isValidationMessageVisible('aggField', 'required')" - > - Please select a field. - + i18n-id="xpack.watcher.thresholdWatchExpression.aggType.fieldIsRequiredValidationMessage" + i18n-default-message="Please select a field." + > diff --git a/x-pack/plugins/watcher/public/components/threshold_watch_expression/components/threshold_watch_agg_field/threshold_watch_agg_field.js b/x-pack/plugins/watcher/public/components/threshold_watch_expression/components/threshold_watch_agg_field/threshold_watch_agg_field.js index 6448027aa99987..756ca66f47fcd8 100644 --- a/x-pack/plugins/watcher/public/components/threshold_watch_expression/components/threshold_watch_agg_field/threshold_watch_agg_field.js +++ b/x-pack/plugins/watcher/public/components/threshold_watch_expression/components/threshold_watch_agg_field/threshold_watch_agg_field.js @@ -12,7 +12,7 @@ import 'plugins/watcher/components/xpack_aria_describes'; const app = uiModules.get('xpack/watcher'); -app.directive('thresholdWatchAggField', function ($injector) { +app.directive('thresholdWatchAggField', function ($injector, i18n) { const htmlIdGeneratorFactory = $injector.get('xpackWatcherHtmlIdGeneratorFactory'); return { @@ -51,11 +51,16 @@ app.directive('thresholdWatchAggField', function ($injector) { } }); - this.itemDescription = 'Of'; + this.itemDescription = i18n('xpack.watcher.thresholdWatchExpression.aggField.itemDescription', { + defaultMessage: 'Of', + }); } get itemValue() { - return this.aggField ? this.aggField.name : 'select a field'; + return this.aggField ? this.aggField.name : i18n( + 'xpack.watcher.thresholdWatchExpression.aggField.selectFieldTextMessage', { + defaultMessage: 'select a field', + }); } } }; diff --git a/x-pack/plugins/watcher/public/components/threshold_watch_expression/components/threshold_watch_agg_type/threshold_watch_agg_type.html b/x-pack/plugins/watcher/public/components/threshold_watch_expression/components/threshold_watch_agg_type/threshold_watch_agg_type.html index c41c4314f27041..981fcf12aa131c 100644 --- a/x-pack/plugins/watcher/public/components/threshold_watch_expression/components/threshold_watch_agg_type/threshold_watch_agg_type.html +++ b/x-pack/plugins/watcher/public/components/threshold_watch_expression/components/threshold_watch_agg_type/threshold_watch_agg_type.html @@ -16,9 +16,9 @@ xpack-aria-describes="{{thresholdWatchAggType.makeId('aggType')}}" class="kuiInputNote kuiInputNote--danger" ng-if="thresholdWatchAggType.isValidationMessageVisible('aggType', 'required')" - > - Please select an aggregation type. - + i18n-id="xpack.watcher.thresholdWatchExpression.aggType.requiredTypeValidationMessage" + i18n-default-message="Please select an aggregation type." + > - + diff --git a/x-pack/plugins/watcher/public/components/threshold_watch_expression/components/threshold_watch_group_by/threshold_watch_group_by.js b/x-pack/plugins/watcher/public/components/threshold_watch_expression/components/threshold_watch_group_by/threshold_watch_group_by.js index 29048c1fe92849..e89a23070dd269 100644 --- a/x-pack/plugins/watcher/public/components/threshold_watch_expression/components/threshold_watch_group_by/threshold_watch_group_by.js +++ b/x-pack/plugins/watcher/public/components/threshold_watch_expression/components/threshold_watch_group_by/threshold_watch_group_by.js @@ -12,7 +12,7 @@ import 'plugins/watcher/components/xpack_aria_describes'; const app = uiModules.get('xpack/watcher'); -app.directive('thresholdWatchGroupBy', function ($injector) { +app.directive('thresholdWatchGroupBy', function ($injector, i18n) { const htmlIdGeneratorFactory = $injector.get('xpackWatcherHtmlIdGeneratorFactory'); return { @@ -57,7 +57,15 @@ app.directive('thresholdWatchGroupBy', function ($injector) { } get itemDescription() { - return (this.groupByType && this.groupByType.sizeRequired) ? 'Grouped over' : 'Over'; + const itemDescription = (this.groupByType && this.groupByType.sizeRequired) + ? i18n('xpack.watcher.thresholdWatchExpression.groupBy.groupedItemDescription', { + defaultMessage: 'Grouped over', + }) + : i18n('xpack.watcher.thresholdWatchExpression.groupBy.itemDescription', { + defaultMessage: 'Over', + }); + + return itemDescription; } get itemValue() { diff --git a/x-pack/plugins/watcher/public/components/threshold_watch_expression/components/threshold_watch_threshold_level/threshold_watch_threshold_level.html b/x-pack/plugins/watcher/public/components/threshold_watch_expression/components/threshold_watch_threshold_level/threshold_watch_threshold_level.html index 51aa630e6736d2..76be0699679e0e 100644 --- a/x-pack/plugins/watcher/public/components/threshold_watch_expression/components/threshold_watch_threshold_level/threshold_watch_threshold_level.html +++ b/x-pack/plugins/watcher/public/components/threshold_watch_expression/components/threshold_watch_threshold_level/threshold_watch_threshold_level.html @@ -16,17 +16,17 @@ xpack-aria-describes="{{thresholdWatchThresholdLevel.makeId('threshold')}}" class="kuiInputNote kuiInputNote--danger" ng-if="thresholdWatchThresholdLevel.isValidationMessageVisible('threshold', 'required')" - > - A value is required. - + i18n-id="xpack.watcher.thresholdWatchExpression.thresholdLevel.valueIsRequiredValidationMessage" + i18n-default-message="A value is required." + >
- Value must be a valid number. -
+ i18n-id="xpack.watcher.thresholdWatchExpression.thresholdLevel.valueMustBeValidNumberValidationMessage" + i18n-default-message="Value must be a valid number." + > - To e-mail address is required. - + i18n-id="xpack.watcher.watchActions.email.emailAddressIsRequiredValidationMessage" + i18n-default-message="To e-mail address is required." + >
+ i18n-id="xpack.watcher.watchActions.email.subjectLabel" + i18n-default-message="Subject" + > - Subject is required. -
+ i18n-id="xpack.watcher.watchActions.email.subjectIsRequiredValidationMessage" + i18n-default-message="Subject is required." + >
+ i18n-id="xpack.watcher.watchActions.email.bodyLabel" + i18n-default-message="Body" + >