Skip to content

Commit 1abe09e

Browse files
Translations for Coordinate Map (#23952)
translate Coordinate Map
1 parent 4cc49be commit 1abe09e

File tree

9 files changed

+128
-71
lines changed

9 files changed

+128
-71
lines changed

.i18nrc.json

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -7,6 +7,7 @@
77
"markdownVis": "src/core_plugins/markdown_vis",
88
"metricVis": "src/core_plugins/metric_vis",
99
"statusPage": "src/core_plugins/status_page",
10+
"tileMap": "src/core_plugins/tile_map",
1011
"tagCloud": "src/core_plugins/tagcloud",
1112
"xpack.idxMgmt": "x-pack/plugins/index_management",
1213
"xpack.watcher": "x-pack/plugins/watcher"

src/core_plugins/tile_map/public/base_maps_visualization.js

Lines changed: 4 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -27,7 +27,7 @@ import { toastNotifications } from 'ui/notify';
2727
const MINZOOM = 0;
2828
const MAXZOOM = 22;//increase this to 22. Better for WMS
2929

30-
export function BaseMapsVisualizationProvider(serviceSettings) {
30+
export function BaseMapsVisualizationProvider(serviceSettings, i18n) {
3131

3232
/**
3333
* Abstract base class for a visualization consisting of a map with a single baselayer.
@@ -195,7 +195,9 @@ export function BaseMapsVisualizationProvider(serviceSettings) {
195195
}
196196

197197
async _updateData() {
198-
throw new Error('Child should implement this method to respond to data-update');
198+
throw new Error(i18n('tileMap.baseMapsVisualization.childShouldImplementMethodErrorMessage', {
199+
defaultMessage: 'Child should implement this method to respond to data-update',
200+
}));
199201
}
200202

201203
_hasESResponseChanged(data) {

src/core_plugins/tile_map/public/coordinate_maps_visualization.js

Lines changed: 4 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -18,6 +18,7 @@
1818
*/
1919

2020
import _ from 'lodash';
21+
import { i18n } from '@kbn/i18n';
2122
import { GeohashLayer } from './geohash_layer';
2223
import { BaseMapsVisualizationProvider } from './base_maps_visualization';
2324
import { AggConfig } from 'ui/vis/agg_config';
@@ -219,7 +220,9 @@ export function CoordinateMapsVisualizationProvider(Notifier, Private) {
219220
esResp = await searchSource.fetch();
220221
} catch(error) {
221222
toastNotifications.addDanger({
222-
title: `Unable to get bounds`,
223+
title: i18n.translate('tileMap.coordinateMapsVisualization.unableToGetBoundErrorTitle', {
224+
defaultMessage: 'Unable to get bounds',
225+
}),
223226
text: `${error.message}`,
224227
});
225228
return;

src/core_plugins/tile_map/public/editors/_tooltip_formatter.js

Lines changed: 3 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -19,7 +19,7 @@
1919

2020
import $ from 'jquery';
2121

22-
export function TileMapTooltipFormatterProvider($compile, $rootScope) {
22+
export function TileMapTooltipFormatterProvider($compile, $rootScope, i18n) {
2323

2424
const $tooltipScope = $rootScope.$new();
2525
const $el = $('<div>').html(require('./_tooltip.html'));
@@ -37,11 +37,11 @@ export function TileMapTooltipFormatterProvider($compile, $rootScope) {
3737
value: metricAgg.fieldFormatter()(feature.properties.value)
3838
},
3939
{
40-
label: 'Latitude',
40+
label: i18n('tileMap.tooltipFormatter.latitudeLabel', { defaultMessage: 'Latitude' }),
4141
value: feature.geometry.coordinates[1]
4242
},
4343
{
44-
label: 'Longitude',
44+
label: i18n('tileMap.tooltipFormatter.longitudeLabel', { defaultMessage: 'Longitude' }),
4545
value: feature.geometry.coordinates[0]
4646
}
4747
];

src/core_plugins/tile_map/public/editors/tile_map_vis_params.html

Lines changed: 22 additions & 11 deletions
Original file line numberDiff line numberDiff line change
@@ -1,7 +1,11 @@
11
<!-- vis type specific options -->
22
<div class="kuiSideBarSection">
33
<div class="form-group">
4-
<label for="coordinateMapOptionsMapType">Map type</label>
4+
<label
5+
for="coordinateMapOptionsMapType"
6+
i18n-id="tileMap.visParams.mapTypeLabel"
7+
i18n-default-message="Map type"
8+
></label>
59
<select
610
id="coordinateMapOptionsMapType"
711
name="agg"
@@ -15,9 +19,12 @@
1519

1620

1721
<div class="kuiSideBarFormRow" >
18-
<label class="kuiSideBarFormRow__label" for="colorSchema">
19-
Color Schema
20-
</label>
22+
<label
23+
class="kuiSideBarFormRow__label"
24+
for="colorSchema"
25+
i18n-id="tileMap.visParams.colorSchemaLabel"
26+
i18n-default-message="Color Schema"
27+
></label>
2128
<div class="kuiSideBarFormRow__control">
2229
<select
2330
id="colorSchema"
@@ -30,9 +37,10 @@
3037

3138
<div ng-if="editorState.params.mapType === 'Heatmap'" class="form-group">
3239
<div>
33-
<label>
34-
Cluster size
35-
</label>
40+
<label
41+
i18n-id="tileMap.visParams.clusterSizeLabel"
42+
i18n-default-message="Cluster size"
43+
></label>
3644
<div class="visEditorAgg__formRow--flex">
3745
<input
3846
name="heatClusterSize"
@@ -55,9 +63,12 @@
5563
<vislib-basic-options></vislib-basic-options>
5664

5765
<div class="kuiSideBarFormRow">
58-
<label class="kuiSideBarFormRow__label" for="desaturateMapTiles">
59-
Desaturate tiles
60-
</label>
66+
<label
67+
class="kuiSideBarFormRow__label"
68+
for="desaturateMapTiles"
69+
i18n-id="tileMap.visParams.desaturateTilesLabel"
70+
i18n-default-message="Desaturate tiles"
71+
></label>
6172

6273
<div class="kuiSideBarFormRow__control">
6374
<input
@@ -69,7 +80,7 @@
6980
>
7081
&nbsp;
7182
<icon-tip
72-
content="'Reduce the vibrancy of tile colors. This does not work in any version of Internet Explorer.'"
83+
content="{{::'tileMap.visParams.reduceVibrancyOfTileColorsTip' | i18n: {defaultMessage: '\'Reduce the vibrancy of tile colors. This does not work in any version of Internet Explorer.\''} }}"
7384
position="'right'"
7485
></icon-tip>
7586
</div>

src/core_plugins/tile_map/public/editors/wms_options.html

Lines changed: 60 additions & 44 deletions
Original file line numberDiff line numberDiff line change
@@ -3,16 +3,21 @@
33

44
<div class="kuiSideBarSection">
55
<div class="kuiSideBarSectionTitle">
6-
<div class="kuiSideBarSectionTitle__text">
7-
Base Layer Settings
8-
</div>
6+
<div
7+
class="kuiSideBarSectionTitle__text"
8+
i18n-id="tileMap.wmsOptions.baseLayerSettingsTitle"
9+
i18n-default-message="Base Layer Settings"
10+
></div>
911
</div>
1012

1113

1214
<div class="kuiSideBarFormRow" ng-show="!options.enabled">
13-
<label class="kuiSideBarFormRow__label" for="tmsLayers">
14-
Layers
15-
</label>
15+
<label
16+
class="kuiSideBarFormRow__label"
17+
for="tmsLayers"
18+
i18n-id="tileMap.wmsOptions.layersLabel"
19+
i18n-default-message="Layers"
20+
></label>
1621
<div class="kuiSideBarFormRow__control">
1722
<select
1823
id="tmsLayers"
@@ -24,9 +29,12 @@
2429
</div>
2530

2631
<div class="kuiSideBarFormRow">
27-
<label class="kuiSideBarFormRow__label" for="wmsCompliantMapServer">
28-
WMS map server
29-
</label>
32+
<label
33+
class="kuiSideBarFormRow__label"
34+
for="wmsCompliantMapServer"
35+
i18n-id="tileMap.wmsOptions.wmsMapServerLabel"
36+
i18n-default-message="WMS map server"
37+
></label>
3038

3139
<div class="kuiSideBarFormRow__control">
3240
<input
@@ -37,23 +45,28 @@
3745
>
3846
&nbsp;
3947
<icon-tip
40-
content="'Use WMS compliant map tile server. For advanced users only.'"
48+
content="{{::'tileMap.wmsOptions.useWMSCompliantMapTileServerTip' | i18n: {defaultMessage: '\'Use WMS compliant map tile server. For advanced users only.\''} }}"
4149
position="'right'"
4250
></icon-tip>
4351
</div>
4452
</div>
4553

4654
<div ng-show="options.enabled">
4755
<div class="form-group">
48-
<p>WMS is an OGC standard for map image services. For more information, go <a
49-
href="http://www.opengeospatial.org/standards/wms">here</a>.</p>
50-
<br>
56+
<p
57+
i18n-id="tileMap.wmsOptions.wmsDescription"
58+
i18n-default-message="WMS is an OGC standard for map image services. For more information, go {wmsLink}."
59+
i18n-values="{
60+
wmsLink: '<a href=\'http://www.opengeospatial.org/standards/wms\'>' + wmsLinkText + '</a>'
61+
}"
62+
></p>
63+
<br>
5164
<label>
52-
WMS url*
53-
<icon-tip
54-
position="'right'"
55-
content="'The URL of the WMS web service'"
56-
></icon-tip>
65+
<span
66+
i18n-id="tileMap.wmsOptions.wmsUrlLabel"
67+
i18n-default-message="WMS url*"
68+
></span>
69+
<icon-tip position="'right'" content="{{::'tileMap.wmsOptions.urlOfWMSWebServiceTip' | i18n: {defaultMessage: '\'The URL of the WMS web service\''} }}"></icon-tip>
5770
</label>
5871
<input type="text" class="form-control"
5972
name="wms.url"
@@ -62,11 +75,11 @@
6275

6376
<div class="form-group">
6477
<label>
65-
WMS layers*
66-
<icon-tip
67-
position="'right'"
68-
content="'A comma separated list of layers to use'"
69-
></icon-tip>
78+
<span
79+
i18n-id="tileMap.wmsOptions.wmsLayersLabel"
80+
i18n-default-message="WMS layers*"
81+
></span>
82+
<icon-tip position="'right'" content="{{::'tileMap.wmsOptions.listOfLayersToUseTip' | i18n: {defaultMessage: '\'A comma separated list of layers to use\''} }}"></icon-tip>
7083
</label>
7184
<input type="text" class="form-control"
7285
ng-require="options.enabled"
@@ -76,11 +89,11 @@
7689

7790
<div class="form-group">
7891
<label>
79-
WMS version*
80-
<icon-tip
81-
position="'right'"
82-
content="'The version of WMS the server supports'"
83-
></icon-tip>
92+
<span
93+
i18n-id="tileMap.wmsOptions.wmsVersionLabel"
94+
i18n-default-message="WMS version*"
95+
></span>
96+
<icon-tip position="'right'" content="{{::'tileMap.wmsOptions.versionOfWMSserverSupportsTip' | i18n: {defaultMessage: '\'The version of WMS the server supports\''} }}"></icon-tip>
8497
</label>
8598
<input type="text" class="form-control"
8699
name="wms.options.version"
@@ -89,11 +102,11 @@
89102

90103
<div class="form-group">
91104
<label>
92-
WMS format*
93-
<icon-tip
94-
position="'right'"
95-
content="'Usually image/png or image/jpeg. Use png if the server will return transparent layers.'"
96-
></icon-tip>
105+
<span
106+
i18n-id="tileMap.wmsOptions.wmsFormatLabel"
107+
i18n-default-message="WMS format*"
108+
></span>
109+
<icon-tip position="'right'" content="{{::'tileMap.wmsOptions.imageFormatToUseTip' | i18n: {defaultMessage: '\'Usually image/png or image/jpeg. Use png if the server will return transparent layers.\''} }}"></icon-tip>
97110
</label>
98111
<input type="text" class="form-control"
99112
name="wms.options.format"
@@ -102,11 +115,11 @@
102115

103116
<div class="form-group">
104117
<label>
105-
WMS attribution
106-
<icon-tip
107-
position="'right'"
108-
content="'Attribution string for the lower right corner'"
109-
></icon-tip>
118+
<span
119+
i18n-id="tileMap.wmsOptions.wmsAttributionLabel"
120+
i18n-default-message="WMS attribution"
121+
></span>
122+
<icon-tip position="'right'" content="{{::'tileMap.wmsOptions.attributionStringTip' | i18n: {defaultMessage: '\'Attribution string for the lower right corner\''} }}"></icon-tip>
110123
</label>
111124
<input type="text" class="form-control"
112125
name="wms.options.attribution"
@@ -115,18 +128,21 @@
115128

116129
<div class="form-group">
117130
<label>
118-
WMS styles*
119-
<icon-tip
120-
position="'right'"
121-
content="'A comma separated list of WMS server supported styles to use. Blank in most cases.'"
122-
></icon-tip>
131+
<span
132+
i18n-id="tileMap.wmsOptions.wmsStylesLabel"
133+
i18n-default-message="WMS styles*"
134+
></span>
135+
<icon-tip position="'right'" content="{{::'tileMap.wmsOptions.wmsServerSupportedStylesListTip' | i18n: {defaultMessage: '\'A comma separated list of WMS server supported styles to use. Blank in most cases.\''} }}"></icon-tip>
123136
</label>
124137
<input type="text" class="form-control"
125138
name="wms.options.styles"
126139
ng-model="options.options.styles">
127140
</div>
128141

129-
<p>* if this parameter is incorrect, maps will fail to load.</p>
142+
<p
143+
i18n-id="tileMap.wmsOptions.mapLoadFailDescription"
144+
i18n-default-message="* if this parameter is incorrect, maps will fail to load."
145+
></p>
130146

131147

132148
</div>

src/core_plugins/tile_map/public/editors/wms_options.js

Lines changed: 2 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -21,7 +21,7 @@ import { uiModules } from 'ui/modules';
2121
import wmsOptionsTemplate from './wms_options.html';
2222
const module = uiModules.get('kibana');
2323

24-
module.directive('wmsOptions', function (serviceSettings) {
24+
module.directive('wmsOptions', function (serviceSettings, i18n) {
2525
return {
2626
restrict: 'E',
2727
template: wmsOptionsTemplate,
@@ -31,6 +31,7 @@ module.directive('wmsOptions', function (serviceSettings) {
3131
collections: '=',
3232
},
3333
link: function ($scope) {
34+
$scope.wmsLinkText = i18n('tileMap.wmsOptions.wmsLinkText', { defaultMessage: 'here' });
3435

3536
new Promise((resolve, reject) => {
3637

src/core_plugins/tile_map/public/geohash_layer.js

Lines changed: 7 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -19,6 +19,7 @@
1919

2020
import L from 'leaflet';
2121
import _ from 'lodash';
22+
import { i18n } from '@kbn/i18n';
2223

2324
import { KibanaMapLayer } from 'ui/vis/map/kibana_map_layer';
2425
import { HeatmapMarkers } from './markers/heatmap';
@@ -83,7 +84,12 @@ export class GeohashLayer extends KibanaMapLayer {
8384
}, this._zoom, this._featureCollectionMetaData.max);
8485
break;
8586
default:
86-
throw new Error(`${this._geohashOptions.mapType} mapType not recognized`);
87+
throw new Error(i18n.translate('tileMap.geohashLayer.mapTitle', {
88+
defaultMessage: '{mapType} mapType not recognized',
89+
values: {
90+
mapType: this._geohashOptions.mapType,
91+
},
92+
}));
8793

8894
}
8995

0 commit comments

Comments
 (0)