Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

[Maps] Localization #30881

Merged
merged 91 commits into from
Mar 6, 2019
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
Show all changes
91 commits
Select commit Hold shift + click to select a range
557123d
initial commit
thomasneirynck Feb 12, 2019
6ee5a8e
add telemetry file
thomasneirynck Feb 12, 2019
d8b9ece
Merge branch 'master' into maps/localize
thomasneirynck Feb 14, 2019
a83d80e
translate routes file
thomasneirynck Feb 14, 2019
4f88465
localize feature registration
thomasneirynck Feb 14, 2019
3ab2b0f
remove dead code path
thomasneirynck Feb 14, 2019
b9f6af2
fix edit
thomasneirynck Feb 14, 2019
538f533
localize es parsing
thomasneirynck Feb 14, 2019
27b964b
remove dead code
thomasneirynck Feb 14, 2019
46e896a
style names
thomasneirynck Feb 14, 2019
1650e40
typos
thomasneirynck Feb 14, 2019
a883115
register maps plugin
thomasneirynck Feb 14, 2019
3834b06
replace with string
thomasneirynck Feb 14, 2019
11a241f
localize xyz source
thomasneirynck Feb 14, 2019
e701185
wms
thomasneirynck Feb 14, 2019
d0bae44
source details
thomasneirynck Feb 14, 2019
8fb7689
Merge branch 'master' into maps/localize
thomasneirynck Feb 21, 2019
1b1e043
localize add layer panel
thomasneirynck Feb 21, 2019
c743bd5
Merge branch 'master' into maps/localize
thomasneirynck Feb 25, 2019
14f6c10
Remove dead code
thomasneirynck Feb 25, 2019
9a91f8d
localize
thomasneirynck Feb 25, 2019
a47e36e
localize joins (pt1)
thomasneirynck Feb 25, 2019
a0419e0
localize joins (pt2)
thomasneirynck Feb 25, 2019
5e4aa68
localize joins (pt3)
thomasneirynck Feb 25, 2019
f322105
Merge branch 'master' into maps/localize
thomasneirynck Feb 26, 2019
99bbea9
localize settings
thomasneirynck Feb 27, 2019
5703c86
localize toc entry
thomasneirynck Feb 27, 2019
65f67d6
view control
thomasneirynck Feb 27, 2019
5c25836
Merge branch 'master' into maps/localize
thomasneirynck Feb 28, 2019
d852151
localize inspector
thomasneirynck Feb 28, 2019
b10b952
layer actions
thomasneirynck Feb 28, 2019
b0f8ed4
localize map listing
thomasneirynck Feb 28, 2019
debf79f
localize metric-select
thomasneirynck Feb 28, 2019
e89b1ed
localize metrics-editor
thomasneirynck Feb 28, 2019
d297e06
localize no-index-pattern-callout
thomasneirynck Feb 28, 2019
7d7eedd
localize range
thomasneirynck Feb 28, 2019
521ff09
regenerate snapshots
thomasneirynck Mar 1, 2019
01a6045
Merge branch 'master' into maps/localize
thomasneirynck Mar 5, 2019
c19c30a
review feedback (1)
thomasneirynck Mar 5, 2019
ffa22e9
remove wrapper
thomasneirynck Mar 5, 2019
296171b
rename labels
thomasneirynck Mar 5, 2019
15eebd1
feedback (2)
thomasneirynck Mar 5, 2019
9a86cf2
feedback (3)
thomasneirynck Mar 5, 2019
63a3c0e
feedback (4)
thomasneirynck Mar 5, 2019
4ea4d06
feedback (5)
thomasneirynck Mar 5, 2019
312b049
feedback (6)
thomasneirynck Mar 5, 2019
9f38ba0
feedback (7)
thomasneirynck Mar 5, 2019
3c36c33
feedback (8)
thomasneirynck Mar 5, 2019
14afb9c
controller
thomasneirynck Mar 5, 2019
9d5d9af
settings panel
thomasneirynck Mar 5, 2019
1cf11b2
layer panel
thomasneirynck Mar 5, 2019
f6591e5
sources
thomasneirynck Mar 5, 2019
ccb2f79
ems file
thomasneirynck Mar 5, 2019
85f7a59
tms source
thomasneirynck Mar 5, 2019
c7e1a28
es grid
thomasneirynck Mar 5, 2019
8748714
format
thomasneirynck Mar 5, 2019
4b5728a
format
thomasneirynck Mar 5, 2019
4bb7c04
es search
thomasneirynck Mar 5, 2019
3908310
localize
thomasneirynck Mar 6, 2019
d52116d
kbn regionmap (2)
thomasneirynck Mar 6, 2019
59a86b9
kbn tms
thomasneirynck Mar 6, 2019
e0da409
kbn tms (2)
thomasneirynck Mar 6, 2019
a9ccdb7
ems unavailable
thomasneirynck Mar 6, 2019
25d2156
es join source
thomasneirynck Mar 6, 2019
d10dfd3
typo
thomasneirynck Mar 6, 2019
638d3c4
es source
thomasneirynck Mar 6, 2019
c326020
vector source
thomasneirynck Mar 6, 2019
f6b3c14
static/dyn row
thomasneirynck Mar 6, 2019
fcd8d55
vector style editor
thomasneirynck Mar 6, 2019
63031c1
field selct
thomasneirynck Mar 6, 2019
6d4bfcd
size range
thomasneirynck Mar 6, 2019
9c15bf1
update snapshot
thomasneirynck Mar 6, 2019
5f8425a
Merge branch 'master' into maps/localize
thomasneirynck Mar 6, 2019
bc4e5c0
feedback
thomasneirynck Mar 6, 2019
929b114
revert
thomasneirynck Mar 6, 2019
d9b060e
feedback (1)
thomasneirynck Mar 6, 2019
59e4748
plural
thomasneirynck Mar 6, 2019
bdd9825
config errors
thomasneirynck Mar 6, 2019
8f51d00
remove trailing i18n
thomasneirynck Mar 6, 2019
488f247
localize sample data
thomasneirynck Mar 6, 2019
c531127
rename for clarity
thomasneirynck Mar 6, 2019
0567df2
fix namespace
thomasneirynck Mar 6, 2019
39f20b4
top nav
thomasneirynck Mar 6, 2019
226d604
top nav
thomasneirynck Mar 6, 2019
48814ff
update shallow imports
thomasneirynck Mar 6, 2019
88d62c1
tms source
thomasneirynck Mar 6, 2019
d1506bb
feedback
thomasneirynck Mar 6, 2019
f259247
update snaps
thomasneirynck Mar 6, 2019
87ef04b
feedback (2)
thomasneirynck Mar 6, 2019
3e28e7e
use function
thomasneirynck Mar 6, 2019
09851c0
no need to internationalize url
thomasneirynck Mar 6, 2019
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
1 change: 1 addition & 0 deletions .i18nrc.json
Original file line number Diff line number Diff line change
Expand Up @@ -31,6 +31,7 @@
"xpack.infra": "x-pack/plugins/infra",
"xpack.kueryAutocomplete": "x-pack/plugins/kuery_autocomplete",
"xpack.licenseMgmt": "x-pack/plugins/license_management",
"xpack.maps": "x-pack/plugins/maps",
"xpack.ml": "x-pack/plugins/ml",
"xpack.logstash": "x-pack/plugins/logstash",
"xpack.main": "x-pack/plugins/xpack_main",
Expand Down
4 changes: 4 additions & 0 deletions x-pack/plugins/maps/common/constants.js
Original file line number Diff line number Diff line change
Expand Up @@ -16,4 +16,8 @@ export const ZOOM_PRECISION = 2;

