diff --git a/.i18nrc.json b/.i18nrc.json index 5760f0b36bb0f..860e477395c06 100644 --- a/.i18nrc.json +++ b/.i18nrc.json @@ -7,6 +7,7 @@ "kbn.management.objects": "src/core_plugins/kibana/public/management", "markdownVis": "src/core_plugins/markdown_vis", "metricVis": "src/core_plugins/metric_vis", + "regionMap": "src/core_plugins/region_map", "statusPage": "src/core_plugins/status_page", "tagCloud": "src/core_plugins/tagcloud", "xpack.idxMgmt": "x-pack/plugins/index_management", diff --git a/src/core_plugins/region_map/public/choropleth_layer.js b/src/core_plugins/region_map/public/choropleth_layer.js index 04a998f60996c..bc3a21d39d2c9 100644 --- a/src/core_plugins/region_map/public/choropleth_layer.js +++ b/src/core_plugins/region_map/public/choropleth_layer.js @@ -21,6 +21,7 @@ import $ from 'jquery'; import L from 'leaflet'; import _ from 'lodash'; import d3 from 'd3'; +import { i18n } from '@kbn/i18n'; import { KibanaMapLayer } from 'ui/vis/map/kibana_map_layer'; import { truncatedColorMaps } from 'ui/vislib/components/color/truncated_colormaps'; import * as topojson from 'topojson-client'; @@ -123,7 +124,10 @@ export default class ChoroplethLayer extends KibanaMapLayer { featureCollection = topojson.feature(data, features);//conversion to geojson } else { //should never happen - throw new Error('Unrecognized format ' + formatType); + throw new Error(i18n.translate('regionMap.choroplethLayer.unrecognizedFormatErrorMessage', { + defaultMessage: 'Unrecognized format {formatType}', + values: { formatType }, + })); } this._sortedFeatures = featureCollection.features.slice(); this._sortFeatures(); @@ -143,15 +147,23 @@ export default class ChoroplethLayer extends KibanaMapLayer { let errorMessage; if (e.status === 404) { - errorMessage = `Server responding with '404' when attempting to fetch ${geojsonUrl}. - Make sure the file exists at that location.`; + errorMessage = i18n.translate('regionMap.choroplethLayer.downloadingVectorData404ErrorMessage', { + defaultMessage: 'Server responding with \'404\' when attempting to fetch {geojsonUrl}. \ +Make sure the file exists at that location.', + values: { geojsonUrl }, + }); } else { - errorMessage = `Cannot download ${geojsonUrl} file. Please ensure the -CORS configuration of the server permits requests from the Kibana application on this host.`; + errorMessage = i18n.translate('regionMap.choroplethLayer.downloadingVectorDataErrorMessage', { + defaultMessage: 'Cannot download {geojsonUrl} file. Please ensure the \ +CORS configuration of the server permits requests from the Kibana application on this host.', + values: { geojsonUrl }, + }); } toastNotifications.addDanger({ - title: 'Error downloading vector data', + title: i18n.translate('regionMap.choroplethLayer.downloadingVectorDataErrorMessageTitle', { + defaultMessage: 'Error downloading vector data', + }), text: errorMessage, }); diff --git a/src/core_plugins/region_map/public/region_map_vis.js b/src/core_plugins/region_map/public/region_map_vis.js index fdf94ee4cc268..5d85272b8360d 100644 --- a/src/core_plugins/region_map/public/region_map_vis.js +++ b/src/core_plugins/region_map/public/region_map_vis.js @@ -27,7 +27,7 @@ import { mapToLayerWithId } from './util'; import { RegionMapsVisualizationProvider } from './region_map_visualization'; import { Status } from 'ui/vis/update_status'; -VisTypesRegistryProvider.register(function RegionMapProvider(Private, regionmapsConfig, config) { +VisTypesRegistryProvider.register(function RegionMapProvider(Private, regionmapsConfig, config, i18n) { const VisFactory = Private(VisFactoryProvider); const RegionMapsVisualization = Private(RegionMapsVisualizationProvider); @@ -37,9 +37,9 @@ VisTypesRegistryProvider.register(function RegionMapProvider(Private, regionmaps return VisFactory.createBaseVisualization({ name: 'region_map', - title: 'Region Map', - description: 'Show metrics on a thematic map. Use one of the provided base maps, or add your own. ' + - 'Darker colors represent higher values.', + title: i18n('regionMap.mapVis.regionMapTitle', { defaultMessage: 'Region Map' }), + description: i18n('regionMap.mapVis.regionMapDescription', { defaultMessage: 'Show metrics on a thematic map. Use one of the \ +provided base maps, or add your own. Darker colors represent higher values.' }), category: CATEGORY.MAP, icon: 'visMapRegion', visConfig: { @@ -65,16 +65,16 @@ VisTypesRegistryProvider.register(function RegionMapProvider(Private, regionmaps collections: { legendPositions: [{ value: 'bottomleft', - text: 'bottom left', + text: i18n('regionMap.mapVis.regionMapEditorConfig.bottomLeftText', { defaultMessage: 'bottom left' }), }, { value: 'bottomright', - text: 'bottom right', + text: i18n('regionMap.mapVis.regionMapEditorConfig.bottomRightText', { defaultMessage: 'bottom right' }), }, { value: 'topleft', - text: 'top left', + text: i18n('regionMap.mapVis.regionMapEditorConfig.topLeftText', { defaultMessage: 'top left' }), }, { value: 'topright', - text: 'top right', + text: i18n('regionMap.mapVis.regionMapEditorConfig.topRightText', { defaultMessage: 'top right' }), }], colorSchemas: Object.keys(truncatedColorMaps), vectorLayers: vectorLayers @@ -83,7 +83,7 @@ VisTypesRegistryProvider.register(function RegionMapProvider(Private, regionmaps { group: 'metrics', name: 'metric', - title: 'Value', + title: i18n('regionMap.mapVis.regionMapEditorConfig.schemas.metricTitle', { defaultMessage: 'Value' }), min: 1, max: 1, aggFilter: ['count', 'avg', 'sum', 'min', 'max', 'cardinality', 'top_hits', @@ -96,7 +96,7 @@ VisTypesRegistryProvider.register(function RegionMapProvider(Private, regionmaps group: 'buckets', name: 'segment', icon: 'fa fa-globe', - title: 'shape field', + title: i18n('regionMap.mapVis.regionMapEditorConfig.schemas.segmentTitle', { defaultMessage: 'shape field' }), min: 1, max: 1, aggFilter: ['terms'] diff --git a/src/core_plugins/region_map/public/region_map_vis_params.html b/src/core_plugins/region_map/public/region_map_vis_params.html index 024041134d4b2..58be7df7a739a 100644 --- a/src/core_plugins/region_map/public/region_map_vis_params.html +++ b/src/core_plugins/region_map/public/region_map_vis_params.html @@ -1,15 +1,20 @@
-
- Layer Settings -
+
- +
- + +
- +
 
- +
 
@@ -79,12 +110,19 @@
-
Style settings
+
- +
0 && shouldShowWarning) { toastNotifications.addWarning({ - title: `Unable to show ${event.mismatches.length} ${event.mismatches.length > 1 ? 'results' : 'result'} on map`, - text: `Ensure that each of these term matches a shape on that shape's join field: ${event.mismatches.join(', ')}`, + title: i18n('regionMap.visualization.unableToShowMismatchesWarningTitle', { + defaultMessage: 'Unable to show {mismatchesLength} {oneMismatch, plural, one {result} other {results}} on map', + values: { + mismatchesLength: event.mismatches.length, + oneMismatch: event.mismatches.length > 1 ? 0 : 1, + }, + }), + text: i18n('regionMap.visualization.unableToShowMismatchesWarningText', { + defaultMessage: 'Ensure that each of these term matches a shape on that shape\'s join field: {mismatches}', + values: { + mismatches: event.mismatches.join(', '), + }, + }), }); } });