From 4410598f818b3aebbcd83139b5e8543e90a1c36f Mon Sep 17 00:00:00 2001 From: Maryia Lapata Date: Wed, 17 Oct 2018 17:53:00 +0300 Subject: [PATCH] [6.x] Translations for Tag Cloud (#24065) (#24125) * Translations for Tag Cloud (#24065) * Translate pie and vaslib_basic_options (#23761) (#24124) Translate pie and vislib_basic_options * [I18n] Add one-time binding to angularjs i18n (#23499) (#23965) * Add one-time binding to angularjs i18n * Add watcher for values property * Watch values field only if it is provided * Fix ci * Translations for Tag Cloud (#24065) --- .i18nrc.json | 1 + .../tagcloud/public/feedback_message.js | 11 +++++++++-- .../tagcloud/public/tag_cloud_vis.js | 12 +++++++----- .../tagcloud/public/tag_cloud_vis_params.html | 16 ++++++++-------- .../tagcloud/public/tag_cloud_visualization.js | 4 ++-- 5 files changed, 27 insertions(+), 17 deletions(-) diff --git a/.i18nrc.json b/.i18nrc.json index e0c06323b7ebf..cba5a18f6c959 100644 --- a/.i18nrc.json +++ b/.i18nrc.json @@ -7,6 +7,7 @@ "markdownVis": "src/core_plugins/markdown_vis", "metricVis": "src/core_plugins/metric_vis", "statusPage": "src/core_plugins/status_page", + "tagCloud": "src/core_plugins/tagcloud", "xpack.idxMgmt": "x-pack/plugins/index_management" }, "exclude": [ diff --git a/src/core_plugins/tagcloud/public/feedback_message.js b/src/core_plugins/tagcloud/public/feedback_message.js index f3c726c5a8f76..ee27af3ec2cb0 100644 --- a/src/core_plugins/tagcloud/public/feedback_message.js +++ b/src/core_plugins/tagcloud/public/feedback_message.js @@ -18,6 +18,7 @@ */ import React, { Component } from 'react'; +import { FormattedMessage } from '@kbn/i18n/react'; export class FeedbackMessage extends Component { @@ -30,10 +31,16 @@ export class FeedbackMessage extends Component { return (
- The number of tags has been truncated to avoid long draw times. +
- The container is too small to display the entire cloud. Tags might be cropped or omitted. +
); diff --git a/src/core_plugins/tagcloud/public/tag_cloud_vis.js b/src/core_plugins/tagcloud/public/tag_cloud_vis.js index d4245bc114efa..3eb9548911097 100644 --- a/src/core_plugins/tagcloud/public/tag_cloud_vis.js +++ b/src/core_plugins/tagcloud/public/tag_cloud_vis.js @@ -26,15 +26,17 @@ import { TagCloudVisualization } from './tag_cloud_visualization'; import { VisTypesRegistryProvider } from 'ui/registry/vis_types'; import { Status } from 'ui/vis/update_status'; -VisTypesRegistryProvider.register(function (Private) { +VisTypesRegistryProvider.register(function (Private, i18n) { const VisFactory = Private(VisFactoryProvider); return VisFactory.createBaseVisualization({ name: 'tagcloud', - title: 'Tag Cloud', + title: i18n('tagCloud.vis.tagCloudTitle', { defaultMessage: 'Tag Cloud' }), icon: 'visTagCloud', - description: 'A group of words, sized according to their importance', + description: i18n('tagCloud.vis.tagCloudDescription', { + defaultMessage: 'A group of words, sized according to their importance' + }), category: CATEGORY.OTHER, visConfig: { defaults: { @@ -57,7 +59,7 @@ VisTypesRegistryProvider.register(function (Private) { { group: 'metrics', name: 'metric', - title: 'Tag Size', + title: i18n('tagCloud.vis.schemas.metricTitle', { defaultMessage: 'Tag Size' }), min: 1, max: 1, aggFilter: ['!std_dev', '!percentiles', '!percentile_ranks', '!derivative', '!geo_bounds', '!geo_centroid'], @@ -69,7 +71,7 @@ VisTypesRegistryProvider.register(function (Private) { group: 'buckets', name: 'segment', icon: 'fa fa-cloud', - title: 'Tags', + title: i18n('tagCloud.vis.schemas.segmentTitle', { defaultMessage: 'Tags' }), min: 1, max: 1, aggFilter: ['terms', 'significant_terms'] diff --git a/src/core_plugins/tagcloud/public/tag_cloud_vis_params.html b/src/core_plugins/tagcloud/public/tag_cloud_vis_params.html index c089c96de7c4a..65c2a369a20fd 100644 --- a/src/core_plugins/tagcloud/public/tag_cloud_vis_params.html +++ b/src/core_plugins/tagcloud/public/tag_cloud_vis_params.html @@ -1,15 +1,15 @@
- +
- +
- +
@@ -19,10 +19,10 @@ max="{{editorState.params.maxFontSize}}" class="kuiTextInput tag-cloud-fontsize-slider__input" ng-model="editorState.params.minFontSize" - aria-label="Minimum tag font size" + aria-label="{{ ::'tagCloud.visParams.minFontSizeAriaLabel' | i18n: { defaultMessage: 'Minimum tag font size' } }}" aria-describedby="tagCloudFontSliderMinUnit" > - px + px
- px + px
@@ -42,7 +42,7 @@
diff --git a/src/core_plugins/tagcloud/public/tag_cloud_visualization.js b/src/core_plugins/tagcloud/public/tag_cloud_visualization.js index 251673ca30cae..1fc16b3b1c9f4 100644 --- a/src/core_plugins/tagcloud/public/tag_cloud_visualization.js +++ b/src/core_plugins/tagcloud/public/tag_cloud_visualization.js @@ -23,7 +23,7 @@ import { take } from 'rxjs/operators'; import { render, unmountComponentAtNode } from 'react-dom'; import React from 'react'; - +import { I18nProvider } from '@kbn/i18n/react'; import { Label } from './label'; import { FeedbackMessage } from './feedback_message'; @@ -57,7 +57,7 @@ export class TagCloudVisualization { this._feedbackNode = document.createElement('div'); this._containerNode.appendChild(this._feedbackNode); this._feedbackMessage = React.createRef(); - render(, this._feedbackNode); + render(, this._feedbackNode); this._labelNode = document.createElement('div'); this._containerNode.appendChild(this._labelNode);