export const DEFAULT_EMS_TILE_LAYER = 'road_map';

export const APP_ID = 'maps';

export const APP_ICON = 'gisApp';

export const SOURCE_DATA_ID_ORIGIN = 'source';
26 changes: 26 additions & 0 deletions x-pack/plugins/maps/common/i18n_getters.js
Original file line number Diff line number Diff line change
@@ -0,0 +1,26 @@
/*
* Copyright Elasticsearch B.V. and/or licensed to Elasticsearch B.V. under one
* or more contributor license agreements. Licensed under the Elastic License;
* you may not use this file except in compliance with the Elastic License.
*/

import { i18n } from '@kbn/i18n';

export function getAppTitle() {
return i18n.translate('xpack.maps.appTitle', {
defaultMessage: 'Maps'
});
}


export function getDataSourceLabel() {
return i18n.translate('xpack.maps.source.dataSourceLabel', {
defaultMessage: 'Data source'
});
}

export function getUrlLabel() {
return i18n.translate('xpack.maps.source.urlLabel', {
defaultMessage: 'Url'
});
}
25 changes: 15 additions & 10 deletions x-pack/plugins/maps/index.js
Original file line number Diff line number Diff line change
Expand Up @@ -6,30 +6,35 @@

import { resolve } from 'path';
import { initRoutes } from './server/routes';
import ecommerceSavedObjects from './server/sample_data/ecommerce_saved_objects.json';
import fligthsSavedObjects from './server/sample_data/flights_saved_objects.json';
import webLogsSavedObjects from './server/sample_data/web_logs_saved_objects.json';
import { getEcommerceSavedObjects } from './server/sample_data/ecommerce_saved_objects';
import { getFlightsSavedObjects } from './server/sample_data/flights_saved_objects.js';
import { getWebLogsSavedObjects } from './server/sample_data/web_logs_saved_objects.js';
import mappings from './mappings.json';
import { checkLicense } from './check_license';
import { migrations } from './migrations';
import { watchStatusAndLicenseToInitialize } from
'../../server/lib/watch_status_and_license_to_initialize';
import { initTelemetryCollection } from './server/maps_telemetry';
import { i18n } from '@kbn/i18n';
import { APP_ID, APP_ICON } from './common/constants';
import { getAppTitle } from './common/i18n_getters';

export function maps(kibana) {

return new kibana.Plugin({
require: ['kibana', 'elasticsearch', 'xpack_main', 'tile_map', 'task_manager'],
id: 'maps',
id: APP_ID,
configPrefix: 'xpack.maps',
publicDir: resolve(__dirname, 'public'),
uiExports: {
app: {
title: 'Maps',
description: 'Map application',
title: getAppTitle(),
description: i18n.translate('xpack.maps.appDescription', {
defaultMessage: 'Map application'
}),
main: 'plugins/maps/index',
icon: 'plugins/maps/icon.svg',
euiIconType: 'gisApp',
euiIconType: APP_ICON,
},
injectDefaultVars(server) {
const serverConfig = server.config();
Expand Down Expand Up @@ -86,9 +91,9 @@ export function maps(kibana) {
.feature(this.id)
.registerLicenseCheckResultsGenerator(checkLicense);

server.addSavedObjectsToSampleDataset('ecommerce', ecommerceSavedObjects);
server.addSavedObjectsToSampleDataset('flights', fligthsSavedObjects);
server.addSavedObjectsToSampleDataset('logs', webLogsSavedObjects);
server.addSavedObjectsToSampleDataset('ecommerce', getEcommerceSavedObjects());
server.addSavedObjectsToSampleDataset('flights', getFlightsSavedObjects());
server.addSavedObjectsToSampleDataset('logs', getWebLogsSavedObjects());
server.injectUiAppVars('maps', async () => {
return await server.getInjectedUiAppVars('kibana');
});
Expand Down
45 changes: 33 additions & 12 deletions x-pack/plugins/maps/public/angular/map_controller.js
Original file line number Diff line number Diff line change
Expand Up @@ -6,7 +6,8 @@

import chrome from 'ui/chrome';
import React from 'react';
import { I18nContext } from 'ui/i18n';
import { I18nProvider } from '@kbn/i18n/react';
thomasneirynck marked this conversation as resolved.
Show resolved Hide resolved
thomasneirynck marked this conversation as resolved.
Show resolved Hide resolved
import { i18n } from '@kbn/i18n';
import { render, unmountComponentAtNode } from 'react-dom';
import { uiModules } from 'ui/modules';
import { timefilter } from 'ui/timefilter';
Expand Down Expand Up @@ -143,9 +144,9 @@ app.controller('GisMapController', ($scope, $route, config, kbnUrl, localStorage
const root = document.getElementById(REACT_ANCHOR_DOM_ELEMENT_ID);
render(
<Provider store={store}>
<I18nContext>
<I18nProvider>
<GisMap/>
</I18nContext>
</I18nProvider>
</Provider>,
root
);
Expand Down Expand Up @@ -201,7 +202,9 @@ app.controller('GisMapController', ($scope, $route, config, kbnUrl, localStorage

// TODO subscribe to store change and change when store updates title
chrome.breadcrumbs.set([
{ text: 'Maps', href: '#' },
{ text: i18n.translate('xpack.maps.mapController.mapsBreadcrumbLabel', {
defaultMessage: 'Maps'
}), href: '#' },
{ text: $scope.map.title }
]);

Expand All @@ -216,7 +219,10 @@ app.controller('GisMapController', ($scope, $route, config, kbnUrl, localStorage
docTitle.change(savedMap.title);
} catch(err) {
toastNotifications.addDanger({
title: `Error on saving '${savedMap.title}'`,
title: i18n.translate('xpack.maps.mapController.saveErrorMessage', {
defaultMessage: `Error on saving '{title}'`,
values: { title: savedMap.title }
}),
text: err.message,
'data-test-subj': 'saveMapError',
});
Expand All @@ -225,7 +231,10 @@ app.controller('GisMapController', ($scope, $route, config, kbnUrl, localStorage

if (id) {
toastNotifications.addSuccess({
title: `Saved '${savedMap.title}'`,
title: i18n.translate('xpack.maps.mapController.saveSuccessMessage', {
defaultMessage: `Saved '{title}'`,
values: { title: savedMap.title }
}),
'data-test-subj': 'saveMapSuccess',
});

Expand All @@ -243,23 +252,35 @@ app.controller('GisMapController', ($scope, $route, config, kbnUrl, localStorage
timefilter.disableAutoRefreshSelector();
$scope.showDatePicker = true; // used by query-bar directive to enable timepikcer in query bar
$scope.topNavMenu = [{
key: 'full screen',
description: 'full screen',
key: i18n.translate('xpack.maps.mapController.fullScreenButtonLabel', {
defaultMessage: `full screen`
}),
description: i18n.translate('xpack.maps.mapController.fullScreenDescription', {
defaultMessage: `full screen`
}),
testId: 'mapsFullScreenMode',
run() {
store.dispatch(enableFullScreen());
}
}, {
key: 'inspect',
description: 'Open Inspector',
key: i18n.translate('xpack.maps.mapController.openInspectorButtonLabel', {
defaultMessage: `inspect`
}),
description: i18n.translate('xpack.maps.mapController.openInspectorDescription', {
defaultMessage: `Open Inspector`
}),
testId: 'openInspectorButton',
run() {
const inspectorAdapters = getInspectorAdapters(store.getState());
Inspector.open(inspectorAdapters, {});
}
}, {
key: 'save',
description: 'Save map',
key: i18n.translate('xpack.maps.mapController.saveMapButtonLabel', {
defaultMessage: `save`
}),
description: i18n.translate('xpack.maps.mapController.saveMapDescription', {
defaultMessage: `Save map`
}),
testId: 'mapSaveButton',
run: async () => {
const onSave = ({ newTitle, newCopyOnSave, isTitleDuplicateConfirmed, onTitleDuplicate }) => {
Expand Down
30 changes: 25 additions & 5 deletions x-pack/plugins/maps/public/components/layer_addpanel/view.js
Original file line number Diff line number Diff line change
Expand Up @@ -20,6 +20,7 @@ import {
EuiFlyoutBody,
EuiFlyoutFooter,
} from '@elastic/eui';
import { FormattedMessage } from '@kbn/i18n/react';
thomasneirynck marked this conversation as resolved.
Show resolved Hide resolved
import _ from 'lodash';

export class AddLayerPanel extends Component {
Expand Down Expand Up @@ -71,7 +72,10 @@ export class AddLayerPanel extends Component {
}}
fill
>
Add layer
<FormattedMessage
id="xpack.maps.addLayerPanel.addLayerButtonLabel"
defaultMessage="Add layer"
/>
</EuiButton>
);
}
Expand Down Expand Up @@ -102,7 +106,12 @@ export class AddLayerPanel extends Component {
return (
<Fragment>
<EuiTitle size="xs">
<h2>Choose data source</h2>
<h2>
<FormattedMessage
id="xpack.maps.addLayerPanel.chooseDataSourceTitle"
defaultMessage="Choose data source"
/>
</h2>
</EuiTitle>
{this._renderSourceCards()}
</Fragment>
Expand Down Expand Up @@ -130,7 +139,10 @@ export class AddLayerPanel extends Component {
onClick={this._clearSource}
iconType="arrowLeft"
>
Change data source
<FormattedMessage
id="xpack.maps.addLayerPanel.changeDataSourceButtonLabel"
defaultMessage="Change data source"
/>
</EuiButtonEmpty>
<EuiSpacer size="s" />
<EuiPanel>
Expand All @@ -156,7 +168,12 @@ export class AddLayerPanel extends Component {
>
<EuiFlyoutHeader hasBorder className="mapLayerPanel__header">
<EuiTitle size="s">
<h2>Add layer</h2>
<h2>
<FormattedMessage
id="xpack.maps.addLayerPanel.panelTitle"
defaultMessage="Add layer"
/>
</h2>
</EuiTitle>
</EuiFlyoutHeader>

Expand All @@ -175,7 +192,10 @@ export class AddLayerPanel extends Component {
flush="left"
data-test-subj="layerAddCancelButton"
>
Cancel
<FormattedMessage
id="xpack.maps.addLayerPanel.cancelButtonLabel"
defaultMessage="Cancel"
/>
</EuiButtonEmpty>
</EuiFlexItem>
<EuiFlexItem grow={false}>
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -35,7 +35,11 @@ exports[`LayerPanel is rendered 1`] = `
onClick={[Function]}
type="button"
>
Fit
<FormattedMessage
defaultMessage="Fit"
id="xpack.maps.layerPanel.fitToBoundsButtonLabel"
values={Object {}}
/>
</EuiButtonIcon>
</EuiFlexItem>
<EuiFlexItem
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -13,6 +13,8 @@ import {
EuiSpacer,
EuiButtonEmpty,
} from '@elastic/eui';
import { FormattedMessage } from '@kbn/i18n/react';
thomasneirynck marked this conversation as resolved.
Show resolved Hide resolved

export const FlyoutFooter = ({ cancelLayerPanel, saveLayerEdits, removeLayer,
hasStateChanged }) => {
const removeBtn = (
Expand All @@ -23,19 +25,32 @@ export const FlyoutFooter = ({ cancelLayerPanel, saveLayerEdits, removeLayer,
flush="right"
data-test-subj="mapRemoveLayerButton"
>
Remove layer
<FormattedMessage
id="xpack.maps.layerPanel.footer.removeLayerButtonLabel"
defaultMessage="Remove layer"
/>
</EuiButtonEmpty>
</EuiFlexItem>
);


const cancelButtonLabel = hasStateChanged ? (<FormattedMessage
id="xpack.maps.layerPanel.footer.cancelButtonLabel"
defaultMessage="Cancel"
/>) : (<FormattedMessage
id="xpack.maps.layerPanel.footer.closeButtonLabel"
defaultMessage="Close"
/>);


return (
<EuiFlexGroup responsive={false}>
<EuiFlexItem grow={false}>
<EuiButtonEmpty
onClick={cancelLayerPanel}
flush="left"
>
{hasStateChanged ? 'Cancel' : 'Close'}
{cancelButtonLabel}
</EuiButtonEmpty>
</EuiFlexItem>
<EuiFlexItem>
Expand All @@ -49,7 +64,10 @@ export const FlyoutFooter = ({ cancelLayerPanel, saveLayerEdits, removeLayer,
onClick={saveLayerEdits}
fill
>
Save &amp; close
<FormattedMessage
id="xpack.maps.layerPanel.footer.saveAndCloseButtonLabel"
defaultMessage="Save & close"
/>
</EuiButton>
</EuiFlexItem>
</EuiFlexGroup>
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -6,13 +6,12 @@

import _ from 'lodash';
import React, { Component } from 'react';

import {
EuiFlexItem,
EuiFlexGroup,
EuiButtonIcon,
} from '@elastic/eui';

import { i18n } from '@kbn/i18n';
thomasneirynck marked this conversation as resolved.
Show resolved Hide resolved
import { JoinExpression } from './join_expression';
import { MetricsExpression } from './metrics_expression';

Expand Down Expand Up @@ -74,7 +73,10 @@ export class Join extends Component {
} catch (err) {
if (this._isMounted) {
this.setState({
loadError: `Unable to find Index pattern ${indexPatternId}`
loadError: i18n.translate('xpack.maps.layerPanel.join.noIndexPatternErrorMessage', {
defaultMessage: `Unable to find Index pattern {indexPatternId}`,
values: { indexPatternId }
})
});
}
return;
Expand Down Expand Up @@ -204,8 +206,12 @@ export class Join extends Component {
className="mapJoinItem__delete"
iconType="trash"
color="danger"
aria-label="Delete join"
title="Delete join"
aria-label={i18n.translate('xpack.maps.layerPanel.join.deleteJoinAriaLabel', {
defaultMessage: 'Delete join'
})}
title={i18n.translate('xpack.maps.layerPanel.join.deleteJoinTitle', {
defaultMessage: 'Delete join'
})}
onClick={onRemove}
/>
</EuiFlexGroup>
Expand Down
Loading