Kepler.gl is a powerful open source geospatial analysis tool for large-scale data sets.
[Enhancement] Add support for localization and Finnish translations (#994)
Joonalai6683c86fa03a
diff --git a/docs/api-reference/localization/overview.md b/docs/api-reference/localization/overview.mdnew file mode 100644index 000000000..e7a60e7db--- /dev/null+++ b/docs/api-reference/localization/overview.md@@ -0,0 +1,53 @@+# Localization++Kepler.gl supports localization trough [react-intl]. Locale is determined by `uiState.locale` value.++## Changing default language++By default the first language is English `en`. The default language can be changed by giving locale value to uiState:++```js+import {combineReducers} from 'redux';+import keplerGlReducer from 'kepler.gl/reducers';+import {LOCALES} from 'kepler.gl/constants';++const customizedKeplerGlReducer = keplerGlReducer.initialState({+ uiState: {+ // use Finnish locale+ locale: LOCALES.fi+ }+});++const reducers = combineReducers({+ keplerGl: customizedKeplerGlReducer,+ app: appReducer+});+```++## Adding new language++Let's say we want to add the Swedish language to kepler.gl. Easiest way to add translation of new language is to follow these steps:++- Find out the [language code][language-codes] for Swedish: `sv`+- Add new translation file `src/localization/sv.js` by copying `src/localization/en.js` and translating the strings+- Update `src/localization/index.js` to include new language:+ ```javascript+ import sv from './sv';+ ...+ export const messages = {+ en: en_flat,+ fi: {...en_flat, ...flattenMessages(fi)},+ sv: {...en_flat, ...flattenMessages(sv)}+ };+ ```+- Update _LOCALES_ in `src/constants/default-settings.js` to include new language:+ ```javascript+ export const LOCALES = keyMirror({+ en: null,+ fi: null,+ sv: null+ });+ ```++[react-intl]: https://github.com/formatjs/react-intl+[language-codes]: https://en.wikipedia.org/wiki/List_of_ISO_639-1_codesdiff --git a/docs/api-reference/overview.md b/docs/api-reference/overview.mdindex d7c545779..a37af8eb7 100644--- a/docs/api-reference/overview.md+++ b/docs/api-reference/overview.md@@ -19,6 +19,7 @@- [Saving and loading maps with schema manager][saving-loading-w-schema]- [Replace UI component][replace-ui-component]- [Custom Mapbox Host][custom-mapbox-host]+ - [Localization][localization]- [API]()- [Components][components]@@ -57,6 +58,7 @@ To start out with kepler.gl, you simply need to add the Kepler.gl UI component a[reducer-and-forward-dispatcher]: ./ecosystem.md#reducer-and-forward-dispatcher[actions-and-updaters]: ./ecosystem.md#actions-and-updaters[processors-and-schema-manager]: ./ecosystem.md#processors-and-schema-manager+[localization]: ./localization/overview.md[redux]: https://redux.js.org/[react]: https://reactjs.org/diff --git a/examples/demo-app/package.json b/examples/demo-app/package.jsonindex 2d672b250..b1a86a339 100644--- a/examples/demo-app/package.json+++ b/examples/demo-app/package.json@@ -19,6 +19,7 @@"react": "^16.8.4","react-copy-to-clipboard": "^5.0.1","react-dom": "^16.8.4",+ "react-intl": "^3.12.0","react-markdown": "^4.2.2","react-palm": "^3.1.2","react-redux": "^7.1.3",diff --git a/examples/demo-app/src/components/load-data-modal/load-remote-map.js b/examples/demo-app/src/components/load-data-modal/load-remote-map.jsindex 4ecd8494f..2e38499c9 100644--- a/examples/demo-app/src/components/load-data-modal/load-remote-map.js+++ b/examples/demo-app/src/components/load-data-modal/load-remote-map.js@@ -22,7 +22,9 @@import React, {Component} from 'react';import PropTypes from 'prop-types';import styled from 'styled-components';-import {CORS_LINK, LOADING_URL_MESSAGE} from '../../constants/default-settings';+import {CORS_LINK} from '../../constants/default-settings';+import {messages} from '../../constants/localization';+import {FormattedHTMLMessage, FormattedMessage, IntlProvider} from 'react-intl';const propTypes = {onLoadRemoteMap: PropTypes.func.isRequired@@ -118,38 +120,42 @@ class LoadRemoteMap extends Component {};render() {+ const {locale} = this.props;return (<div><InputForm>- <StyledDescription>Load your map using your custom URL</StyledDescription>- <StyledInputLabel>{LOADING_URL_MESSAGE}</StyledInputLabel>- <StyledInputLabel>- Examples:- <ul>- <li>https://your.map.url/map.json</li>- <li>http://your.map.url/data.csv</li>- </ul>- </StyledInputLabel>- <StyledInputLabel>- * CORS policy must be defined on your custom url domain in order to be accessible. For- more info{' '}- <a rel="noopener noreferrer" target="_blank" href={`${CORS_LINK}`}>- click here- </a>- </StyledInputLabel>- <StyledFromGroup>- <StyledInput- onChange={this.onMapUrlChange}- type="text"- placeholder="File Url"- value={this.state.dataUrl}- error={this.props.error}- />- <StyledBtn type="submit" onClick={this.onLoadRemoteMap}>- Fetch- </StyledBtn>- </StyledFromGroup>- {this.props.error && <Error error={this.props.error} url={this.props.option.dataUrl} />}+ <IntlProvider locale={locale} messages={messages[locale]}>+ <StyledDescription>+ <FormattedMessage id={'loadRemoteMap.description'} />+ </StyledDescription>+ <StyledInputLabel>+ <FormattedMessage id={'loadRemoteMap.message'} />+ </StyledInputLabel>+ <StyledInputLabel>+ <FormattedMessage id={'loadRemoteMap.examples'} />+ <ul>+ <li>https://your.map.url/map.json</li>+ <li>http://your.map.url/data.csv</li>+ </ul>+ </StyledInputLabel>+ <StyledInputLabel>+ <FormattedMessage id={'loadRemoteMap.cors'} />{' '}+ <FormattedHTMLMessage id={'loadRemoteMap.clickHere'} values={{corsLink: CORS_LINK}} />+ </StyledInputLabel>+ <StyledFromGroup>+ <StyledInput+ onChange={this.onMapUrlChange}+ type="text"+ placeholder="Url"+ value={this.state.dataUrl}+ error={this.props.error}+ />+ <StyledBtn type="submit" onClick={this.onLoadRemoteMap}>+ <FormattedMessage id={'loadRemoteMap.fetch'} />+ </StyledBtn>+ </StyledFromGroup>+ {this.props.error && <Error error={this.props.error} url={this.props.option.dataUrl} />}+ </IntlProvider></InputForm></div>);diff --git a/examples/demo-app/src/components/load-data-modal/sample-data-viewer.js b/examples/demo-app/src/components/load-data-modal/sample-data-viewer.jsindex 4faeeafe2..5d733087d 100644--- a/examples/demo-app/src/components/load-data-modal/sample-data-viewer.js+++ b/examples/demo-app/src/components/load-data-modal/sample-data-viewer.js@@ -23,6 +23,8 @@ import PropTypes from 'prop-types';import styled from 'styled-components';import {format} from 'd3-format';import {LoadingDialog} from 'kepler.gl/components';+import {FormattedMessage, IntlProvider} from 'react-intl';+import {messages} from '../../constants/localization';const numFormat = format(',');@@ -88,18 +90,25 @@ const StyledError = styled.div`margin-bottom: 16px;`;-const SampleMap = ({id, sample, onClick}) => (+const SampleMap = ({id, sample, onClick, locale}) => (<StyledSampleMap id={id} className="sample-map-gallery__item">- <div className="sample-map">- <div className="sample-map__image" onClick={onClick}>- {sample.imageUrl && <img src={sample.imageUrl} />}+ <IntlProvider locale={locale} messages={messages[locale]}>+ <div className="sample-map">+ <div className="sample-map__image" onClick={onClick}>+ {sample.imageUrl && <img src={sample.imageUrl} />}+ </div>+ <div className="sample-map__title">{sample.label}</div>+ <div className="sample-map__size">+ <FormattedMessage+ id={'sampleDataViewer.rowCount'}+ values={{rowCount: numFormat(sample.size)}}+ />+ </div>+ <StyledImageCaption className="sample-map__image__caption">+ {sample.description}+ </StyledImageCaption></div>- <div className="sample-map__title">{sample.label}</div>- <div className="sample-map__size">{`${numFormat(sample.size)} rows`}</div>- <StyledImageCaption className="sample-map__image__caption">- {sample.description}- </StyledImageCaption>- </div>+ </IntlProvider></StyledSampleMap>);@@ -117,19 +126,25 @@ export default class SampleMapGallery extends Component {}render() {- const {sampleMaps, onLoadSample, error, isMapLoading} = this.props;+ const {sampleMaps, onLoadSample, error, isMapLoading, locale} = this.props;return (<div className="sample-data-modal">{error ? (<StyledError>{error.message}</StyledError>) : isMapLoading ? (- <LoadingDialog size={64} message="Loading..." />+ <LoadingDialog size={64} />) : (<StyledSampleGallery className="sample-map-gallery">{sampleMaps.filter(sp => sp.visible).map(sp => (- <SampleMap id={sp.id} sample={sp} key={sp.id} onClick={() => onLoadSample(sp)} />+ <SampleMap+ id={sp.id}+ sample={sp}+ key={sp.id}+ onClick={() => onLoadSample(sp)}+ locale={locale}+ />))}</StyledSampleGallery>)}diff --git a/examples/demo-app/src/components/load-data-modal/sample-maps-tab.js b/examples/demo-app/src/components/load-data-modal/sample-maps-tab.jsindex aac7f635b..29049e802 100644--- a/examples/demo-app/src/components/load-data-modal/sample-maps-tab.js+++ b/examples/demo-app/src/components/load-data-modal/sample-maps-tab.js@@ -22,8 +22,10 @@ import React from 'react';import styled from 'styled-components';import {Icons} from 'kepler.gl/components';import {media} from 'kepler.gl/styles';+import {FormattedMessage, IntlProvider} from 'react-intl';import {ASSETS_URL} from '../../constants/default-settings';+import {messages} from '../../constants/localization';const StyledMapIcon = styled.div`background-image: url("${ASSETS_URL}icon-demo-map.jpg");@@ -86,17 +88,23 @@ const StyledTrySampleData = styled.div`}`;-const SampleMapsTab = ({onClick}) => (- <StyledTrySampleData className="try-sample-data">- <StyledMapIcon className="demo-map-icon" />- <div className="demo-map-title">- <div className="demo-map-label">No data ?</div>- <div className="demo-map-action" onClick={onClick}>- <span>Try sample data</span>- <Icons.ArrowRight height="16px" />- </div>- </div>- </StyledTrySampleData>-);+const SampleMapsTab = ({onClick, intl}) => {+ return (+ <StyledTrySampleData className="try-sample-data">+ <StyledMapIcon className="demo-map-icon" />+ <IntlProvider locale={intl.locale} messages={messages[intl.locale]}>+ <div className="demo-map-title">+ <div className="demo-map-label">+ <FormattedMessage id={'sampleMapsTab.noData'} />+ </div>+ <div className="demo-map-action" onClick={onClick}>+ <FormattedMessage id={'sampleMapsTab.trySampleData'} />+ <Icons.ArrowRight height="16px" />+ </div>+ </div>+ </IntlProvider>+ </StyledTrySampleData>+ );+};export default SampleMapsTab;diff --git a/examples/demo-app/src/constants/default-settings.js b/examples/demo-app/src/constants/default-settings.jsindex 904c3108e..d1129e842 100644--- a/examples/demo-app/src/constants/default-settings.js+++ b/examples/demo-app/src/constants/default-settings.js@@ -54,8 +54,6 @@ export const LOADING_METHODS = keyMirror({export const LOADING_SAMPLE_LIST_ERROR_MESSAGE = 'Not able to load sample gallery';export const LOADING_SAMPLE_ERROR_MESSAGE = 'Not able to load sample';-export const LOADING_URL_MESSAGE =- 'You can use the following formats: CSV | JSON | Kepler.gl config json. Make sure the url contains the file extension.';export const CORS_LINK = 'https://developer.mozilla.org/en-US/docs/Web/HTTP/CORS';export const DEFAULT_FEATURE_FLAGS = {diff --git a/examples/demo-app/src/constants/localization.js b/examples/demo-app/src/constants/localization.jsnew file mode 100644index 000000000..e445ca5e7--- /dev/null+++ b/examples/demo-app/src/constants/localization.js@@ -0,0 +1,55 @@+// Copyright (c) 2020 Uber Technologies, Inc.+//+// Permission is hereby granted, free of charge, to any person obtaining a copy+// of this software and associated documentation files (the "Software"), to deal+// in the Software without restriction, including without limitation the rights+// to use, copy, modify, merge, publish, distribute, sublicense, and/or sell+// copies of the Software, and to permit persons to whom the Software is+// furnished to do so, subject to the following conditions:+//+// The above copyright notice and this permission notice shall be included in+// all copies or substantial portions of the Software.+//+// THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR+// IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,+// FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE+// AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER+// LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM,+// OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN+// THE SOFTWARE.++// Add english messages here, other languages will use these+// if translations not available for every message+const en = {+ 'sampleMapsTab.noData': 'No data ?',+ 'sampleMapsTab.trySampleData': 'Try sample data',+ 'sampleDataViewer.rowCount': ' {rowCount} rows',+ 'loadRemoteMap.description': 'Load your map using your custom URL',+ 'loadRemoteMap.message':+ 'You can use the following formats: CSV | JSON | Kepler.gl config json. Make sure the url contains the file extension.',+ 'loadRemoteMap.examples': 'Examples:',+ 'loadRemoteMap.cors':+ '* CORS policy must be defined on your custom url domain in order to be accessible. For more info ',+ 'loadRemoteMap.clickHere':+ '<a rel="noopener noreferrer" target="_blank" href="{corsLink}">click here</a>',+ 'loadRemoteMap.fetch': 'Fetch'+};++export const messages = {+ en,+ fi: {+ ...en,+ 'sampleMapsTab.noData': 'Ei aineistoja?',+ 'sampleMapsTab.trySampleData': 'Kokeile testiaineistoja',+ 'sampleDataViewer.rowCount': ' {rowCount} riviä',+ 'loadRemoteMap.description': 'Lataa karttasi käyttämällä omaa urlia',+ 'loadRemoteMap.message':+ 'Voit käyttää formaatteja: CSV | JSON | Kepler.gl asetus-json. Varmista, että url sisältää tiedostopäätteen nimen.',+ 'loadRemoteMap.examples': 'Esimerkkejä:',+ 'loadRemoteMap.cors':+ '* CORS-käytäntö pitää olla määriteltynä urlin domainissa, jotta aineiston voi ladata.',+ 'loadRemoteMap.clickHere':+ '<a rel="noopener noreferrer" target="_blank" href="{corsLink}">Lisätietoja</a>',+ 'loadRemoteMap.fetch': 'Nouda'+ }+};diff --git a/examples/demo-app/src/factories/load-data-modal.js b/examples/demo-app/src/factories/load-data-modal.jsindex 9d23eed68..4c81f02ea 100644--- a/examples/demo-app/src/factories/load-data-modal.js+++ b/examples/demo-app/src/factories/load-data-modal.js@@ -57,7 +57,7 @@ const CustomLoadDataModalFactory = (...deps) => {]};- return withState([], state => ({...state.demo.app}), {+ return withState([], state => ({...state.demo.app, ...state.demo.keplerGl.map.uiState}), {onLoadSample: loadSample,onLoadRemoteMap: loadRemoteMap,loadSampleConfigurationsdiff --git a/package.json b/package.jsonindex bcacf6f04..7d6c2726c 100644--- a/package.json+++ b/package.json@@ -124,6 +124,7 @@"prop-types": "^15.6.0","react-color": "^2.17.3","react-copy-to-clipboard": "^5.0.2",+ "react-intl": "^3.12.0","react-json-pretty": "^1.7.9","react-lifecycles-compat": "^3.0.4","react-map-gl": "^5.0.3",diff --git a/src/actions/ui-state-actions.js b/src/actions/ui-state-actions.jsindex c7dcdd369..7dc9c3c95 100644--- a/src/actions/ui-state-actions.js+++ b/src/actions/ui-state-actions.js@@ -203,6 +203,16 @@ export const setExportHTMLMapMode = createAction(payload => payload);+/**+ * Set `locale` value+ * @memberof uiStateActions+ * @param {Object} locale - locale of the UI+ * @public+ */+export const setLocale = createAction(ActionTypes.SET_LOCALE, locale => ({+ locale+}));+/*** This declaration is needed to group actions in docs*/diff --git a/src/components/common/field-selector.js b/src/components/common/field-selector.jsindex 72cc5c42f..91f4df1db 100644--- a/src/components/common/field-selector.js+++ b/src/components/common/field-selector.js@@ -63,7 +63,7 @@ const FieldType = PropTypes.oneOfType([})]);-export default class FieldSelector extends Component {+class FieldSelector extends Component {static propTypes = {fields: PropTypes.oneOfType([PropTypes.array, PropTypes.arrayOf(FieldType)]),onSelect: PropTypes.func.isRequired,@@ -90,7 +90,7 @@ export default class FieldSelector extends Component {multiSelect: false,closeOnSelect: true,showToken: true,- placeholder: 'Select a field'+ placeholder: 'placeholder.selectField'};fieldsSelector = props => props.fields;@@ -141,3 +141,5 @@ export default class FieldSelector extends Component {);}}++export default FieldSelector;diff --git a/src/components/common/file-uploader/file-upload.js b/src/components/common/file-uploader/file-upload.jsindex c88b089cf..22da1769a 100644--- a/src/components/common/file-uploader/file-upload.js+++ b/src/components/common/file-uploader/file-upload.js@@ -19,21 +19,20 @@// THE SOFTWARE.import React, {Component, createRef} from 'react';-import {polyfill} from 'react-lifecycles-compat';import PropTypes from 'prop-types';import styled from 'styled-components';import UploadButton from './upload-button';-import {FileType, DragNDrop} from 'components/common/icons';+import {DragNDrop, FileType} from 'components/common/icons';import LoadingSpinner from 'components/common/loading-spinner';import FileDrop from './file-drop';import {isChrome} from 'utils/utils';import {GUIDES_FILE_FORMAT} from 'constants/user-guides';import ReactMarkdown from 'react-markdown';-// Breakpointsimport {media} from 'styles/media-breakpoints';+import {FormattedMessage, injectIntl} from 'react-intl';// File.type is not reliable if the OS does not have a// registered mapping for the extension.@@ -41,14 +40,6 @@ import {media} from 'styles/media-breakpoints';// it requires multiple files to be present.const defaultValidFileExt = ['csv', 'json', 'geojson'];-const MESSAGE = ' Drag & Drop Your File(s) Here';-const CHROME_MSG =- '*Chrome user: Limit file size to 250mb, if need to upload larger file, try Safari';-const DISCLAIMER =- '*kepler.gl is a client-side application with no server backend. Data lives only on your machine/browser. ' +- 'No information or map data is sent to any server.';-const CONFIG_UPLOAD_MESSAGE = `Upload **CSV**, **GeoJson** or saved map **Json**. Read more about [**supported file formats**](${GUIDES_FILE_FORMAT}).`;-const fileIconColor = '#D3D8E0';const LinkRenderer = props => {@@ -231,11 +222,20 @@ function FileUploadFactory() {_renderMessage() {const {errorFiles, files} = this.state;if (errorFiles.length) {- return <WarningMsg>{`File ${errorFiles.join(', ')} is not supported.`}</WarningMsg>;+ return (+ <WarningMsg>+ <FormattedMessage+ id={'fileUploader.filenNotSupported'}+ values={{errorFiles: errorFiles.join(', ')}}+ />+ </WarningMsg>+ );} else if (this.props.fileLoading && files.length) {return (<StyledMessage className="file-uploader__message">- <div className="loading-action">Uploading</div>+ <div className="loading-action">+ <FormattedMessage id={'fileUploader.uploading'} />+ </div><div>{files.map((f, i) => (<PositiveMsg key={i}>{f.name}</PositiveMsg>@@ -254,7 +254,7 @@ function FileUploadFactory() {render() {const {dragOver, files} = this.state;- const {validFileExt} = this.props;+ const {validFileExt, intl} = this.props;return (<StyledFileUpload className="file-uploader" ref={this.frame}>@@ -267,7 +267,12 @@ function FileUploadFactory() {className="file-uploader__file-drop"><StyledUploadMessage className="file-upload__message">- <ReactMarkdown source={CONFIG_UPLOAD_MESSAGE} renderers={{link: LinkRenderer}} />+ <ReactMarkdown+ source={`${intl.formatMessage({+ id: 'fileUploader.configUploadMessage'+ })}(${GUIDES_FILE_FORMAT}).`}+ renderers={{link: LinkRenderer}}+ /></StyledUploadMessage><StyledFileDrop dragOver={dragOver}><div style={{opacity: dragOver ? 0.5 : 1}}>@@ -283,23 +288,33 @@ function FileUploadFactory() {</div>{!files.length ? (<StyledDragFileWrapper>- <MsgWrapper>{MESSAGE}</MsgWrapper>- <span className="file-upload-or">or</span>- <UploadButton onUpload={this._handleFileInput}>browse your files</UploadButton>+ <MsgWrapper>+ <FormattedMessage id={'fileUploader.message'} />+ </MsgWrapper>+ <span className="file-upload-or">+ <FormattedMessage id={'fileUploader.or'} />+ </span>+ <UploadButton onUpload={this._handleFileInput}>+ <FormattedMessage id={'fileUploader.browseFiles'} />+ </UploadButton></StyledDragFileWrapper>) : null}- <StyledDisclaimer>{DISCLAIMER}</StyledDisclaimer>+ <StyledDisclaimer>+ <FormattedMessage id={'fileUploader.disclaimer'} />+ </StyledDisclaimer></StyledFileDrop></FileDrop>) : null}- <WarningMsg>{isChrome() ? CHROME_MSG : ''}</WarningMsg>+ <WarningMsg>+ {isChrome() ? <FormattedMessage id={'fileUploader.chromeMessage'} /> : ''}+ </WarningMsg></StyledFileUpload>);}}- return polyfill(FileUpload);+ return injectIntl(FileUpload);}export default FileUploadFactory;diff --git a/src/components/common/info-helper.js b/src/components/common/info-helper.jsindex 4b0f8c763..b281735f6 100644--- a/src/components/common/info-helper.js+++ b/src/components/common/info-helper.js@@ -20,9 +20,11 @@import React from 'react';import PropTypes from 'prop-types';+import {FormattedMessage, useIntl} from 'react-intl';import {Tooltip} from './styled-components';import {Docs} from 'components/common/icons';import styled from 'styled-components';+import {camelize} from 'utils/utils';const StyledInfoHelper = styled.div`align-items: center;@@ -45,11 +47,22 @@ const propTypes = {containerClass: PropTypes.string};-const InfoHelper = ({description, containerClass, id}) => (+const InfoHelper = ({description, property, containerClass, id}) => (<StyledInfoHelper className={`info-helper ${containerClass || ''}`} data-tip data-for={id}><Docs height="16px" /><Tooltip id={id} effect="solid">- <div className="info-helper__content">{description}</div>+ <div className="info-helper__content">+ {description && (+ <FormattedMessage+ id={description}+ values={{+ property: useIntl().formatMessage({+ id: property ? `property.${camelize(property)}` : 'misc.empty'+ })+ }}+ />+ )}+ </div></Tooltip></StyledInfoHelper>);diff --git a/src/components/common/item-selector/chickleted-input.js b/src/components/common/item-selector/chickleted-input.jsindex f25296983..17b3e47fe 100644--- a/src/components/common/item-selector/chickleted-input.js+++ b/src/components/common/item-selector/chickleted-input.js@@ -23,6 +23,7 @@ import PropTypes from 'prop-types';import styled from 'styled-components';import Delete from '../icons/delete';+import {FormattedMessage} from 'react-intl';const propTypes = {// required properties@@ -116,7 +117,9 @@ const ChickletedInput = ({/>))) : (- <span className={`${className} chickleted-input__placeholder`}>{placeholder}</span>+ <span className={`${className} chickleted-input__placeholder`}>+ <FormattedMessage id={placeholder} />+ </span>)}</ChickletedInputContainer>);diff --git a/src/components/common/item-selector/item-selector.js b/src/components/common/item-selector/item-selector.jsindex f943f6a88..17b2a16b1 100644--- a/src/components/common/item-selector/item-selector.js+++ b/src/components/common/item-selector/item-selector.js@@ -32,6 +32,7 @@ import {Delete} from 'components/common/icons';import DropdownList, {ListItem} from './dropdown-list';import {toArray} from 'utils/utils';+import {FormattedMessage, injectIntl} from 'react-intl';const StyledDropdownSelect = styled.div.attrs({className: 'item-selector__dropdown'@@ -107,7 +108,7 @@ class ItemSelector extends Component {fixedOptions: null,inputTheme: 'primary',multiSelect: true,- placeholder: 'Enter a value',+ placeholder: 'placeholder.enterValue',closeOnSelect: true,searchable: true,dropdownHeader: null,@@ -194,7 +195,7 @@ class ItemSelector extends Component {}};- _renderDropdown() {+ _renderDropdown(intl) {return (<DropdownWrapper placement={this.props.placement}><Typeahead@@ -207,7 +208,7 @@ class ItemSelector extends Component {options={this.props.options}filterOption={this.props.filterOption}fixedOptions={this.props.fixedOptions}- placeholder="Search"+ placeholder={intl.formatMessage({id: 'placeholder.search'})}onOptionSelected={this._selectItem}customListComponent={this.props.DropDownRenderComponent}customListHeaderComponent={this.props.DropdownHeaderComponent}@@ -236,6 +237,7 @@ class ItemSelector extends Component {error: this.props.isError,inputTheme: this.props.inputTheme};+ const intl = this.props.intl;return (<div className="item-selector">@@ -261,7 +263,7 @@ class ItemSelector extends Component {value={selected[0]}/>) : (- this.props.placeholder+ <FormattedMessage id={this.props.placeholder} />)}</DropdownSelectValue>{this.props.erasable && hasValue ? (@@ -272,11 +274,11 @@ class ItemSelector extends Component {</StyledDropdownSelect>)}{/* this part is used to built the list */}- {this.state.showTypeahead && this._renderDropdown()}+ {this.state.showTypeahead && this._renderDropdown(intl)}</div></div>);}}-export default listensToClickOutside(ItemSelector);+export default injectIntl(listensToClickOutside(ItemSelector));diff --git a/src/components/common/modal.js b/src/components/common/modal.jsindex 2c12b1c0f..5aed7730b 100644--- a/src/components/common/modal.js+++ b/src/components/common/modal.js@@ -20,6 +20,8 @@import React, {Component} from 'react';import PropTypes from 'prop-types';+import {FormattedMessage} from 'react-intl';+import styled from 'styled-components';import Modal from 'react-modal';import {Delete} from 'components/common/icons';@@ -108,13 +110,13 @@ const FooterActionWrapper = styled.div`const defaultCancelButton = {link: true,large: true,- children: 'Cancel'+ children: 'modal.button.defaultCancel'};const defaultConfirmButton = {large: true,width: '160px',- children: 'Confirm'+ children: 'modal.button.defaultConfirm'};export const ModalFooter = ({cancel, confirm, cancelButton, confirmButton}) => {@@ -124,10 +126,10 @@ export const ModalFooter = ({cancel, confirm, cancelButton, confirmButton}) => {<StyledModalFooter className="modal--footer"><FooterActionWrapper><Button className="modal--footer--cancel-button" {...cancelButtonProps} onClick={cancel}>- {cancelButtonProps.children}+ <FormattedMessage id={cancelButtonProps.children} /></Button><Button className="modal--footer--confirm-button" {...confirmButtonProps} onClick={confirm}>- {confirmButtonProps.children}+ <FormattedMessage id={confirmButtonProps.children} /></Button></FooterActionWrapper></StyledModalFooter>@@ -184,7 +186,11 @@ class ModalDialog extends Component {</CloseButton>)}<div>- {props.title && <ModalTitle className="modal--title">{props.title}</ModalTitle>}+ {props.title && (+ <ModalTitle className="modal--title">+ <FormattedMessage id={props.title} />+ </ModalTitle>+ )}<ModalContent className="modal--body">{props.children}</ModalContent>{props.footer && (<ModalFooterdiff --git a/src/components/common/toolbar-item.js b/src/components/common/toolbar-item.jsindex e2c3f022c..5c303d016 100644--- a/src/components/common/toolbar-item.js+++ b/src/components/common/toolbar-item.js@@ -20,6 +20,7 @@import React from 'react';import styled from 'styled-components';+import {FormattedMessage} from 'react-intl';const StyledDiv = styled.div.attrs({className: 'toolbar-item'@@ -41,8 +42,10 @@ const ToolbarItem = React.memo(props => (props.onClick(e);}}>- <props.icon />- <div className="toolbar-item__title">{props.label}</div>+ {props.icon && <props.icon />}+ <div className="toolbar-item__title">+ <FormattedMessage id={props.label} />+ </div></StyledDiv>));diff --git a/src/components/filters/filter-panels/polygon-filter-panel.js b/src/components/filters/filter-panels/polygon-filter-panel.jsindex c5549df44..639a55502 100644--- a/src/components/filters/filter-panels/polygon-filter-panel.js+++ b/src/components/filters/filter-panels/polygon-filter-panel.js@@ -66,7 +66,7 @@ function PolygonFilterPanelFactory(FilterPanelHeader, PolygonFilter) {<PanelHeaderActionid={filter.id}onClick={toggleFilterFeature}- tooltip={isVisible ? 'Hide Feature' : 'Show feature'}+ tooltip={isVisible ? 'tooltip.hideFeature' : 'tooltip.showFeature'}IconComponent={isVisible ? EyeSeen : EyeUnseen}active={isVisible}/>diff --git a/src/components/filters/filter-panels/time-range-filter-panel.js b/src/components/filters/filter-panels/time-range-filter-panel.jsindex a11117054..c713a8ded 100644--- a/src/components/filters/filter-panels/time-range-filter-panel.js+++ b/src/components/filters/filter-panels/time-range-filter-panel.js@@ -50,7 +50,7 @@ function TimeRangeFilterPanelFactory(FieldPanelWithFieldSelect, TimeRangeFilter){id: filter.id,onClick: enlargeFilter,- tooltip: 'Time Playback',+ tooltip: 'tooltip.timePlayback',iconComponent: Clock,active: filter.enlarged}diff --git a/src/components/filters/multi-select-filter.js b/src/components/filters/multi-select-filter.jsindex 1bbb89a90..b639a458d 100644--- a/src/components/filters/multi-select-filter.js+++ b/src/components/filters/multi-select-filter.js@@ -21,11 +21,14 @@import React from 'react';import ItemSelector from '../common/item-selector/item-selector';import {PanelLabel} from '../common/styled-components';+import {FormattedMessage} from 'react-intl';export default function MultiSelectFilterFactory() {const MultiSelectFilter = ({filter, setFilter}) => (<div>- <PanelLabel htmlFor={`filter-${filter.id}`}>Values in</PanelLabel>+ <PanelLabel htmlFor={`filter-${filter.id}`}>+ <FormattedMessage id={'misc.valuesIn'} />+ </PanelLabel><ItemSelector options={filter.domain} selectedItems={filter.value} onChange={setFilter} /></div>);diff --git a/src/components/filters/single-select-filter.js b/src/components/filters/single-select-filter.jsindex fb36b036a..852d9b9cf 100644--- a/src/components/filters/single-select-filter.js+++ b/src/components/filters/single-select-filter.js@@ -21,14 +21,17 @@import React from 'react';import ItemSelector from '../common/item-selector/item-selector';import {PanelLabel, SidePanelSection} from '../common/styled-components';+import {FormattedMessage} from 'react-intl';export default function SingleSelectFilterFactory() {const SingleSelectFilter = ({filter, setFilter}) => (<SidePanelSection>- <PanelLabel>Value equals</PanelLabel>+ <PanelLabel>+ <FormattedMessage id={'misc.valueEquals'} />+ </PanelLabel><ItemSelectorselectedItems={filter.value}- placeholder="Select a Value"+ placeholder="placeholder.selectValue"options={filter.domain}multiSelect={false}searchable={false}diff --git a/src/components/filters/time-widget.js b/src/components/filters/time-widget.jsindex 1f830313f..f4764d64f 100644--- a/src/components/filters/time-widget.js+++ b/src/components/filters/time-widget.js@@ -149,7 +149,7 @@ function TimeWidgetFactory(SpeedControl, TimeRangeFilter, FloatingTimeDisplay) {id="selected-time-widget-field"value={filter.yAxis ? filter.yAxis.name : null}onSelect={this._setFilterPlotYAxis}- placeholder="Y Axis"+ placeholder="placeholder.yAxis"erasableshowToken={false}/>diff --git a/src/components/kepler-gl.js b/src/components/kepler-gl.jsindex 12baf74ce..4fe20c4f7 100644--- a/src/components/kepler-gl.js+++ b/src/components/kepler-gl.js@@ -24,6 +24,8 @@ import {bindActionCreators} from 'redux';import styled, {ThemeProvider, withTheme} from 'styled-components';import {createSelector} from 'reselect';import {connect as keplerGlConnect} from 'connect/keplergl-connect';+import {IntlProvider} from 'react-intl';+import {messages} from '../localization';import {RootContext} from 'components/context';import * as VisStateActions from 'actions/vis-state-actions';@@ -336,69 +338,71 @@ function KeplerGlFactory(return (<RootContext.Provider value={this.root}>- <ThemeProvider theme={theme}>- <GlobalStyle- width={width}- height={height}- className="kepler-gl"- id={`kepler-gl__${id}`}- ref={this.root}- >- <NotificationPanel {...notificationPanelFields} />- {!uiState.readOnly && <SidePanel {...sideFields} />}- <div className="maps" style={{display: 'flex'}}>- {mapContainers}- </div>- {isExporting && (- <PlotContainer- width={width}- height={height}- exportImageSetting={uiState.exportImage}- mapFields={mapFields}- addNotification={uiStateActions.addNotification}- startExportingImage={uiStateActions.startExportingImage}- setExportImageDataUri={uiStateActions.setExportImageDataUri}- setExportImageError={uiStateActions.setExportImageError}+ <IntlProvider locale={uiState.locale} messages={messages[uiState.locale]}>+ <ThemeProvider theme={theme}>+ <GlobalStyle+ width={width}+ height={height}+ className="kepler-gl"+ id={`kepler-gl__${id}`}+ ref={this.root}+ >+ <NotificationPanel {...notificationPanelFields} />+ {!uiState.readOnly && <SidePanel {...sideFields} />}+ <div className="maps" style={{display: 'flex'}}>+ {mapContainers}+ </div>+ {isExporting && (+ <PlotContainer+ width={width}+ height={height}+ exportImageSetting={uiState.exportImage}+ mapFields={mapFields}+ addNotification={uiStateActions.addNotification}+ startExportingImage={uiStateActions.startExportingImage}+ setExportImageDataUri={uiStateActions.setExportImageDataUri}+ setExportImageError={uiStateActions.setExportImageError}+ />+ )}+ <BottomWidget+ filters={filters}+ datasets={datasets}+ uiState={uiState}+ layers={layers}+ animationConfig={animationConfig}+ visStateActions={visStateActions}+ sidePanelWidth={+ uiState.readOnly+ ? 0+ : this.props.sidePanelWidth + DIMENSIONS.sidePanel.margin.left+ }+ containerW={containerW}/>- )}- <BottomWidget- filters={filters}- datasets={datasets}- uiState={uiState}- layers={layers}- animationConfig={animationConfig}- visStateActions={visStateActions}- sidePanelWidth={- uiState.readOnly- ? 0- : this.props.sidePanelWidth + DIMENSIONS.sidePanel.margin.left- }- containerW={containerW}- />- <ModalContainer- mapStyle={mapStyle}- visState={visState}- mapState={mapState}- uiState={uiState}- mapboxApiAccessToken={mapboxApiAccessToken}- mapboxApiUrl={mapboxApiUrl}- visStateActions={visStateActions}- uiStateActions={uiStateActions}- mapStyleActions={mapStyleActions}- providerActions={providerActions}- rootNode={this.root.current}- containerW={containerW}- containerH={mapState.height}- providerState={this.props.providerState}- // User defined cloud provider props- cloudProviders={this.props.cloudProviders}- onExportToCloudSuccess={this.props.onExportToCloudSuccess}- onLoadCloudMapSuccess={this.props.onLoadCloudMapSuccess}- onLoadCloudMapError={this.props.onLoadCloudMapError}- onExportToCloudError={this.props.onExportToCloudError}- />- </GlobalStyle>- </ThemeProvider>+ <ModalContainer+ mapStyle={mapStyle}+ visState={visState}+ mapState={mapState}+ uiState={uiState}+ mapboxApiAccessToken={mapboxApiAccessToken}+ mapboxApiUrl={mapboxApiUrl}+ visStateActions={visStateActions}+ uiStateActions={uiStateActions}+ mapStyleActions={mapStyleActions}+ providerActions={providerActions}+ rootNode={this.root.current}+ containerW={containerW}+ containerH={mapState.height}+ providerState={this.props.providerState}+ // User defined cloud provider props+ cloudProviders={this.props.cloudProviders}+ onExportToCloudSuccess={this.props.onExportToCloudSuccess}+ onLoadCloudMapSuccess={this.props.onLoadCloudMapSuccess}+ onLoadCloudMapError={this.props.onLoadCloudMapError}+ onExportToCloudError={this.props.onExportToCloudError}+ />+ </GlobalStyle>+ </ThemeProvider>+ </IntlProvider></RootContext.Provider>);}diff --git a/src/components/map-container.js b/src/components/map-container.jsindex b04332dda..4121a9eb5 100644--- a/src/components/map-container.js+++ b/src/components/map-container.js@@ -426,6 +426,7 @@ export default function MapContainerFactory(MapPopover, MapControl) {mapboxApiUrl,mapControls,uiState,+ uiStateActions,visStateActions,editor,index@@ -464,11 +465,13 @@ export default function MapContainerFactory(MapPopover, MapControl) {scale={mapState.scale || 1}top={0}editor={editor}+ locale={uiState.locale}onTogglePerspective={mapStateActions.togglePerspective}onToggleSplitMap={mapStateActions.toggleSplitMap}onMapToggleLayer={this._handleMapToggleLayer}onToggleMapControl={this._toggleMapControl}onSetEditorMode={visStateActions.setEditorMode}+ onSetLocale={uiStateActions.setLocale}onToggleEditorVisibility={visStateActions.toggleEditorVisibility}/><MapComponentdiff --git a/src/components/map/map-control.js b/src/components/map/map-control.jsindex 280d55ff0..59d0f9e41 100644--- a/src/components/map/map-control.js+++ b/src/components/map/map-control.js@@ -18,33 +18,34 @@// OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN// THE SOFTWARE.-import React, {Component} from 'react';+import React, {Component, useCallback} from 'react';import PropTypes from 'prop-types';import {createSelector} from 'reselect';import styled from 'styled-components';+import {FormattedMessage} from 'react-intl';import classnames from 'classnames';-import {Tooltip, IconRoundSmall, MapControlButton} from 'components/common/styled-components';+import {IconRoundSmall, MapControlButton, Tooltip} from 'components/common/styled-components';import MapLayerSelector from 'components/common/map-layer-selector';import KeplerGlLogo from 'components/common/logo';import MapLegend from './map-legend';import {Close,- Split,- Legend,Cube3d,+ CursorClick,Delete,- Layers,DrawPolygon,+ EyeSeen,+ EyeUnseen,+ Layers,+ Legend,Polygon,Rectangle,- CursorClick,- EyeSeen,- EyeUnseen+ Split} from 'components/common/icons';import VerticalToolbar from 'components/common/vertical-toolbar';import ToolbarItem from 'components/common/toolbar-item';-import {EDITOR_MODES} from 'constants/default-settings';+import {EDITOR_MODES, LOCALES} from 'constants/default-settings';const StyledMapControl = styled.div`right: 0;@@ -101,7 +102,9 @@ ActionPanel.displayName = 'ActionPanel';const MapControlTooltip = React.memo(({id, message}) => (<Tooltip id={id} place="left" effect="solid">- <span>{message}</span>+ <span>+ <FormattedMessage id={message} />+ </span></Tooltip>));@@ -109,7 +112,9 @@ MapControlTooltip.displayName = 'MapControlTooltip';const MapLegendTooltip = ({id, message}) => (<Tooltip id={id} place="left" effect="solid">- <span>{message}</span>+ <span>+ <FormattedMessage id={message} />+ </span></Tooltip>);@@ -128,11 +133,11 @@ const LayerSelectorPanel = React.memo(({items, onMapToggleLayer, isActive, toggl<Layers height="22px" /><MapControlTooltipid="toggle-layer"- message={isActive ? 'Hide layer panel' : 'Show layer panel'}+ message={isActive ? 'tooltip.hideLayerPanel' : 'tooltip.showLayerPanel'}/></MapControlButton>) : (- <MapControlPanel header="Visible layers" onClick={toggleMenuPanel}>+ <MapControlPanel header="header.visibleLayers" onClick={toggleMenuPanel}><MapLayerSelector layers={items} onMapToggleLayer={onMapToggleLayer} /></MapControlPanel>)@@ -152,7 +157,9 @@ const MapControlPanel = React.memo(({children, header, onClick, scale = 1, isExp{isExport ? (<KeplerGlLogo version={false} appName="kepler.gl" />) : (- <span style={{verticalAlign: 'middle'}}>{header}</span>+ <span style={{verticalAlign: 'middle'}}>+ <FormattedMessage id={header} />+ </span>)}{isExport ? null : (<IconRoundSmall className="close-map-control-item" onClick={onClick}>@@ -179,12 +186,12 @@ const MapLegendPanel = ({layers, isActive, scale, onToggleMenuPanel, isExport})}}><Legend height="22px" />- <MapLegendTooltip id="show-legend" message={'show legend'} />+ <MapLegendTooltip id="show-legend" message={'tooltip.showLegend'} /></MapControlButton>) : (<MapControlPanelscale={scale}- header={'Layer Legend'}+ header={'header.layerLegend'}onClick={onToggleMenuPanel}isExport={isExport}>@@ -209,7 +216,7 @@ const SplitMapButton = React.memo(({isSplit, mapIndex, onToggleSplitMap}) => ({isSplit ? <Delete height="18px" /> : <Split height="18px" />}<MapControlTooltipid="action-toggle"- message={isSplit ? 'Close current panel' : 'Switch to dual map view'}+ message={isSplit ? 'tooltip.closePanel' : 'tooltip.switchToDualView'}/></MapControlButton>));@@ -227,7 +234,10 @@ const Toggle3dButton = React.memo(({dragRotate, onTogglePerspective}) => (data-for="action-3d"><Cube3d height="22px" />- <MapControlTooltip id="action-3d" message={dragRotate ? 'Disable 3D Map' : '3D Map'} />+ <MapControlTooltip+ id="action-3d"+ message={dragRotate ? 'tooltip.disable3DMap' : 'tooltip.3DMap'}+ /></MapControlButton>));@@ -247,7 +257,7 @@ const MapDrawPanel = React.memo(<ToolbarItemclassName="edit-feature"onClick={() => onSetEditorMode(EDITOR_MODES.EDIT)}- label="select"+ label="toolbar.select"iconHeight="22px"icon={CursorClick}active={editor.mode === EDITOR_MODES.EDIT}@@ -255,7 +265,7 @@ const MapDrawPanel = React.memo(<ToolbarItemclassName="draw-feature"onClick={() => onSetEditorMode(EDITOR_MODES.DRAW_POLYGON)}- label="polygon"+ label="toolbar.polygon"iconHeight="22px"icon={Polygon}active={editor.mode === EDITOR_MODES.DRAW_POLYGON}@@ -263,7 +273,7 @@ const MapDrawPanel = React.memo(<ToolbarItemclassName="draw-rectangle"onClick={() => onSetEditorMode(EDITOR_MODES.DRAW_RECTANGLE)}- label="rectangle"+ label="toolbar.rectangle"iconHeight="22px"icon={Rectangle}active={editor.mode === EDITOR_MODES.DRAW_RECTANGLE}@@ -271,7 +281,7 @@ const MapDrawPanel = React.memo(<ToolbarItemclassName="toggle-features"onClick={onToggleEditorVisibility}- label={editor.visible ? 'hide' : 'show'}+ label={editor.visible ? 'toolbar.hide' : 'toolbar.show'}iconHeight="22px"icon={editor.visible ? EyeSeen : EyeUnseen}/>@@ -287,7 +297,7 @@ const MapDrawPanel = React.memo(data-for="map-draw"><DrawPolygon height="22px" />- <MapControlTooltip id="map-draw" message="Draw on map" />+ <MapControlTooltip id="map-draw" message="tooltip.DrawOnMap" /></MapControlButton></div>);@@ -296,6 +306,49 @@ const MapDrawPanel = React.memo(MapDrawPanel.displayName = 'MapDrawPanel';+const LocalePanel = React.memo(+ ({availableLocales, isActive, onToggleMenuPanel, onSetLocale, activeLocale}) => {+ const onClickItem = useCallback(+ locale => {+ onSetLocale(locale);+ },+ [onSetLocale]+ );++ const onClickButton = useCallback(+ e => {+ e.preventDefault();+ onToggleMenuPanel();+ },+ [onToggleMenuPanel]+ );+ const getLabel = useCallback(locale => `toolbar.${locale}`, []);++ return (+ <div style={{position: 'relative'}}>+ {isActive ? (+ <StyledToolbar show={isActive}>+ {availableLocales.map(locale => (+ <ToolbarItem+ key={locale}+ onClick={() => onClickItem(locale)}+ label={getLabel(locale)}+ active={activeLocale === locale}+ />+ ))}+ </StyledToolbar>+ ) : null}+ <MapControlButton onClick={onClickButton} active={isActive} data-tip data-for="locale">+ {activeLocale.toUpperCase()}+ <MapControlTooltip id="locale" message="tooltip.selectLocale" />+ </MapControlButton>+ </div>+ );+ }+);++LocalePanel.displayName = 'LocalePanel';+const MapControlFactory = () => {class MapControl extends Component {static propTypes = {@@ -312,6 +365,8 @@ const MapControlFactory = () => {onSetEditorMode: PropTypes.func.isRequired,onToggleEditorVisibility: PropTypes.func.isRequired,top: PropTypes.number.isRequired,+ onSetLocale: PropTypes.func.isRequired,+ locale: PropTypes.string.isRequired,// optionalreadOnly: PropTypes.bool,@@ -357,7 +412,8 @@ const MapControlFactory = () => {onToggleMapControl,editor,scale,- readOnly+ readOnly,+ locale} = this.props;const {@@ -365,7 +421,8 @@ const MapControlFactory = () => {mapLegend = {},toggle3d = {},splitMap = {},- mapDraw = {}+ mapDraw = {},+ mapLocale = {}} = mapControls;return (@@ -425,6 +482,18 @@ const MapControlFactory = () => {/></ActionPanel>) : null}++ {mapLocale.show ? (+ <ActionPanel key={5}>+ <LocalePanel+ isActive={mapLocale.active}+ activeLocale={locale}+ availableLocales={Object.keys(LOCALES)}+ onSetLocale={this.props.onSetLocale}+ onToggleMenuPanel={() => onToggleMapControl('mapLocale')}+ />+ </ActionPanel>+ ) : null}</StyledMapControl>);}diff --git a/src/components/map/map-legend.js b/src/components/map/map-legend.jsindex 45c4b7078..18a55ae3a 100644--- a/src/components/map/map-legend.js+++ b/src/components/map/map-legend.js@@ -23,8 +23,8 @@ import PropTypes from 'prop-types';import styled from 'styled-components';import {rgb} from 'd3-color';import ColorLegend from 'components/common/color-legend';-import {DIMENSIONS, CHANNEL_SCALES} from 'constants/default-settings';-import {camelToTitle} from 'utils/utils';+import {CHANNEL_SCALES, DIMENSIONS} from 'constants/default-settings';+import {FormattedMessage} from 'react-intl';export const StyledMapControlLegend = styled.div`padding: 10px 0 10px ${props => props.theme.mapControl.padding}px;@@ -64,17 +64,23 @@ export const StyledMapControlLegend = styled.div`}`;-export const VisualChannelMetric = ({name}) => (- <div className="legend--layer__title">- <span className="legend--layer_by">by </span>- <span className="legend--layer_color_field">{name}</span>- </div>-);+export const VisualChannelMetric = ({name}) => {+ return (+ <div className="legend--layer__title">+ <span className="legend--layer_by">by </span>+ <span className="legend--layer_color_field">+ <FormattedMessage id={name} />+ </span>+ </div>+ );+};export const LayerSizeLegend = ({label, name}) => (<div className="legend--layer_size-schema"><p>- <span className="legend--layer_by">{label}</span>+ <span className="legend--layer_by">+ <FormattedMessage id={label} />+ </span></p><VisualChannelMetric name={name} /></div>@@ -121,7 +127,9 @@ export const LayerColorLegend = React.memo(({description, config, width, colorChreturn (<div>- <div className="legend--layer_type">{camelToTitle(key)}</div>+ <div className="legend--layer_type">+ <FormattedMessage id={`layer.${key}`} />+ </div><div className="legend--layer_color-schema"><div>{enableColorBy ? <VisualChannelMetric name={enableColorBy} /> : null}diff --git a/src/components/modal-container.js b/src/components/modal-container.jsindex 58856e375..8f224e665 100644--- a/src/components/modal-container.js+++ b/src/components/modal-container.js@@ -286,7 +286,7 @@ export default function ModalContainerFactory(<DeleteDatasetModal dataset={datasets[datasetKeyToRemove]} layers={layers} />);modalProps = {- title: 'Delete Dataset',+ title: 'modal.title.deleteDataset',cssStyle: smallModalCss,footer: true,onConfirm: () => this._deleteDataset(datasetKeyToRemove),@@ -294,7 +294,7 @@ export default function ModalContainerFactory(confirmButton: {negative: true,large: true,- children: 'Delete'+ children: 'modal.button.delete'}};}@@ -314,7 +314,7 @@ export default function ModalContainerFactory(/>);modalProps = {- title: 'Add Data To Map',+ title: 'modal.title.addDataToMap',cssStyle: LoadDataModalStyle,footer: false,onConfirm: this._closeModal@@ -330,14 +330,14 @@ export default function ModalContainerFactory(/>);modalProps = {- title: 'Export Image',+ title: 'modal.title.exportImage',footer: true,onCancel: this._closeModal,onConfirm: this._onExportImage,confirmButton: {large: true,disabled: uiState.exportImage.exporting,- children: 'Download'+ children: 'modal.button.download'}};break;@@ -354,13 +354,13 @@ export default function ModalContainerFactory(/>);modalProps = {- title: 'Export Data',+ title: 'modal.title.exportData',footer: true,onCancel: this._closeModal,onConfirm: this._onExportData,confirmButton: {large: true,- children: 'Export'+ children: 'modal.button.export'}};break;@@ -381,13 +381,13 @@ export default function ModalContainerFactory(/>);modalProps = {- title: 'Export Map',+ title: 'modal.title.exportMap',footer: true,onCancel: this._closeModal,onConfirm: this._onExportMap,confirmButton: {large: true,- children: 'Export'+ children: 'modal.button.export'}};break;@@ -403,14 +403,14 @@ export default function ModalContainerFactory(/>);modalProps = {- title: 'Add Custom Mapbox Style',+ title: 'modal.title.addCustomMapboxStyle',footer: true,onCancel: this._closeModal,onConfirm: this._onAddCustomMapStyle,confirmButton: {large: true,disabled: !mapStyle.inputStyle.style,- children: 'Add Style'+ children: 'modal.button.addStyle'}};break;@@ -427,7 +427,7 @@ export default function ModalContainerFactory(/>);modalProps = {- title: 'Save Map',+ title: 'modal.title.saveMap',footer: true,onCancel: this._closeModal,onConfirm: () => this._onSaveMap(false),@@ -437,7 +437,7 @@ export default function ModalContainerFactory(uiState.exportImage.exporting ||!isValidMapInfo(visState.mapInfo) ||!providerState.currentProvider,- children: 'Save'+ children: 'modal.button.save'}};break;@@ -479,7 +479,7 @@ export default function ModalContainerFactory(/>);modalProps = {- title: 'Share URL',+ title: 'modal.title.shareURL',onCancel: this._onCloseSaveMap};break;diff --git a/src/components/modals/add-map-style-modal.js b/src/components/modals/add-map-style-modal.jsindex bc55c753b..176192e28 100644--- a/src/components/modals/add-map-style-modal.js+++ b/src/components/modals/add-map-style-modal.js@@ -35,6 +35,7 @@ import {media} from 'styles/media-breakpoints';// Utilsimport {transformRequest} from 'utils/map-style-utils/mapbox-utils';+import {FormattedMessage, injectIntl} from 'react-intl';const MapH = 190;const MapW = 264;@@ -162,7 +163,7 @@ function AddMapStyleModalFactory() {};render() {- const {inputStyle, mapState, mapboxApiUrl} = this.props;+ const {inputStyle, mapState, mapboxApiUrl, intl} = this.props;const mapboxApiAccessToken = inputStyle.accessToken || this.props.mapboxApiAccessToken;const mapProps = {@@ -179,52 +180,54 @@ function AddMapStyleModalFactory() {<StyledModalVerticalPanel><StyledModalSection><div className="modal-section-title">- 1. Publish your style at mapbox or provide access token+ <FormattedMessage id={'modal.addStyle.publishTitle'} /></div><div className="modal-section-subtitle">- You can create your own map style at+ {intl.formatMessage({id: 'modal.addStyle.publishSubtitle1'})}<InlineLink target="_blank" href="https://www.mapbox.com/studio/styles/">{' '}mapbox</InlineLink>{' '}- and+ {intl.formatMessage({id: 'modal.addStyle.publishSubtitle2'})}<InlineLinktarget="_blank"href="https://www.mapbox.com/help/studio-manual-publish/">{' '}- publish+ {intl.formatMessage({id: 'modal.addStyle.publishSubtitle3'})}</InlineLink>{' '}- it.+ {intl.formatMessage({id: 'modal.addStyle.publishSubtitle4'})}</div><div className="modal-section-subtitle">- To use private style, paste your+ {intl.formatMessage({id: 'modal.addStyle.publishSubtitle5'})}<InlineLinktarget="_blank"href="https://www.mapbox.com/help/how-access-tokens-work/">{' '}- access token+ {intl.formatMessage({id: 'modal.addStyle.publishSubtitle6'})}</InlineLink>{' '}- here. *kepler.gl is a client-side application, data stays in your browser..+ {intl.formatMessage({id: 'modal.addStyle.publishSubtitle7'})}</div><InputLighttype="text"value={inputStyle.accessToken || ''}onChange={({target: {value}}) => this.props.inputMapStyle({accessToken: value})}- placeholder="e.g. pk.abcdefg.xxxxxx"+ placeholder={intl.formatMessage({id: 'modal.addStyle.exampleToken'})}/></StyledModalSection><StyledModalSection>- <div className="modal-section-title">2. Paste style url</div>+ <div className="modal-section-title">+ <FormattedMessage id={'modal.addStyle.pasteTitle'} />+ </div><div className="modal-section-subtitle">- What is a+ {intl.formatMessage({id: 'modal.addStyle.pasteSubtitle1'})}<InlineLinktarget="_blank"href="https://www.mapbox.com/help/studio-manual-publish/#style-url">{' '}- style URL+ {intl.formatMessage({id: 'modal.addStyle.pasteSubtitle2'})}</InlineLink></div><InputLight@@ -235,7 +238,9 @@ function AddMapStyleModalFactory() {/></StyledModalSection><StyledModalSection>- <div className="modal-section-title">3. Name your style</div>+ <div className="modal-section-title">+ <FormattedMessage id={'modal.addStyle.namingTitle'} />+ </div><InputLighttype="text"value={inputStyle.label || ''}@@ -278,7 +283,7 @@ function AddMapStyleModalFactory() {}}- return polyfill(AddMapStyleModal);+ return injectIntl(polyfill(AddMapStyleModal));}export default AddMapStyleModalFactory;diff --git a/src/components/modals/delete-data-modal.js b/src/components/modals/delete-data-modal.jsindex 1cb447215..41e30e826 100644--- a/src/components/modals/delete-data-modal.js+++ b/src/components/modals/delete-data-modal.js@@ -21,6 +21,7 @@import React from 'react';import styled from 'styled-components';import DatasetLabel from 'components/common/dataset-label';+import {FormattedMessage} from 'react-intl';const StyledMsg = styled.div`margin-top: 24px;@@ -34,7 +35,10 @@ export const DeleteDatasetModal = ({dataset = {}, layers = []}) => {<div className="delete-dataset-modal"><DatasetLabel dataset={dataset} /><StyledMsg className="delete-dataset-msg">- {`you are going to delete this dataset. It will affect ${currDatasetLayers.length} layers`}+ <FormattedMessage+ id={'modal.deleteData.warning'}+ values={{length: currDatasetLayers.length}}+ /></StyledMsg></div>);diff --git a/src/components/modals/export-data-modal.js b/src/components/modals/export-data-modal.jsindex 0f6896543..2401644d5 100644--- a/src/components/modals/export-data-modal.js+++ b/src/components/modals/export-data-modal.js@@ -24,11 +24,12 @@ import PropTypes from 'prop-types';import {EXPORT_DATA_TYPE_OPTIONS} from 'constants/default-settings';import {FileType} from 'components/common/icons';import {- StyledModalContent,StyledExportSection,StyledFilteredOption,+ StyledModalContent,StyledType} from 'components/common/styled-components';+import {FormattedMessage, injectIntl} from 'react-intl';const propTypes = {datasets: PropTypes.object.isRequired,@@ -43,10 +44,13 @@ const propTypes = {onChangeExportFiltered: PropTypes.func.isRequired};-const getDataRowCount = (datasets, selectedDataset, filtered) => {+const getDataRowCount = (datasets, selectedDataset, filtered, intl) => {const selectedData = datasets[selectedDataset];if (!selectedData) {- return `${Object.keys(datasets).length} Files `;+ return intl.formatMessage(+ {id: 'modal.exportData.fileCount'},+ {fileCount: Object.keys(datasets).length}+ );}const {allData, filteredIdxCPU} = selectedData;@@ -56,7 +60,10 @@ const getDataRowCount = (datasets, selectedDataset, filtered) => {const rowCount = filtered ? filteredIdxCPU.length : allData.length;- return `${rowCount.toLocaleString()} Rows`;+ return intl.formatMessage(+ {id: 'modal.exportData.rowCount'},+ {rowCount: rowCount.toLocaleString()}+ );};const ExportDataModalFactory = () => {@@ -78,7 +85,8 @@ const ExportDataModalFactory = () => {dataType,filtered,onChangeExportDataType,- onChangeExportFiltered+ onChangeExportFiltered,+ intl} = this.props;return (@@ -86,23 +94,33 @@ const ExportDataModalFactory = () => {<div><StyledExportSection><div className="description">- <div className="title">Dataset</div>- <div className="subtitle">Choose the datasets you want to export</div>+ <div className="title">+ <FormattedMessage id={'modal.exportData.datasetTitle'} />+ </div>+ <div className="subtitle">+ <FormattedMessage id={'modal.exportData.datasetSubtitle'} />+ </div></div><div className="selection"><select value={selectedDataset} onChange={this._onSelectDataset}>- {['All'].concat(Object.keys(datasets)).map(d => (- <option key={d} value={d}>- {(datasets[d] && datasets[d].label) || d}- </option>- ))}+ {[intl.formatMessage({id: 'modal.exportData.allDatasets'})]+ .concat(Object.keys(datasets))+ .map(d => (+ <option key={d} value={d}>+ {(datasets[d] && datasets[d].label) || d}+ </option>+ ))}</select></div></StyledExportSection><StyledExportSection><div className="description">- <div className="title">Data Type</div>- <div className="subtitle">Choose the type of data you want to export</div>+ <div className="title">+ <FormattedMessage id={'modal.exportData.dataTypeTitle'} />+ </div>+ <div className="subtitle">+ <FormattedMessage id={'modal.exportData.dataTypeSubtitle'} />+ </div></div><div className="selection">{EXPORT_DATA_TYPE_OPTIONS.map(op => (@@ -119,9 +137,11 @@ const ExportDataModalFactory = () => {</StyledExportSection><StyledExportSection><div className="description">- <div className="title">Filter Data</div>+ <div className="title">+ <FormattedMessage id={'modal.exportData.dataTypeTitle'} />+ </div><div className="subtitle">- You can choose exporting original data or filtered data+ <FormattedMessage id={'modal.exportData.filterDataSubtitle'} /></div></div><div className="selection">@@ -130,9 +150,11 @@ const ExportDataModalFactory = () => {selected={!filtered}onClick={() => onChangeExportFiltered(false)}>- <div className="filter-option-title">Unfiltered Data</div>+ <div className="filter-option-title">+ <FormattedMessage id={'modal.exportData.unfilteredData'} />+ </div><div className="filter-option-subtitle">- {getDataRowCount(datasets, selectedDataset, false)}+ {getDataRowCount(datasets, selectedDataset, false, intl)}</div></StyledFilteredOption><StyledFilteredOption@@ -140,9 +162,11 @@ const ExportDataModalFactory = () => {selected={filtered}onClick={() => onChangeExportFiltered(true)}>- <div className="filter-option-title">Filtered Data</div>+ <div className="filter-option-title">+ <FormattedMessage id={'modal.exportData.filteredData'} />+ </div><div className="filter-option-subtitle">- {getDataRowCount(datasets, selectedDataset, true)}+ {getDataRowCount(datasets, selectedDataset, true, intl)}</div></StyledFilteredOption></div>@@ -153,7 +177,7 @@ const ExportDataModalFactory = () => {}}ExportDataModal.propTypes = propTypes;- return ExportDataModal;+ return injectIntl(ExportDataModal);};export default ExportDataModalFactory;diff --git a/src/components/modals/export-image-modal.js b/src/components/modals/export-image-modal.jsindex cbc4f2d17..254eb4e8d 100644--- a/src/components/modals/export-image-modal.js+++ b/src/components/modals/export-image-modal.js@@ -31,6 +31,7 @@ import {import {StyledModalContent, SelectionButton} from 'components/common/styled-components';import Switch from 'components/common/switch';+import {FormattedMessage, injectIntl} from 'react-intl';const ImageOptionList = styled.div`display: flex;@@ -87,15 +88,17 @@ const ExportImageModalFactory = () => {}render() {- const {exportImage, onUpdateSetting} = this.props;+ const {exportImage, onUpdateSetting, intl} = this.props;const {legend, ratio, resolution} = exportImage;return (<StyledModalContent className="export-image-modal"><ImageOptionList><div className="image-option-section">- <div className="image-option-section-title">Ratio</div>- Choose the ratio for various usages.+ <div className="image-option-section-title">+ <FormattedMessage id={'modal.exportImage.ratioTitle'} />+ </div>+ <FormattedMessage id={'modal.exportImage.ratioDescription'} /><div className="button-list">{EXPORT_IMG_RATIO_OPTIONS.filter(op => !op.hidden).map(op => (<SelectionButton@@ -103,14 +106,16 @@ const ExportImageModalFactory = () => {selected={ratio === op.id}onClick={() => onUpdateSetting({ratio: op.id})}>- {op.label}+ <FormattedMessage id={op.label} /></SelectionButton>))}</div></div><div className="image-option-section">- <div className="image-option-section-title">Resolution</div>- High resolution is better for prints.+ <div className="image-option-section-title">+ <FormattedMessage id={'modal.exportImage.resolutionTitle'} />+ </div>+ <FormattedMessage id={'modal.exportImage.resolutionDescription'} /><div className="button-list">{EXPORT_IMG_RESOLUTION_OPTIONS.map(op => (<SelectionButton@@ -124,12 +129,14 @@ const ExportImageModalFactory = () => {</div></div><div className="image-option-section">- <div className="image-option-section-title">Map Legend</div>+ <div className="image-option-section-title">+ <FormattedMessage id={'modal.exportImage.mapLegendTitle'} />+ </div><Switchtype="checkbox"id="add-map-legend"checked={legend}- label="Add legend on map"+ label={intl.formatMessage({id: 'modal.exportImage.mapLegendAdd'})}onChange={() => onUpdateSetting({legend: !legend})}/></div>@@ -140,7 +147,7 @@ const ExportImageModalFactory = () => {}}- return ExportImageModal;+ return injectIntl(ExportImageModal);};export default ExportImageModalFactory;diff --git a/src/components/modals/export-map-modal/export-html-map.js b/src/components/modals/export-map-modal/export-html-map.jsindex 78179a7b0..fbd40c50a 100644--- a/src/components/modals/export-map-modal/export-html-map.js+++ b/src/components/modals/export-map-modal/export-html-map.js@@ -22,13 +22,10 @@ import React from 'react';import PropTypes from 'prop-types';import {StyledExportSection, StyledType} from 'components/common/styled-components';import {StyledExportMapSection, StyledWarning, ExportMapLink} from './components';-import {- DISCLAIMER,- EXPORT_HTML_MAP_MODE_OPTIONS,- TOKEN_MISUSE_WARNING-} from 'constants/default-settings';+import {EXPORT_HTML_MAP_MODE_OPTIONS} from 'constants/default-settings';import {GITHUB_EXPORT_HTML_MAP, GITHUB_EXPORT_HTML_MAP_MODES} from 'constants/user-guides';import styled from 'styled-components';+import {FormattedMessage, injectIntl} from 'react-intl';const NO_OP = () => {};@@ -71,38 +68,56 @@ const exportHtmlPropTypes = {};const ExportHtmlMap = React.memo(- ({onChangeExportMapHTMLMode = NO_OP, onEditUserMapboxAccessToken = NO_OP, options = {}}) => (+ ({+ onChangeExportMapHTMLMode = NO_OP,+ onEditUserMapboxAccessToken = NO_OP,+ options = {},+ intl+ }) => (<div><StyledExportMapSection><div className="description" />- <div className="selection">Export your map into an interactive html file.</div>+ <div className="selection">+ <FormattedMessage id={'modal.exportMap.html.selection'} />+ </div></StyledExportMapSection><ExportMapStyledExportSection className="export-map-modal__html-options"><div className="description">- <div className="title">Mapbox access token</div>- <div className="subtitle">Use your own Mapbox access token in the html (optional)</div>+ <div className="title">+ <FormattedMessage id={'modal.exportMap.html.tokenTitle'} />+ </div>+ <div className="subtitle">+ <FormattedMessage id={'modal.exportMap.html.tokenSubtitle'} />+ </div></div><div className="selection"><StyledInputonChange={e => onEditUserMapboxAccessToken(e.target.value)}type="text"- placeholder="Paste your Mapbox access token"+ placeholder={intl.formatMessage({id: 'modal.exportMap.html.tokenPlaceholder'})}value={options ? options.userMapboxToken : ''}/><div className="disclaimer">- <StyledWarning>{TOKEN_MISUSE_WARNING}</StyledWarning>- <span>{DISCLAIMER}</span>+ <StyledWarning>+ <FormattedMessage id={'modal.exportMap.html.tokenMisuseWarning'} />+ </StyledWarning>+ <FormattedMessage id={'modal.exportMap.html.tokenDisclaimer'} /><ExportMapLink href={GITHUB_EXPORT_HTML_MAP}>- How to update an existing map token.+ <FormattedMessage id={'modal.exportMap.html.tokenUpdate'} /></ExportMapLink></div></div></ExportMapStyledExportSection><ExportMapStyledExportSection><div className="description">- <div className="title">Map Mode</div>+ <div className="title">+ <FormattedMessage id={'modal.exportMap.html.modeTitle'} />+ </div><div className="subtitle">- Select the app mode. More <a href={GITHUB_EXPORT_HTML_MAP_MODES}>info</a>+ <FormattedMessage id={'modal.exportMap.html.modeSubtitle1'} />+ <a href={GITHUB_EXPORT_HTML_MAP_MODES}>+ <FormattedMessage id={'modal.exportMap.html.modeSubtitle2'} />+ </a></div></div><div className="selection">@@ -114,7 +129,12 @@ const ExportHtmlMap = React.memo(onClick={() => mode.available && onChangeExportMapHTMLMode(mode.id)}><img src={mode.url} alt="" />- <p>Allow users to {mode.label} the map</p>+ <p>+ <FormattedMessage+ id={'modal.exportMap.html.modeDescription'}+ values={{mode: intl.formatMessage({id: mode.label})}}+ />+ </p></BigStyledTile>))}</div>@@ -127,6 +147,6 @@ ExportHtmlMap.propTypes = exportHtmlPropTypes;ExportHtmlMap.displayName = 'ExportHtmlMap';-const ExportHtmlMapFactory = () => ExportHtmlMap;+const ExportHtmlMapFactory = () => injectIntl(ExportHtmlMap);export default ExportHtmlMapFactory;diff --git a/src/components/modals/export-map-modal/export-json-map.js b/src/components/modals/export-map-modal/export-json-map.jsindex ad63dd6b3..5ee25777f 100644--- a/src/components/modals/export-map-modal/export-json-map.js+++ b/src/components/modals/export-map-modal/export-json-map.js@@ -22,10 +22,10 @@ import React from 'react';import PropTypes from 'prop-types';import JSONPretty from 'react-json-pretty';import {GITHUB_ADD_DATA_TO_MAP} from 'constants/user-guides';-import {MAP_CONFIG_DESCRIPTION} from 'constants/default-settings';import styled from 'styled-components';import {StyledExportSection} from 'components/common/styled-components';import {StyledExportMapSection, StyledWarning, ExportMapLink} from './components';+import {FormattedMessage} from 'react-intl';const StyledJsonExportSection = styled(StyledExportSection)`.note {@@ -62,15 +62,16 @@ const ExportJsonMap = React.memo(({config = {}}) => (<StyledExportMapSection><div className="description" /><div className="selection">- Export current map data and config into a single Json file. You can later open the same map- by uploading this file to kepler.gl.+ <FormattedMessage id={'modal.exportMap.json.selection'} /></div></StyledExportMapSection><StyledJsonExportSection className="export-map-modal__json-options"><div className="description">- <div className="title">Map Config</div>+ <div className="title">+ <FormattedMessage id={'modal.exportMap.json.configTitle'} />+ </div><div className="subtitle">- {MAP_CONFIG_DESCRIPTION}+ <FormattedMessage id={'modal.exportMap.json.configDisclaimer'} /><ExportMapLink href={GITHUB_ADD_DATA_TO_MAP}>addDataToMap</ExportMapLink>.</div></div>@@ -80,9 +81,7 @@ const ExportJsonMap = React.memo(({config = {}}) => (</div><div className="disclaimer"><StyledWarning>- * Map config is coupled with loaded datasets. ‘dataId’ is used to bind layers, filters,- and tooltips to a specific dataset. When passing this config to addDataToMap, make sure- the dataset id matches the dataId/s in this config.+ <FormattedMessage id={'modal.exportMap.json.disclaimer'} /></StyledWarning></div></div>diff --git a/src/components/modals/export-map-modal/export-map-modal.js b/src/components/modals/export-map-modal/export-map-modal.jsindex 1a3e0f183..c415d0e2d 100644--- a/src/components/modals/export-map-modal/export-map-modal.js+++ b/src/components/modals/export-map-modal/export-map-modal.js@@ -27,6 +27,7 @@ import {EXPORT_MAP_FORMATS, EXPORT_MAP_FORMAT_OPTIONS} from 'constants/default-simport {StyledExportMapSection} from './components';import ExportHtmlMapFactory from './export-html-map';import ExportJsonMapFactory from './export-json-map';+import {FormattedMessage} from 'react-intl';const propTypes = {options: PropTypes.object,@@ -56,8 +57,12 @@ function ExportMapModalFactory(ExportHtmlMap, ExportJsonMap) {<div style={style}><StyledExportMapSection><div className="description">- <div className="title">Map format</div>- <div className="subtitle">Choose the format to export your map to</div>+ <div className="title">+ <FormattedMessage id={'modal.exportMap.formatTitle'} />+ </div>+ <div className="subtitle">+ <FormattedMessage id={'modal.exportMap.formatSubtitle'} />+ </div></div><div className="selection">{EXPORT_MAP_FORMAT_OPTIONS.map(op => (diff --git a/src/components/modals/load-data-modal.js b/src/components/modals/load-data-modal.jsindex d6f768366..7e5a06a60 100644--- a/src/components/modals/load-data-modal.js+++ b/src/components/modals/load-data-modal.js@@ -86,12 +86,12 @@ function LoadDataModalFactory(ModalTabs, FileUpload, LoadStorageMap) {loadingMethods: [{id: LOADING_METHODS.upload,- label: 'Load Files',+ label: 'modal.loadData.upload',elementType: FileUpload},{id: LOADING_METHODS.storage,- label: 'Load from Storage',+ label: 'modal.loadData.storage',elementType: LoadStorageMap}]diff --git a/src/components/modals/load-storage-map.js b/src/components/modals/load-storage-map.jsindex 55d6f6d7a..3b5ddc912 100644--- a/src/components/modals/load-storage-map.js+++ b/src/components/modals/load-storage-map.js@@ -27,6 +27,7 @@ import {Button} from 'components/common/styled-components';import CloudTile from './cloud-tile';import {Base, ArrowLeft} from 'components/common/icons';import ProviderModalContainer from './provider-modal-container';+import {FormattedMessage} from 'react-intl';const StyledProviderSection = styled.div.attrs({className: 'provider-selection'@@ -317,7 +318,7 @@ function LoadStorageMapFactory() {<>{isProviderLoading && (<StyledSpinner>- <LoadingDialog size={64} message="Loading..." />+ <LoadingDialog size={64} /></StyledSpinner>)}{!isProviderLoading && visualizations && (@@ -326,7 +327,7 @@ function LoadStorageMapFactory() {<StyledBackBtn><Button link onClick={this._clickBack}><ArrowLeft height="14px" />- Back+ <FormattedMessage id={'modal.loadStorageMap.back'} /></Button></StyledBackBtn>{provider.getManagementUrl && (@@ -337,13 +338,17 @@ function LoadStorageMapFactory() {rel="noopener noreferrer"style={{textDecoration: 'underline'}}>- Go to your Kepler.gl {provider.displayName} page+ <FormattedMessage+ id={'modal.loadStorageMap.back'}+ values={{displayName: provider.displayName}}+ /></a>)}</StyledStorageHeader><StyledProviderVisSection><span className="title">- <span>{currentProvider}</span> Storage / Maps+ <span>{currentProvider}</span>+ <FormattedMessage id={'modal.loadStorageMap.storageMaps'} /></span><StyledSeparator /><StyledVisualizationList>@@ -356,7 +361,9 @@ function LoadStorageMapFactory() {/>))) : (- <div className="visualization-list__message">No saved maps yet</div>+ <div className="visualization-list__message">+ <FormattedMessage id={'modal.loadStorageMap.noSavedMaps'} />+ </div>)}</StyledVisualizationList></StyledProviderVisSection>diff --git a/src/components/modals/loading-dialog.js b/src/components/modals/loading-dialog.jsindex 3d8018475..e90e19ad4 100644--- a/src/components/modals/loading-dialog.js+++ b/src/components/modals/loading-dialog.js@@ -21,6 +21,7 @@import React from 'react';import styled from 'styled-components';import LoadingSpinner from 'components/common/loading-spinner';+import { FormattedMessage } from "react-intl";const StyledSpinner = styled.div`text-align: center;@@ -52,13 +53,13 @@ const StyledLoadingDialog = styled.div.attrs({}`;-const LoadingDialog = ({size = 64, message = 'Loading...'}) => (+const LoadingDialog = ({size = 64, message = 'modal.loadingDialog.loading'}) => (<StyledLoadingDialog><div className="loading-content"><StyledSpinner><LoadingSpinner size={size} /></StyledSpinner>- <div className="loading-message">{message}</div>+ <div className="loading-message"><FormattedMessage id={message} /></div></div></StyledLoadingDialog>);diff --git a/src/components/modals/modal-tabs.js b/src/components/modals/modal-tabs.jsindex 4035ad4da..c6dad7efa 100644--- a/src/components/modals/modal-tabs.js+++ b/src/components/modals/modal-tabs.js@@ -23,6 +23,7 @@ import classnames from 'classnames';import styled from 'styled-components';import PropTypes from 'prop-types';import {media} from 'styles';+import {FormattedMessage, useIntl} from 'react-intl';const ModalTab = styled.div`align-items: flex-end;@@ -75,9 +76,10 @@ const noop = () => {};export const ModalTabItem = ({currentMethod, method, toggleMethod}) => {const onClick = useCallback(() => toggleMethod(method), [method, toggleMethod]);+ const intl = useIntl();return method.tabElementType ? (- <method.tabElementType onClick={onClick} />+ <method.tabElementType onClick={onClick} intl={intl} />) : (<StyledLoadDataModalTabItemclassName={classnames('load-data-modal__tab__item', {@@ -85,7 +87,7 @@ export const ModalTabItem = ({currentMethod, method, toggleMethod}) => {})}onClick={onClick}>- <div>{method.label || method.id}</div>+ <div>{method.label ? <FormattedMessage id={method.label} /> : method.id}</div></StyledLoadDataModalTabItem>);};diff --git a/src/components/modals/overwrite-map-modal.js b/src/components/modals/overwrite-map-modal.jsindex e4f278b72..d3f401130 100644--- a/src/components/modals/overwrite-map-modal.js+++ b/src/components/modals/overwrite-map-modal.js@@ -23,6 +23,7 @@ import styled from 'styled-components';import {CenterVerticalFlexbox} from 'components/common/styled-components';import {UploadAnimation} from './status-panel';import ImageModalContainer from './image-modal-container';+import {FormattedMessage} from 'react-intl';const StyledMsg = styled.div`margin-top: 24px;@@ -64,7 +65,9 @@ const OverwriteMapModalFactory = () => {<StyledOverwriteMapModal className="overwrite-map-modal">{isProviderLoading ? (<StyledMsg>- <StyledTitle>Saving map...</StyledTitle>+ <StyledTitle>+ <FormattedMessage id={'modal.overwriteMap.title'} />+ </StyledTitle><UploadAnimation icon={provider && provider.icon} /></StyledMsg>) : (@@ -74,7 +77,7 @@ const OverwriteMapModalFactory = () => {</StyledIcon><StyledMsg className="overwrite-map-msg"><StyledTitle>{title}</StyledTitle>- {` already exists in your ${mapSaved}. Would you like to overwrite it?`}+ <FormattedMessage id={'modal.overwriteMap.alreadyExists'} values={{mapSaved}} /></StyledMsg></>)}diff --git a/src/components/modals/save-map-modal.js b/src/components/modals/save-map-modal.jsindex 45554df6a..331e5a345 100644--- a/src/components/modals/save-map-modal.js+++ b/src/components/modals/save-map-modal.js@@ -38,6 +38,7 @@ import {StyledModalInputFootnote} from 'components/common/styled-components';import ImagePreview from 'components/common/image-preview';+import { FormattedMessage } from "react-intl";const StyledSaveMapModal = styled.div.attrs({className: 'save-map-modal'@@ -182,8 +183,8 @@ function SaveMapModalFactory() {<StyledModalContent className="save-map-modal-content"><StyledExportSection disabled={isProviderLoading}><div className="description">- <div className="title">Cloud storage</div>- <div className="subtitle">Login save map to your personal cloud storage</div>+ <div className="title"><FormattedMessage id={'modal.saveMap.title'} /></div>+ <div className="subtitle"><FormattedMessage id={'modal.saveMap.subtitle'} /></div></div><div className="selection">{cloudProviders.map(cloudProvider => (diff --git a/src/components/modals/share-map-modal.js b/src/components/modals/share-map-modal.jsindex 4725718f3..7986552c7 100644--- a/src/components/modals/share-map-modal.js+++ b/src/components/modals/share-map-modal.js@@ -33,7 +33,7 @@ import {} from 'components/common/styled-components';import CloudTile from './cloud-tile';import StatusPanel from './status-panel';-import {SHARE_DISCLAIMER} from 'constants/default-settings';+import {FormattedMessage} from 'react-intl';export const StyledInputLabel = styled.label`font-size: 12px;@@ -125,23 +125,32 @@ export default function ShareMapUrlModalFactory() {currentProvider={currentProvider}cloudProviders={cloudProviders}onUpdateImageSetting={onUpdateImageSetting}- >- <StyledShareMapModal className="export-cloud-modal">- <StyledInnerDiv>- <StyledExportSection>- <div className="description">- <div className="title">Share Map Url</div>- <div className="subtitle">Generate a map url to share with others</div>- </div>- <div className="selection">- <div className="title warning">{SHARE_DISCLAIMER}</div>- </div>- </StyledExportSection>- <StyledExportSection disabled={isProviderLoading}>- <div className="description">- <div className="title">Cloud storage</div>- <div className="subtitle">- Login and upload map data to your personal cloud storage++ >+ <StyledShareMapModal className="export-cloud-modal">+ <StyledInnerDiv>+ <StyledExportSection>+ <div className="description">+ <div className="title">+ <FormattedMessage id={'modal.shareMap.shareUriTitle'} />+ </div>+ <div className="subtitle">+ <FormattedMessage id={'modal.shareMap.shareUriSubtitle'} />+ </div>+ </div>+ <div className="selection">+ <div className="title warning">+ <FormattedMessage id={'modal.shareMap.shareDisclaimer'} />+ </div>+ </div>+ </StyledExportSection>+ <StyledExportSection disabled={isProviderLoading}>+ <div className="description">+ <div className="title">+ <FormattedMessage id={'modal.shareMap.cloudTitle'} />+ </div>+ <div className="subtitle">+ <FormattedMessage id={'modal.shareMap.cloudSubtitle'} /></div></div><div className="selection">@@ -181,7 +190,7 @@ export default function ShareMapUrlModalFactory() {rel="noopener noreferrer"style={{textDecoration: 'underline'}}>- Go to your Kepler.gl {provider.displayName} page+ <FormattedMessage id={'modal.shareMap.gotoPage'} values={{currentProvider}} /></a>)}</div>diff --git a/src/components/modals/status-panel.js b/src/components/modals/status-panel.jsindex d8feaec2c..59b97de8f 100644--- a/src/components/modals/status-panel.js+++ b/src/components/modals/status-panel.js@@ -23,6 +23,7 @@ import styled from 'styled-components';import {MapIcon} from 'components/common/icons';import {StyledExportSection} from 'components/common/styled-components';import ErrorDisplay from './error-display';+import {FormattedMessage} from 'react-intl';const StyledUploader = styled.div`display: flex;@@ -76,7 +77,13 @@ export const UploadAnimation = props => (const StatusPanel = ({error, isLoading, providerIcon}) => (<StyledExportSection><div className="description">- <div className="title">{isLoading ? 'Map Uploading' : error ? 'Error' : null}</div>+ <div className="title">+ {isLoading ? (+ <FormattedMessage id={'modal.statusPanel.mapUploading'} />+ ) : error ? (+ <FormattedMessage id={'modal.statusPanel.error'} />+ ) : null}+ </div></div><div className="selection">{isLoading && <UploadAnimation icon={providerIcon} />}diff --git a/src/components/modals/storage-map-viewer.js b/src/components/modals/storage-map-viewer.jsindex 181dc6dd1..be077bea3 100644--- a/src/components/modals/storage-map-viewer.js+++ b/src/components/modals/storage-map-viewer.js@@ -23,6 +23,7 @@ import PropTypes from 'prop-types';import styled from 'styled-components';import moment from 'moment';import {LeftArrow} from 'components/common/icons';+import {FormattedMessage} from 'react-intl';const imageH = 108;@@ -138,7 +139,12 @@ const AssetItem = ({asset, onClick}) => (<div className="asset__title">{asset.label || asset.title}</div><div className="asset__image__caption">{asset.description}</div>{asset.lastUpdated ? (- <div className="asset__last-updated">Last Modified {getDuration(asset.lastUpdated)} ago</div>+ <div className="asset__last-updated">+ <FormattedMessage+ id={'modal.storageMapViewer.lastModified'}+ values={{lastUpdated: getDuration(asset.lastUpdated)}}+ />+ </div>) : null}</StyledAssetItem>);@@ -153,7 +159,9 @@ class StorageAssetsViewer extends React.Component {<div className="storage-asset-viewer"><BackLink onClick={back}><LeftArrow height="12px" />- <span>Back</span>+ <span>+ <FormattedMessage id={'modal.storageMapViewer.back'} />+ </span></BackLink>{error && <StyledError>{error.message}</StyledError>}<StyledAssetGallery>diff --git a/src/components/side-panel.js b/src/components/side-panel.jsindex f4a51ef30..b836dc815 100644--- a/src/components/side-panel.js+++ b/src/components/side-panel.js@@ -19,6 +19,7 @@// THE SOFTWARE.import React, {PureComponent} from 'react';+import {FormattedMessage} from 'react-intl';import PropTypes from 'prop-types';import styled from 'styled-components';import get from 'lodash.get';@@ -263,7 +264,9 @@ export default function SidePanelFactory(<SidePanelContent className="side-panel__content"><div><PanelTitle className="side-panel__content__title">- {(panels.find(({id}) => id === activeSidePanel) || {}).label}+ <FormattedMessage+ id={(panels.find(({id}) => id === activeSidePanel) || {}).label}+ /></PanelTitle>{activeSidePanel === 'layer' && (<LayerManagerdiff --git a/src/components/side-panel/common/dataset-info.js b/src/components/side-panel/common/dataset-info.jsindex 845a824cd..04938a438 100644--- a/src/components/side-panel/common/dataset-info.js+++ b/src/components/side-panel/common/dataset-info.js@@ -21,6 +21,7 @@import React from 'react';import styled from 'styled-components';import {format} from 'd3-format';+import { FormattedMessage } from "react-intl";const numFormat = format(',');@@ -33,7 +34,7 @@ const StyledDataRowCount = styled.div`export default function DatasetInfoFactory() {const DatasetInfo = ({dataset}) => (<StyledDataRowCount className="source-data-rows">- {`${numFormat(dataset.allData.length)} rows`}+ <FormattedMessage id={'datasetInfo.rowCount'} values={{rowCount: numFormat(dataset.allData.length)}}/></StyledDataRowCount>);diff --git a/src/components/side-panel/common/dataset-title.js b/src/components/side-panel/common/dataset-title.jsindex 41ec399d8..e0d4ff532 100644--- a/src/components/side-panel/common/dataset-title.js+++ b/src/components/side-panel/common/dataset-title.js@@ -20,9 +20,10 @@import React, {PureComponent} from 'react';import styled from 'styled-components';+import {FormattedMessage} from 'react-intl';-import {Tooltip, CenterFlexbox} from 'components/common/styled-components';-import {Table, Trash, ArrowRight} from 'components/common/icons';+import {CenterFlexbox, Tooltip} from 'components/common/styled-components';+import {ArrowRight, Table, Trash} from 'components/common/icons';import DatasetTagFactory from 'components/side-panel/common/dataset-tag';function nop() {}@@ -69,7 +70,9 @@ const ShowDataTable = ({id, showDatasetTable = nop}) => (}}/><Tooltip id={`data-table-${id}`} effect="solid">- <span>Show data table</span>+ <span>+ <FormattedMessage id={'datasetTitle.showDataTable'} />+ </span></Tooltip></DataTagAction>);@@ -88,7 +91,9 @@ const RemoveDataset = ({datasetKey, removeDataset = nop}) => (}}/><Tooltip id={`delete-${datasetKey}`} effect="solid" type="error">- <span>Remove dataset</span>+ <span>+ <FormattedMessage id={'datasetTitle.removeDataset'} />+ </span></Tooltip></DataTagAction>);diff --git a/src/components/side-panel/common/source-data-selector.js b/src/components/side-panel/common/source-data-selector.jsindex 6e2c2cfec..8493b8652 100644--- a/src/components/side-panel/common/source-data-selector.js+++ b/src/components/side-panel/common/source-data-selector.js@@ -24,6 +24,7 @@ import {createSelector} from 'reselect';import {PanelLabel, SidePanelSection} from 'components/common/styled-components';import ItemSelector from 'components/common/item-selector/item-selector';import DatasetTagFactory from 'components/side-panel/common/dataset-tag';+import {FormattedMessage} from 'react-intl';const defaultPlaceHolder = 'Select A Data Source';@@ -50,7 +51,9 @@ export default function SourceDataSelectorFactory(DatasetTag) {return (<SidePanelSection className="data-source-selector">- <PanelLabel>Data Source</PanelLabel>+ <PanelLabel>+ <FormattedMessage id={'misc.dataSource'} />+ </PanelLabel><ItemSelectorinputTheme={inputTheme}selectedItems={dataId ? this.props.datasets[dataId] : null}diff --git a/src/components/side-panel/filter-manager.js b/src/components/side-panel/filter-manager.jsindex 7b843f595..24a18cd86 100644--- a/src/components/side-panel/filter-manager.js+++ b/src/components/side-panel/filter-manager.js@@ -21,7 +21,8 @@import React, {Component} from 'react';import PropTypes from 'prop-types';import {createSelector} from 'reselect';-import {SidePanelSection, SidePanelDivider, Button} from 'components/common/styled-components';+import {FormattedMessage} from 'react-intl';+import {Button, SidePanelDivider, SidePanelSection} from 'components/common/styled-components';import {Add} from 'components/common/icons';import SourceDataCatalogFactory from './common/source-data-catalog';import FilterPanelFactory from './filter-panel/filter-panel';@@ -95,7 +96,7 @@ function FilterManagerFactory(SourceDataCatalog, FilterPanel) {onClick={this._addFilter}><Add height="12px" />- Add Filter+ <FormattedMessage id={'filterManager.addFilter'} /></Button></div>);diff --git a/src/components/side-panel/filter-panel/filter-panel-header.js b/src/components/side-panel/filter-panel/filter-panel-header.jsindex 17ea51984..c9dd6804a 100644--- a/src/components/side-panel/filter-panel/filter-panel-header.js+++ b/src/components/side-panel/filter-panel/filter-panel-header.js@@ -64,7 +64,7 @@ function FilterPanelHeaderFactory() {<StyledChildrenContainer>{children}</StyledChildrenContainer><PanelHeaderActionid={filter.id}- tooltip="delete"+ tooltip="tooltip.delete"tooltipType="error"onClick={removeFilter}hoverColor={'errorColor'}diff --git a/src/components/side-panel/interaction-panel/brush-config.js b/src/components/side-panel/interaction-panel/brush-config.jsindex 557e7c760..0d4d03760 100644--- a/src/components/side-panel/interaction-panel/brush-config.js+++ b/src/components/side-panel/interaction-panel/brush-config.js@@ -23,11 +23,14 @@ import RangeSlider from 'components/common/range-slider';import {PanelLabel, SidePanelSection} from 'components/common/styled-components';import {BRUSH_CONFIG} from 'utils/interaction-utils';+import {FormattedMessage} from 'react-intl';function BrushConfigFactory() {const BrushConfig = ({config, onChange}) => (<SidePanelSection>- <PanelLabel>Brush Radius (km)</PanelLabel>+ <PanelLabel>+ <FormattedMessage id={'misc.brushRadius'} />+ </PanelLabel><RangeSliderrange={BRUSH_CONFIG.range}value0={0}diff --git a/src/components/side-panel/interaction-panel/interaction-panel.js b/src/components/side-panel/interaction-panel/interaction-panel.jsindex a792d7abd..9c00d2169 100644--- a/src/components/side-panel/interaction-panel/interaction-panel.js+++ b/src/components/side-panel/interaction-panel/interaction-panel.js@@ -32,6 +32,7 @@ import {PanelHeaderContent,PanelContent} from 'components/common/styled-components';+import { FormattedMessage } from "react-intl";const StyledPanelContent = styled(PanelContent)`border-top: 1px solid ${props => props.theme.panelBorderColor};@@ -92,7 +93,8 @@ function InteractionPanelFactory(TooltipConfig, BrushConfig) {<config.iconComponent height="12px" /></div><div className="interaction-panel__header__title">- <PanelHeaderTitle>{config.id}</PanelHeaderTitle>++ <PanelHeaderTitle><FormattedMessage id={config.label} /></PanelHeaderTitle></div></PanelHeaderContent><div className="interaction-panel__header__actions">diff --git a/src/components/side-panel/layer-manager.js b/src/components/side-panel/layer-manager.jsindex 4433a9d15..117c43c3d 100644--- a/src/components/side-panel/layer-manager.js+++ b/src/components/side-panel/layer-manager.js@@ -18,13 +18,14 @@// OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN// THE SOFTWARE.-import React, {Component} from 'react';+import React, {Component, useCallback} from 'react';import classnames from 'classnames';import PropTypes from 'prop-types';import {sortableContainer, sortableElement} from 'react-sortable-hoc';import styled from 'styled-components';import {createSelector} from 'reselect';+import {FormattedMessage, injectIntl} from 'react-intl';import {arrayMove} from 'utils/data-utils';import LayerPanelFactory from './layer-panel/layer-panel';@@ -32,26 +33,43 @@ import SourceDataCatalogFactory from './common/source-data-catalog';import {Add} from 'components/common/icons';import ItemSelector from 'components/common/item-selector/item-selector';import {+ Button,PanelLabel,SidePanelDivider,- SidePanelSection,- Button+ SidePanelSection} from 'components/common/styled-components';import {LAYER_BLENDINGS} from 'constants/default-settings';-const LayerBlendingSelector = ({layerBlending, updateLayerBlending}) => (- <SidePanelSection>- <PanelLabel>Layer Blending</PanelLabel>- <ItemSelector- selectedItems={layerBlending}- options={Object.keys(LAYER_BLENDINGS)}- multiSelect={false}- searchable={false}- onChange={updateLayerBlending}- />- </SidePanelSection>-);+const LayerBlendingSelector = ({layerBlending, updateLayerBlending, intl}) => {+ const labeledLayerBlendings = Object.keys(LAYER_BLENDINGS).reduce(+ (acc, current) => ({+ ...acc,+ [intl.formatMessage({id: LAYER_BLENDINGS[current].label})]: current+ }),+ {}+ );++ const onChange = useCallback(blending => updateLayerBlending(labeledLayerBlendings[blending]), [+ updateLayerBlending,+ labeledLayerBlendings+ ]);++ return (+ <SidePanelSection>+ <PanelLabel>+ <FormattedMessage id="layerBlending.title" />+ </PanelLabel>+ <ItemSelector+ selectedItems={intl.formatMessage({id: LAYER_BLENDINGS[layerBlending].label})}+ options={Object.keys(labeledLayerBlendings)}+ multiSelect={false}+ searchable={false}+ onChange={onChange}+ />+ </SidePanelSection>+ );+};// make sure the element is always visible while is being dragged// item being dragged is appended in body, here to reset its global style@@ -90,7 +108,7 @@ export function AddDataButtonFactory() {secondary><Add height="12px" />- Add Data+ <FormattedMessage id={'layerManager.addData'} /></Button>);@@ -114,7 +132,7 @@ function LayerManagerFactory(AddDataButton, LayerPanel, SourceDataCatalog) {return <div>{children}</div>;});- return class LayerManager extends Component {+ class LayerManager extends Component {static propTypes = {datasets: PropTypes.object.isRequired,layerBlending: PropTypes.string.isRequired,@@ -174,7 +192,7 @@ function LayerManagerFactory(AddDataButton, LayerPanel, SourceDataCatalog) {};render() {- const {layers, datasets, layerOrder, openModal} = this.props;+ const {layers, datasets, layerOrder, openModal, intl} = this.props;const defaultDataset = Object.keys(datasets)[0];const layerTypeOptions = this.layerTypeOptionsSelector(this.props);@@ -235,18 +253,20 @@ function LayerManagerFactory(AddDataButton, LayerPanel, SourceDataCatalog) {{defaultDataset ? (<Button className="add-layer-button" onClick={this._addEmptyNewLayer} width="105px"><Add height="12px" />- Add Layer+ <FormattedMessage id={'layerManager.addLayer'} /></Button>) : null}</SidePanelSection><LayerBlendingSelectorlayerBlending={this.props.layerBlending}updateLayerBlending={this.props.updateLayerBlending}+ intl={intl}/></div>);}- };+ }+ return injectIntl(LayerManager);}export default LayerManagerFactory;diff --git a/src/components/side-panel/layer-panel/color-range-selector.js b/src/components/side-panel/layer-panel/color-range-selector.jsindex 989ae7dfc..707a2958d 100644--- a/src/components/side-panel/layer-panel/color-range-selector.js+++ b/src/components/side-panel/layer-panel/color-range-selector.js@@ -32,6 +32,7 @@ import CustomPalette from './custom-palette';import {COLOR_RANGES} from 'constants/color-ranges';import {numberSort} from 'utils/data-utils';import {reverseColorRange} from 'utils/color-utils';+import {FormattedMessage} from 'react-intl';export const ALL_TYPES = uniq(COLOR_RANGES.map(c => c.type)@@ -81,7 +82,7 @@ const CONFIG_SETTINGS = {options: [true, false]},custom: {- label: 'Custom Palette',+ label: 'customPalette',type: 'switch',options: [true, false]}@@ -194,7 +195,9 @@ export default class ColorRangeSelect extends Component {export const PaletteConfig = ({label, value, config: {type, options}, onChange}) => (<StyledPaletteConfig className="color-palette__config" onClick={e => e.stopPropagation()}><div className="color-palette__config__label">- <PanelLabel>{label}</PanelLabel>+ <PanelLabel>+ <FormattedMessage id={`color.${label}`} />+ </PanelLabel></div>{type === 'select' && (<div className="color-palette__config__select">diff --git a/src/components/side-panel/layer-panel/dimension-scale-selector.js b/src/components/side-panel/layer-panel/dimension-scale-selector.jsindex 5939026dc..c0890b367 100644--- a/src/components/side-panel/layer-panel/dimension-scale-selector.js+++ b/src/components/side-panel/layer-panel/dimension-scale-selector.js@@ -21,11 +21,18 @@import React from 'react';import {PanelLabel, SidePanelSection} from 'components/common/styled-components';import ItemSelector from 'components/common/item-selector/item-selector';+import {FormattedMessage} from 'react-intl';+import {camelize} from 'utils/utils';const DimensionScaleSelector = ({label, onSelect, options, scaleType, disabled = false}) => {return (<SidePanelSection>- <PanelLabel>{label || 'Scale'}</PanelLabel>+ <PanelLabel>+ <FormattedMessage+ id={label ? `scale.${camelize(label)}` : 'misc.scale'}+ defaultMessage={label}+ />+ </PanelLabel><ItemSelectordisabled={disabled}selectedItems={scaleType}diff --git a/src/components/side-panel/layer-panel/layer-column-config.js b/src/components/side-panel/layer-panel/layer-column-config.jsindex dce3ee11b..0638ebb8b 100644--- a/src/components/side-panel/layer-panel/layer-column-config.js+++ b/src/components/side-panel/layer-panel/layer-column-config.js@@ -21,6 +21,7 @@import React, {Component} from 'react';import PropTypes from 'prop-types';import styled from 'styled-components';+import {FormattedMessage} from 'react-intl';import FieldSelector from 'components/common/field-selector';import {createSelector} from 'reselect';@@ -79,8 +80,10 @@ export default class LayerColumnConfig extends Component {<SidePanelSection><div className="layer-config__column"><TopRow>- <PanelLabel>Columns</PanelLabel>- <PanelLabel>Required*</PanelLabel>+ <PanelLabel><FormattedMessage id={'columns.title'} /></PanelLabel>+ <PanelLabel>+ <FormattedMessage id="layer.required" />+ </PanelLabel></TopRow>{Object.keys(columns).map(key => (<ColumnSelector@@ -115,7 +118,9 @@ const ColumnSelect = styled.div`const ColumnSelector = ({column, label, allFields, onSelect, fieldPairs}) => (<ColumnRow className="layer-config__column__selector"><ColumnName className="layer-config__column__name">- <PanelLabel>{label}</PanelLabel>+ <PanelLabel>+ <FormattedMessage id={`columns.${label}`} />+ </PanelLabel>{!column.optional ? <PanelLabel>{` *`}</PanelLabel> : null}</ColumnName><ColumnSelect className="layer-config__column__select">diff --git a/src/components/side-panel/layer-panel/layer-config-group.js b/src/components/side-panel/layer-panel/layer-config-group.jsindex e85ccbcad..6ecc792df 100644--- a/src/components/side-panel/layer-panel/layer-config-group.js+++ b/src/components/side-panel/layer-panel/layer-config-group.js@@ -22,6 +22,7 @@ import React, {Component} from 'react';import {polyfill} from 'react-lifecycles-compat';import styled from 'styled-components';import classnames from 'classnames';+import {FormattedMessage} from 'react-intl';import Switch from 'components/common/switch';import InfoHelper from 'components/common/info-helper';import {VertThreeDots} from 'components/common/icons';@@ -160,7 +161,9 @@ class LayerConfigGroup extends Component {onClick={() => this.setState({collapsed: !this.state.collapsed})}><StyledLayerConfigGroupLabel className="layer-config-group__label">- <span>{label}</span>+ <span>+ <FormattedMessage id={label || 'misc.empty'} />+ </span>{description && <InfoHelper description={description} id={label} />}</StyledLayerConfigGroupLabel><StyledLayerConfigGroupAction className="layer-config-group__action">diff --git a/src/components/side-panel/layer-panel/layer-configurator.js b/src/components/side-panel/layer-panel/layer-configurator.jsindex 544150e59..d2c4cb003 100644--- a/src/components/side-panel/layer-panel/layer-configurator.js+++ b/src/components/side-panel/layer-panel/layer-configurator.js@@ -22,8 +22,9 @@import React, {Component, Fragment} from 'react';import PropTypes from 'prop-types';import styled from 'styled-components';+import {FormattedMessage} from 'react-intl';-import {Button, PanelLabel, SidePanelSection, Input} from 'components/common/styled-components';+import {Button, Input, PanelLabel, SidePanelSection} from 'components/common/styled-components';import ItemSelector from 'components/common/item-selector/item-selector';import VisConfigByFieldSelector from './vis-config-by-field-selector';@@ -39,7 +40,7 @@ import TextLabelPanel from './text-label-panel';import {capitalizeFirstLetter} from 'utils/utils';-import {LAYER_TYPES, CHANNEL_SCALE_SUPPORTED_FIELDS} from 'constants/default-settings';+import {CHANNEL_SCALE_SUPPORTED_FIELDS, LAYER_TYPES} from 'constants/default-settings';const StyledLayerConfigurator = styled.div.attrs({className: 'layer-panel__config'@@ -161,7 +162,7 @@ export default function LayerConfiguratorFactory(SourceDataSelector) {) : null}{/* Radius */}- <LayerConfigGroup label={'radius'} collapsible>+ <LayerConfigGroup label={'layer.radius'} collapsible>{!layer.config.sizeField ? (<VisConfigSlider{...layer.visConfigSettings.radius}@@ -212,7 +213,7 @@ export default function LayerConfiguratorFactory(SourceDataSelector) {return (<StyledLayerVisualConfigurator>{/* Color */}- <LayerConfigGroup label={'color'} collapsible>+ <LayerConfigGroup label={'layer.color'} collapsible><LayerColorRangeSelector {...visConfiguratorProps} /><ConfigGroupCollapsibleContent><AggrScaleSelector {...layerConfiguratorProps} channel={layer.visualChannels.color} />@@ -232,7 +233,7 @@ export default function LayerConfiguratorFactory(SourceDataSelector) {</LayerConfigGroup>{/* Cluster Radius */}- <LayerConfigGroup label={'radius'} collapsible>+ <LayerConfigGroup label={'layer.radius'} collapsible><VisConfigSlider {...layer.visConfigSettings.clusterRadius} {...visConfiguratorProps} /><ConfigGroupCollapsibleContent><VisConfigSlider {...layer.visConfigSettings.radiusRange} {...visConfiguratorProps} />@@ -251,14 +252,14 @@ export default function LayerConfiguratorFactory(SourceDataSelector) {return (<StyledLayerVisualConfigurator>{/* Color */}- <LayerConfigGroup label={'color'} collapsible>+ <LayerConfigGroup label={'layer.color'} collapsible><LayerColorRangeSelector {...visConfiguratorProps} /><ConfigGroupCollapsibleContent><VisConfigSlider {...layer.visConfigSettings.opacity} {...visConfiguratorProps} /></ConfigGroupCollapsibleContent></LayerConfigGroup>{/* Radius */}- <LayerConfigGroup label={'radius'}>+ <LayerConfigGroup label={'layer.radius'}><VisConfigSlider{...layer.visConfigSettings.radius}{...visConfiguratorProps}@@ -266,7 +267,7 @@ export default function LayerConfiguratorFactory(SourceDataSelector) {/></LayerConfigGroup>{/* Weight */}- <LayerConfigGroup label={'weight'}>+ <LayerConfigGroup label={'layer.weight'}><ChannelByValueSelectorchannel={layer.visualChannels.weight}{...layerChannelConfigProps}@@ -294,13 +295,13 @@ export default function LayerConfiguratorFactory(SourceDataSelector) {const {visConfig: {enable3d}} = config;- const elevationByDescription = 'When off, height is based on count of points';- const colorByDescription = 'When off, color is based on count of points';+ const elevationByDescription = 'layer.elevationByDescription';+ const colorByDescription = 'layer.colorByDescription';return (<StyledLayerVisualConfigurator>{/* Color */}- <LayerConfigGroup label={'color'} collapsible>+ <LayerConfigGroup label={'layer.color'} collapsible><LayerColorRangeSelector {...visConfiguratorProps} /><ConfigGroupCollapsibleContent><AggrScaleSelector {...layerConfiguratorProps} channel={layer.visualChannels.color} />@@ -328,7 +329,7 @@ export default function LayerConfiguratorFactory(SourceDataSelector) {</LayerConfigGroup>{/* Cell size */}- <LayerConfigGroup label={'radius'} collapsible>+ <LayerConfigGroup label={'layer.radius'} collapsible><VisConfigSlider {...layer.visConfigSettings.worldUnitSize} {...visConfiguratorProps} /><ConfigGroupCollapsibleContent><VisConfigSlider {...layer.visConfigSettings.coverage} {...visConfiguratorProps} />@@ -388,7 +389,7 @@ export default function LayerConfiguratorFactory(SourceDataSelector) {return (<StyledLayerVisualConfigurator>{/* Color */}- <LayerConfigGroup label={'color'} collapsible>+ <LayerConfigGroup label={'layer.color'} collapsible>{layer.config.colorField ? (<LayerColorRangeSelector {...visConfiguratorProps} />) : (@@ -404,7 +405,7 @@ export default function LayerConfiguratorFactory(SourceDataSelector) {</LayerConfigGroup>{/* Coverage */}- <LayerConfigGroup label={'coverage'} collapsible>+ <LayerConfigGroup label={'layer.coverage'} collapsible>{!layer.config.coverageField ? (<VisConfigSlider{...layer.visConfigSettings.coverage}@@ -444,7 +445,7 @@ export default function LayerConfiguratorFactory(SourceDataSelector) {<VisConfigSlider{...layer.visConfigSettings.sizeRange}{...visConfiguratorProps}- label="Height Range"+ label="layerVisConfigs.heightRange"/></ConfigGroupCollapsibleContent></LayerConfigGroup>@@ -465,7 +466,7 @@ export default function LayerConfiguratorFactory(SourceDataSelector) {return (<StyledLayerVisualConfigurator>{/* Color */}- <LayerConfigGroup label={'color'} collapsible>+ <LayerConfigGroup label={'layer.color'} collapsible>{layer.config.colorField ? (<LayerColorRangeSelector {...visConfiguratorProps} />) : (@@ -486,7 +487,7 @@ export default function LayerConfiguratorFactory(SourceDataSelector) {</LayerConfigGroup>{/* thickness */}- <LayerConfigGroup label={'stroke'} collapsible>+ <LayerConfigGroup label={'layer.stroke'} collapsible>{layer.config.sizeField ? (<VisConfigSlider{...layer.visConfigSettings.sizeRange}@@ -525,7 +526,7 @@ export default function LayerConfiguratorFactory(SourceDataSelector) {return (<StyledLayerVisualConfigurator>{/* Color */}- <LayerConfigGroup label={'color'} collapsible>+ <LayerConfigGroup label={'layer.color'} collapsible>{layer.config.colorField ? (<LayerColorRangeSelector {...visConfiguratorProps} />) : (@@ -541,7 +542,7 @@ export default function LayerConfiguratorFactory(SourceDataSelector) {</LayerConfigGroup>{/* Stroke Width */}- <LayerConfigGroup {...visConfiguratorProps} label="Stroke Width" collapsible>+ <LayerConfigGroup {...visConfiguratorProps} label="layer.strokeWidth" collapsible>{layer.config.sizeField ? (<VisConfigSlider{...layer.visConfigSettings.sizeRange}@@ -568,8 +569,8 @@ export default function LayerConfiguratorFactory(SourceDataSelector) {<LayerConfigGroup{...visConfiguratorProps}{...(featureTypes.polygon ? layer.visConfigSettings.stroked : {})}- label="Trail Length"- description="Number of seconds for a path to completely fade out"+ label="layer.trailLength"+ description="layer.trailLengthDescription"><VisConfigSlider{...layer.visConfigSettings.trailLength}@@ -599,7 +600,7 @@ export default function LayerConfiguratorFactory(SourceDataSelector) {<LayerConfigGroup{...layer.visConfigSettings.filled}{...visConfiguratorProps}- label="Fill Color"+ label="layer.fillColor"collapsible>{layer.config.colorField ? (@@ -621,7 +622,7 @@ export default function LayerConfiguratorFactory(SourceDataSelector) {<LayerConfigGroup{...layer.visConfigSettings.stroked}{...visConfiguratorProps}- label="Stroke Color"+ label="layer.strokeColor"collapsible>{layer.config.strokeColorField ? (@@ -649,7 +650,7 @@ export default function LayerConfiguratorFactory(SourceDataSelector) {<LayerConfigGroup{...visConfiguratorProps}{...(featureTypes.polygon ? layer.visConfigSettings.stroked : {})}- label="Stroke Width"+ label="layer.strokeWidth"collapsible>{layer.config.sizeField ? (@@ -698,7 +699,7 @@ export default function LayerConfiguratorFactory(SourceDataSelector) {{/* Radius */}{featureTypes.point ? (- <LayerConfigGroup label={'radius'} collapsible>+ <LayerConfigGroup label={'layer.radius'} collapsible>{!layer.config.radiusField ? (<VisConfigSlider{...layer.visConfigSettings.radius}@@ -729,7 +730,7 @@ export default function LayerConfiguratorFactory(SourceDataSelector) {_render3DLayerConfig({layer, visConfiguratorProps}) {return (<Fragment>- <LayerConfigGroup label={'3D Model'} collapsible>+ <LayerConfigGroup label={'layer.3DModel'} collapsible><Inputtype="file"accept=".glb,.gltf"@@ -741,7 +742,7 @@ export default function LayerConfiguratorFactory(SourceDataSelector) {}}/></LayerConfigGroup>- <LayerConfigGroup label={'3D Model Options'} collapsible>+ <LayerConfigGroup label={'layer.3DModelOptions'} collapsible><VisConfigSlider{...layer.visConfigSettings.sizeScale}{...visConfiguratorProps}@@ -783,7 +784,7 @@ export default function LayerConfiguratorFactory(SourceDataSelector) {<LayerConfigGroup{...layer.visConfigSettings.filled}{...visConfiguratorProps}- label="Fill Color"+ label="layer.fillColor"collapsible>{layer.config.colorField ? (@@ -804,7 +805,7 @@ export default function LayerConfiguratorFactory(SourceDataSelector) {<LayerConfigGroup{...layer.visConfigSettings.stroked}{...visConfiguratorProps}- label="Stroke Color"+ label="layer.strokeColor"collapsible>{layer.config.strokeColorField ? (@@ -825,7 +826,7 @@ export default function LayerConfiguratorFactory(SourceDataSelector) {</LayerConfigGroup>{/* Stroke Width */}- <LayerConfigGroup {...visConfiguratorProps} label="Stroke Width" collapsible>+ <LayerConfigGroup {...visConfiguratorProps} label="layer.strokeWidth" collapsible>{layer.config.sizeField ? (<VisConfigSlider{...layer.visConfigSettings.sizeRange}@@ -861,13 +862,13 @@ export default function LayerConfiguratorFactory(SourceDataSelector) {<VisConfigSlider{...layer.visConfigSettings.elevationScale}{...visConfiguratorProps}- label="Elevation Scale"+ label="layerVisConfigs.elevationScale"/><ConfigGroupCollapsibleContent><VisConfigSlider{...layer.visConfigSettings.heightRange}{...visConfiguratorProps}- label="Height Range"+ label="layerVisConfigs.heightRange"/><VisConfigSwitch {...visConfiguratorProps} {...layer.visConfigSettings.wireframe} /></ConfigGroupCollapsibleContent>@@ -892,7 +893,7 @@ export default function LayerConfiguratorFactory(SourceDataSelector) {{layer.layerInfoModal ? (<HowToButton onClick={() => this.props.openModal(layer.layerInfoModal)} />) : null}- <LayerConfigGroup label={'basic'} collapsible expanded={!layer.hasAllColumns()}>+ <LayerConfigGroup label={'layer.basic'} collapsible expanded={!layer.hasAllColumns()}><LayerTypeSelectorlayer={layer}layerTypeOptions={layerTypeOptions}@@ -948,7 +949,7 @@ const StyledHowToButton = styled.div`export const HowToButton = ({onClick}) => (<StyledHowToButton><Button link small onClick={onClick}>- How to+ <FormattedMessage id={'layerConfiguration.howTo'} /></Button></StyledHowToButton>);@@ -1035,7 +1036,7 @@ export const ChannelByValueSelector = ({layer, channel, onChange, fields, descriconst supportedFields = fields.filter(({type}) => channelSupportedFieldTypes.includes(type));const scaleOptions = layer.getScaleOptions(channel.key);const showScale = !layer.isAggregated && layer.config[scale] && scaleOptions.length > 1;- const defaultDescription = `Calculate ${property} based on selected field`;+ const defaultDescription = 'layerConfiguration.defaultDescription';return (<VisConfigByFieldSelector@@ -1046,7 +1047,7 @@ export const ChannelByValueSelector = ({layer, channel, onChange, fields, descriid={layer.id}key={`${key}-channel-selector`}property={property}- placeholder={defaultMeasure || 'Select a field'}+ placeholder={defaultMeasure || 'placeholder.selectField'}range={layer.config.visConfig[range]}scaleOptions={scaleOptions}scaleType={scale ? layer.config[scale] : null}@@ -1082,7 +1083,9 @@ export const AggregationTypeSelector = ({layer, channel, onChange}) => {return (<SidePanelSection>- <PanelLabel>{`Aggregate ${selectedField.name} by`}</PanelLabel>+ <PanelLabel>+ <FormattedMessage id={'layer.aggregateBy'} values={{field: selectedField.name}} />+ </PanelLabel><ItemSelectorselectedItems={visConfig[aggregation]}options={aggregationOptions}diff --git a/src/components/side-panel/layer-panel/layer-panel-header.js b/src/components/side-panel/layer-panel/layer-panel-header.jsindex 1032cfd5e..6ab961807 100644--- a/src/components/side-panel/layer-panel/layer-panel-header.js+++ b/src/components/side-panel/layer-panel/layer-panel-header.js@@ -24,9 +24,10 @@ import classnames from 'classnames';import styled from 'styled-components';import {sortableHandle} from 'react-sortable-hoc';import PanelHeaderAction from 'components/side-panel/panel-header-action';-import {EyeSeen, EyeUnseen, VertDots, ArrowDown, Trash} from 'components/common/icons';+import {ArrowDown, EyeSeen, EyeUnseen, Trash, VertDots} from 'components/common/icons';import {InlineInput, StyledPanelHeader} from 'components/common/styled-components';+import {FormattedMessage} from 'react-intl';const propTypes = {// required@@ -152,7 +153,9 @@ function LayerPanelHeaderFactory() {<LayerTitleSection className="layer__title"><div><LayerLabelEditor layerId={layerId} label={label} onEdit={onUpdateLayerLabel} />- <div className="layer__title__type">{layerType}</div>+ <div className="layer__title__type">+ {layerType && <FormattedMessage id={`layer.type.${layerType.toLowerCase()}`} />}+ </div></div></LayerTitleSection></HeaderLabelSection>@@ -161,7 +164,7 @@ function LayerPanelHeaderFactory() {<PanelHeaderActionclassName="layer__remove-layer"id={layerId}- tooltip={'Remove layer'}+ tooltip={'tooltip.removeLayer'}onClick={onRemoveLayer}tooltipType="error"IconComponent={Trash}@@ -170,14 +173,14 @@ function LayerPanelHeaderFactory() {<PanelHeaderActionclassName="layer__visibility-toggle"id={layerId}- tooltip={isVisible ? 'hide layer' : 'show layer'}+ tooltip={isVisible ? 'tooltip.hideLayer' : 'tooltip.showLayer'}onClick={onToggleVisibility}IconComponent={isVisible ? EyeSeen : EyeUnseen}/><PanelHeaderActionclassName="layer__enable-config"id={layerId}- tooltip={'Layer settings'}+ tooltip={'tooltip.layerSettings'}onClick={onToggleEnableConfig}IconComponent={ArrowDown}/>diff --git a/src/components/side-panel/layer-panel/layer-type-selector.js b/src/components/side-panel/layer-panel/layer-type-selector.jsindex e07c019b5..75bd10eb1 100644--- a/src/components/side-panel/layer-panel/layer-type-selector.js+++ b/src/components/side-panel/layer-panel/layer-type-selector.js@@ -28,6 +28,7 @@ import ItemSelector from 'components/common/item-selector/item-selector';import {CLOUDFRONT} from 'constants/default-settings';import {SidePanelSection} from 'components/common/styled-components';+import {FormattedMessage} from 'react-intl';const ITEM_SIZE = {large: 60,@@ -99,7 +100,12 @@ const LayerTypeListItem = ({value, isTile}) => (<div className="layer-type-selector__item__icon"><value.icon height={`${isTile ? ITEM_SIZE.large : ITEM_SIZE.small}px`} /></div>- <div className="layer-type-selector__item__label">{value.label}</div>+ <div className="layer-type-selector__item__label">+ <FormattedMessage+ id={`layer.type.${value.label.toLowerCase()}`}+ defaultMessage={value.label}+ />+ </div></StyledListItem>);@@ -145,7 +151,7 @@ const LayerTypeSelector = ({layer, layerTypeOptions, onSelect}) => (selectedItems={layerTypeOptions.find(op => op.id === layer.type)}options={layerTypeOptions}multiSelect={false}- placeholder="Select A Type"+ placeholder="placeholder.selectType"onChange={onSelect}getOptionValue={op => op.id}filterOption="label"diff --git a/src/components/side-panel/layer-panel/text-label-panel.js b/src/components/side-panel/layer-panel/text-label-panel.jsindex 222ce0802..a8082cd4f 100644--- a/src/components/side-panel/layer-panel/text-label-panel.js+++ b/src/components/side-panel/layer-panel/text-label-panel.js@@ -20,13 +20,14 @@import React, {Component} from 'react';import PropTypes from 'prop-types';+import {FormattedMessage} from 'react-intl';import {+ Button,PanelLabel,- SidePanelSection,- SpaceBetweenFlexbox,SBFlexboxItem,- Button+ SidePanelSection,+ SpaceBetweenFlexbox} from 'components/common/styled-components';import {Add} from 'components/common/icons';import ColorSelector from './color-selector';@@ -40,7 +41,7 @@ import RangeSlider from 'components/common/range-slider';import {LAYER_TEXT_CONFIGS} from 'layers/layer-factory';-export default class TextLabelPanel extends Component {+class TextLabelPanel extends Component {static propTypes = {fields: PropTypes.arrayOf(PropTypes.object),textLabel: PropTypes.arrayOf(PropTypes.object),@@ -51,7 +52,7 @@ export default class TextLabelPanel extends Component {const {updateLayerTextLabel, textLabel, fields} = this.props;const currentFields = textLabel.map(tl => tl.field && tl.field.name).filter(d => d);return (- <LayerConfigGroup label={'label'} collapsible>+ <LayerConfigGroup label={'panel.text.label'} collapsible><ConfigGroupCollapsibleHeader><FieldSelectorfields={fields}@@ -63,18 +64,22 @@ export default class TextLabelPanel extends Component {<ConfigGroupCollapsibleContent>{textLabel.map((tl, idx) => (<div key={tl.field ? tl.field.name : `null-${idx}`}>- <PanelLabel>{`Label ${idx + 1}`}</PanelLabel>+ <PanelLabel>+ <FormattedMessage id={'panel.text.labelWithId'} values={{labelId: idx + 1}} />+ </PanelLabel><SidePanelSection><FieldSelectorfields={fields}- value={(tl.field && tl.field.name) || 'Select a field'}- placeholder={'empty'}+ value={(tl.field && tl.field.name) || 'placeholder.selectField'}+ placeholder={'placeholder.empty'}onSelect={v => updateLayerTextLabel(idx, 'field', v)}erasable/></SidePanelSection><SidePanelSection>- <PanelLabel>{`Font size`}</PanelLabel>+ <PanelLabel>+ <FormattedMessage id="panel.text.fontSize" />+ </PanelLabel><RangeSlider{...LAYER_TEXT_CONFIGS.fontSize}value1={tl.size}@@ -83,7 +88,9 @@ export default class TextLabelPanel extends Component {/></SidePanelSection><SidePanelSection>- <PanelLabel>{`Font color`}</PanelLabel>+ <PanelLabel>+ <FormattedMessage id="panel.text.fontColor" />+ </PanelLabel><ColorSelectorcolorSets={[{@@ -96,7 +103,9 @@ export default class TextLabelPanel extends Component {<SidePanelSection><SpaceBetweenFlexbox><SBFlexboxItem>- <PanelLabel>{`Text anchor`}</PanelLabel>+ <PanelLabel>+ <FormattedMessage id="panel.text.textAnchor" />+ </PanelLabel><ItemSelector{...LAYER_TEXT_CONFIGS.textAnchor}selectedItems={tl.anchor}@@ -104,7 +113,9 @@ export default class TextLabelPanel extends Component {/></SBFlexboxItem><SBFlexboxItem>- <PanelLabel>{`Alignment`}</PanelLabel>+ <PanelLabel>+ <FormattedMessage id="panel.text.alignment" />+ </PanelLabel><ItemSelector{...LAYER_TEXT_CONFIGS.textAlignment}selectedItems={tl.alignment}@@ -118,7 +129,7 @@ export default class TextLabelPanel extends Component {<SidePanelSection><Button link onClick={val => updateLayerTextLabel(textLabel.length)}><Add height="12px" />- Add More Label+ <FormattedMessage id="panel.text.addMoreLabel" /></Button></SidePanelSection></ConfigGroupCollapsibleContent>@@ -126,3 +137,5 @@ export default class TextLabelPanel extends Component {);}}++export default TextLabelPanel;diff --git a/src/components/side-panel/layer-panel/vis-config-by-field-selector.js b/src/components/side-panel/layer-panel/vis-config-by-field-selector.jsindex 7e6bbf7fe..399071f62 100644--- a/src/components/side-panel/layer-panel/vis-config-by-field-selector.js+++ b/src/components/side-panel/layer-panel/vis-config-by-field-selector.js@@ -20,14 +20,15 @@import React, {Component} from 'react';import PropTypes from 'prop-types';+import {FormattedMessage, injectIntl} from 'react-intl';import {PanelLabel, PanelLabelWrapper, SidePanelSection} from 'components/common/styled-components';import FieldSelector from 'components/common/field-selector';import InfoHelper from 'components/common/info-helper';import DimensionScaleSelector from './dimension-scale-selector';-import {capitalizeFirstLetter} from 'utils/utils';+import {camelize} from 'utils/utils';-export default class VisConfigByFieldSelector extends Component {+class VisConfigByFieldSelector extends Component {static propTypes = {channel: PropTypes.string.isRequired,fields: PropTypes.arrayOf(PropTypes.any).isRequired,@@ -50,17 +51,39 @@ export default class VisConfigByFieldSelector extends Component {};render() {- const {property, showScale, selectedField, description, scaleOptions = []} = this.props;+ const {+ property,+ showScale,+ selectedField,+ description,+ label,+ intl,+ scaleOptions = []+ } = this.props;return (<SidePanelSection><SidePanelSection><PanelLabelWrapper><PanelLabel>- {this.props.label || `${capitalizeFirstLetter(property)} based on`}+ {(label && <FormattedMessage id={label} />) || (+ <FormattedMessage+ id="layer.propertyBasedOn"+ values={{+ property: intl.formatMessage({+ id: `property.${camelize(property)}`,+ defaultMessage: property+ })+ }}+ />+ )}</PanelLabel>{description && (- <InfoHelper description={description} id={`${this.props.id}-${property}`} />+ <InfoHelper+ description={description}+ property={property}+ id={`${this.props.id}-${property}`}+ />)}</PanelLabelWrapper><FieldSelector@@ -86,3 +109,5 @@ export default class VisConfigByFieldSelector extends Component {);}}++export default injectIntl(VisConfigByFieldSelector);diff --git a/src/components/side-panel/layer-panel/vis-config-slider.js b/src/components/side-panel/layer-panel/vis-config-slider.jsindex 4e65401b4..606dcc2e6 100644--- a/src/components/side-panel/layer-panel/vis-config-slider.js+++ b/src/components/side-panel/layer-panel/vis-config-slider.js@@ -20,10 +20,10 @@import React from 'react';import PropTypes from 'prop-types';-import {SidePanelSection, PanelLabel} from 'components/common/styled-components';-import {capitalizeFirstLetter} from 'utils/utils';+import {PanelLabel, SidePanelSection} from 'components/common/styled-components';import RangeSlider from 'components/common/range-slider';+import {FormattedMessage} from 'react-intl';const propTypes = {layer: PropTypes.object.isRequired,@@ -51,11 +51,13 @@ export const VisConfigSlider = ({<SidePanelSection disabled={Boolean(disabled)}>{label ? (<PanelLabel>- {typeof label === 'string'- ? label- : typeof label === 'function'- ? label(config)- : capitalizeFirstLetter(property)}+ {typeof label === 'string' ? (+ <FormattedMessage id={label} />+ ) : typeof label === 'function' ? (+ <FormattedMessage id={label(config)} />+ ) : (+ <FormattedMessage id={`property.${property}`} />+ )}</PanelLabel>) : null}<RangeSliderdiff --git a/src/components/side-panel/layer-panel/vis-config-switch.js b/src/components/side-panel/layer-panel/vis-config-switch.jsindex ea75ac270..55d705929 100644--- a/src/components/side-panel/layer-panel/vis-config-switch.js+++ b/src/components/side-panel/layer-panel/vis-config-switch.js@@ -25,6 +25,7 @@ import InfoHelper from 'components/common/info-helper';import Switch from 'components/common/switch';import {SidePanelSection, PanelLabel} from 'components/common/styled-components';import {capitalizeFirstLetter} from 'utils/utils';+import {FormattedMessage} from 'react-intl';const propTypes = {layer: PropTypes.object.isRequired,@@ -55,7 +56,11 @@ const VisConfigSwitch = ({<SidePanelSection disabled={Boolean(disabled)}><StyledVisConfigSwitch className="vis-config-switch"><div className="vis-config-switch__title">- {label ? <PanelLabel>{label || capitalizeFirstLetter(property)}</PanelLabel> : null}+ {label ? (+ <PanelLabel>+ {(label && <FormattedMessage id={label} />) || capitalizeFirstLetter(property)}+ </PanelLabel>+ ) : null}{description ? (<div><InfoHelper description={description} id={`${id}-${property}-description`} />diff --git a/src/components/side-panel/map-manager.js b/src/components/side-panel/map-manager.jsindex 32659c41d..153c7d38c 100644--- a/src/components/side-panel/map-manager.js+++ b/src/components/side-panel/map-manager.js@@ -29,11 +29,12 @@ import {Add} from 'components/common/icons';import {DEFAULT_LAYER_GROUPS} from 'constants/default-settings';import ColorSelector from './layer-panel/color-selector';import {createSelector} from 'reselect';+import {FormattedMessage, injectIntl} from 'react-intl';MapManagerFactory.deps = [MapStyleSelectorFactory, LayerGroupSelectorFactory];function MapManagerFactory(MapStyleSelector, LayerGroupSelector) {- return class MapManager extends Component {+ class MapManager extends Component {static propTypes = {mapStyle: PropTypes.object.isRequired,onConfigChange: PropTypes.func.isRequired,@@ -47,18 +48,6 @@ function MapManagerFactory(MapStyleSelector, LayerGroupSelector) {buildingColorSelector = props => props.mapStyle.threeDBuildingColor;setColorSelector = props => props.set3dBuildingColor;- colorSetSelector = createSelector(- this.buildingColorSelector,- this.setColorSelector,- (selectedColor, setColor) => [- {- selectedColor,- setColor,- isRange: false,- label: '3D Building Color'- }- ]- );_updateConfig = newProp => {const newConfig = {...this.props.mapStyle, ...newProp};@@ -75,10 +64,23 @@ function MapManagerFactory(MapStyleSelector, LayerGroupSelector) {};render() {- const {mapStyle} = this.props;+ const {mapStyle, intl} = this.props;const editableLayers = DEFAULT_LAYER_GROUPS.map(lg => lg.slug);const hasBuildingLayer = mapStyle.visibleLayerGroups['3d building'];- const colorSets = this.colorSetSelector(this.props);+ const colorSetSelector = createSelector(+ this.buildingColorSelector,+ this.setColorSelector,+ (selectedColor, setColor) => [+ {+ selectedColor,+ setColor,+ isRange: false,+ label: intl.formatMessage({id: 'mapManager.3dBuildingColor'})+ }+ ]+ );++ const colorSets = colorSetSelector(this.props);return (<div className="map-style-panel">@@ -106,13 +108,14 @@ function MapManagerFactory(MapStyleSelector, LayerGroupSelector) {secondary><Add height="12px" />- Add Map Style+ <FormattedMessage id={'mapManager.addMapStyle'} /></Button></div></div>);}- };+ }+ return injectIntl(MapManager);}export default MapManagerFactory;diff --git a/src/components/side-panel/map-style-panel/map-layer-selector.js b/src/components/side-panel/map-style-panel/map-layer-selector.jsindex 66c34ba50..f404f29c9 100644--- a/src/components/side-panel/map-style-panel/map-layer-selector.js+++ b/src/components/side-panel/map-style-panel/map-layer-selector.js@@ -30,6 +30,8 @@ import {PanelLabelWrapper,CenterFlexbox} from 'components/common/styled-components';+import {FormattedMessage} from 'react-intl';+import {camelize} from 'utils/utils';const StyledInteractionPanel = styled.div`padding-bottom: 12px;@@ -57,7 +59,9 @@ function LayerGroupSelectorFactory() {const LayerGroupSelector = ({layers, editableLayers, onChange, topLayers}) => (<StyledInteractionPanel className="map-style__layer-group__selector"><div className="layer-group__header">- <PanelLabel>Map Layers</PanelLabel>+ <PanelLabel>+ <FormattedMessage id={'mapLayers.title'} />+ </PanelLabel></div><PanelContent className="map-style__layer-group">{editableLayers.map(slug => (@@ -66,7 +70,7 @@ function LayerGroupSelectorFactory() {<PanelHeaderActionclassName="layer-group__visibility-toggle"id={`${slug}-toggle`}- tooltip={layers[slug] ? 'hide' : 'show'}+ tooltip={layers[slug] ? 'tooltip.hide' : 'tooltip.show'}onClick={() =>onChange({visibleLayerGroups: {@@ -79,12 +83,14 @@ function LayerGroupSelectorFactory() {active={layers[slug]}flush/>- <LayerLabel active={layers[slug]}>{slug}</LayerLabel>+ <LayerLabel active={layers[slug]}>+ <FormattedMessage id={`mapLayers.${camelize(slug)}`} />+ </LayerLabel></PanelLabelWrapper><CenterFlexbox className="layer-group__bring-top"><PanelHeaderActionid={`${slug}-top`}- tooltip="Move to top of data layers"+ tooltip="tooltip.moveToTop"disabled={!layers[slug]}IconComponent={Upload}active={topLayers[slug]}diff --git a/src/components/side-panel/map-style-panel/map-style-selector.js b/src/components/side-panel/map-style-panel/map-style-selector.jsindex 82f7bf093..d42b0d9e2 100644--- a/src/components/side-panel/map-style-panel/map-style-selector.js+++ b/src/components/side-panel/map-style-panel/map-style-selector.js@@ -25,11 +25,12 @@ import {ArrowDown} from 'components/common/icons';import PanelHeaderAction from 'components/side-panel/panel-header-action';import {- PanelLabel,- PanelHeaderTitle,PanelHeaderContent,+ PanelHeaderTitle,+ PanelLabel,StyledPanelHeader} from 'components/common/styled-components';+import {FormattedMessage} from 'react-intl';const StyledMapDropdown = styled(StyledPanelHeader)`height: 48px;@@ -63,7 +64,9 @@ const StyledMapDropdown = styled(StyledPanelHeader)`function MapStyleSelectorFactory() {const MapStyleSelector = ({mapStyle, onChange, toggleActive, isSelecting}) => (<div>- <PanelLabel>Map style</PanelLabel>+ <PanelLabel>+ <FormattedMessage id={'mapManager.mapStyle'} />+ </PanelLabel>{Object.keys(mapStyle.mapStyles).map(op => (<StyledMapDropdownclassName={classnames('map-dropdown-option', {@@ -83,7 +86,7 @@ function MapStyleSelectorFactory() {className="map-dropdown-option__enable-config"id="map-enable-config"IconComponent={ArrowDown}- tooltip={'Select Base Map Style'}+ tooltip={'tooltip.selectBaseMapStyle'}onClick={toggleActive}/>) : null}diff --git a/src/components/side-panel/panel-header-action.js b/src/components/side-panel/panel-header-action.jsindex a3d791f71..c9db17b21 100644--- a/src/components/side-panel/panel-header-action.js+++ b/src/components/side-panel/panel-header-action.js@@ -22,6 +22,7 @@ import React, {Component} from 'react';import PropTypes from 'prop-types';import classnames from 'classnames';import styled from 'styled-components';+import {FormattedMessage} from 'react-intl';import {Tooltip} from 'components/common/styled-components';const HeaderActionWrapper = styled.div`@@ -89,7 +90,9 @@ export default class PanelHeaderAction extends Component {/>{tooltip ? (<Tooltip id={`${tooltip}_${id}`} effect="solid" delayShow={500} type={tooltipType}>- <span>{tooltip}</span>+ <span>+ <FormattedMessage id={tooltip} />+ </span></Tooltip>) : null}</HeaderActionWrapper>diff --git a/src/components/side-panel/panel-header.js b/src/components/side-panel/panel-header.jsindex 5b8c78842..5d4c84a03 100644--- a/src/components/side-panel/panel-header.js+++ b/src/components/side-panel/panel-header.js@@ -28,6 +28,7 @@ import {Save, DataTable, Save2, Picture, Db, Map as MapIcon, Share} from 'componimport ClickOutsideCloseDropdown from 'components/side-panel/panel-dropdown';import Toolbar from 'components/common/toolbar';import ToolbarItem from 'components/common/toolbar-item';+import {FormattedMessage} from 'react-intl';const StyledPanelHeader = styled.div.attrs({className: 'side-side-panel__header'@@ -93,7 +94,7 @@ export const PanelAction = ({item, onClick}) => (</a>{item.tooltip ? (<Tooltip id={`${item.id}-action`} place="bottom" delayShow={500} effect="solid">- <span>{item.tooltip}</span>+ <FormattedMessage id={item.tooltip} /></Tooltip>) : null}</StyledPanelAction>@@ -153,31 +154,31 @@ export const SaveExportDropdownFactory = PanelHeaderDropdown => {SaveExportDropdown.defaultProps = {items: [{- label: 'Export Image',+ label: 'toolbar.exportImage',icon: Picture,key: 'image',onClick: props => props.onExportImage},{- label: 'Export Data',+ label: 'toolbar.exportData',icon: DataTable,key: 'data',onClick: props => props.onExportData},{- label: 'Export Map',+ label: 'toolbar.exportMap',icon: MapIcon,key: 'map',onClick: props => props.onExportMap},{- label: 'Save Map',+ label: 'toolbar.saveMap',icon: Save2,key: 'save',onClick: props => props.onSaveMap},{- label: 'Share Map URL',+ label: 'toolbar.shareMapURL',icon: Share,key: 'share',onClick: props => props.onShareMap@@ -247,7 +248,7 @@ function PanelHeaderFactory(SaveExportDropdown, CloudStorageDropdown) {{id: 'storage',iconComponent: Db,- tooltip: 'Cloud Storage',+ tooltip: 'tooltip.cloudStorage',onClick: () => {},dropdownComponent: CloudStorageDropdown},diff --git a/src/components/side-panel/panel-toggle.js b/src/components/side-panel/panel-toggle.jsindex ab5443630..818e2b23f 100644--- a/src/components/side-panel/panel-toggle.js+++ b/src/components/side-panel/panel-toggle.js@@ -21,6 +21,7 @@import React from 'react';import PropTypes from 'prop-types';import styled from 'styled-components';+import {FormattedMessage} from 'react-intl';import {Tooltip} from 'components/common/styled-components';const propTypes = {@@ -71,7 +72,9 @@ const PanelToggleFactory = () => {><panel.iconComponent height="20px" /><Tooltip id={`${panel.id}-nav`} effect="solid" delayShow={500} place="bottom">- <span>{panel.label || panel.id}</span>+ <span>+ <FormattedMessage id={panel.label || panel.id} />+ </span></Tooltip></PanelTab>))}diff --git a/src/constants/action-types.js b/src/constants/action-types.jsindex 6f3b65f53..5a21ee0a7 100644--- a/src/constants/action-types.js+++ b/src/constants/action-types.js@@ -131,6 +131,7 @@ const ActionTypes = keyMirror({TOGGLE_MAP_CONTROL: null,ADD_NOTIFICATION: null,REMOVE_NOTIFICATION: null,+ SET_LOCALE: null,// uiState > export imageSET_EXPORT_IMAGE_SETTING: null,diff --git a/src/constants/default-settings.js b/src/constants/default-settings.jsindex d0e892276..4f52a1ed3 100644--- a/src/constants/default-settings.js+++ b/src/constants/default-settings.js@@ -158,25 +158,56 @@ export const THEME = keyMirror({base: null});+/**+ * Localization can be passed to `KeplerGl` via uiState `locale`.+ * Available languages are `en` and `fi`. Default language is `en`+ * @constant+ * @type {string}+ * @public+ * @example+ * ```js+ * import {combineReducers} from 'redux';+ * import keplerGlReducer from 'kepler.gl/reducers';+ * import {LOCALES} from 'kepler.gl/constants';+ *+ * const customizedKeplerGlReducer = keplerGlReducer+ * .initialState({+ * uiState: {+ * // use Finnish locale+ * locale: LOCALES.fi+ * }+ * });+ *+ * const reducers = combineReducers({+ * keplerGl: customizedKeplerGlReducer,+ * app: appReducer+ * });+ * ```+ */+export const LOCALES = keyMirror({+ en: null,+ fi: null+});+export const SIDEBAR_PANELS = [{id: 'layer',- label: 'Layers',+ label: 'sidebar.panels.layer',iconComponent: Layers},{id: 'filter',- label: 'Filters',+ label: 'sidebar.panels.filter',iconComponent: FilterFunnel},{id: 'interaction',- label: 'Interactions',+ label: 'sidebar.panels.interaction',iconComponent: CursorClick},{id: 'map',- label: 'Base map',+ label: 'sidebar.panels.basemap',iconComponent: Settings}];@@ -621,16 +652,19 @@ export const NO_VALUE_COLOR = [0, 0, 0, 0];export const LAYER_BLENDINGS = {additive: {+ label: 'layerBlending.additive',blendFunc: ['SRC_ALPHA', 'DST_ALPHA'],blendEquation: 'FUNC_ADD'},normal: {// reference to// https://limnu.com/webgl-blending-youre-probably-wrong/+ label: 'layerBlending.normal',blendFunc: ['SRC_ALPHA', 'ONE_MINUS_SRC_ALPHA', 'ONE', 'ONE_MINUS_SRC_ALPHA'],blendEquation: ['FUNC_ADD', 'FUNC_ADD']},subtractive: {+ label: 'layerBlending.subtractive',blendFunc: ['ONE', 'ONE_MINUS_DST_COLOR', 'SRC_ALPHA', 'DST_ALPHA'],blendEquation: ['FUNC_SUBTRACT', 'FUNC_ADD']}@@ -653,18 +687,18 @@ export const EXPORT_IMG_RATIOS = keyMirror({export const EXPORT_IMG_RATIO_OPTIONS = [{id: EXPORT_IMG_RATIOS.SCREEN,- label: 'Original Screen',+ label: 'modal.exportImage.ratioOriginalScreen',getSize: (screenW, screenH) => ({width: screenW, height: screenH})},{id: EXPORT_IMG_RATIOS.CUSTOM,hidden: true,- label: 'Custom',+ label: 'modal.exportImage.ratioCustom',getSize: (mapW, mapH) => ({width: mapW, height: mapH})},{id: EXPORT_IMG_RATIOS.FOUR_BY_THREE,- label: '4:3',+ label: 'modal.exportImage.ratio4_3',getSize: (screenW, screenH) => ({width: screenW,height: Math.round(screenW * 0.75)@@ -672,7 +706,7 @@ export const EXPORT_IMG_RATIO_OPTIONS = [},{id: EXPORT_IMG_RATIOS.SIXTEEN_BY_NINE,- label: '16:9',+ label: 'modal.exportImage.ratio16_9',getSize: (screenW, screenH) => ({width: screenW,height: Math.round(screenW * 0.5625)@@ -759,7 +793,7 @@ export const EXPORT_MAP_FORMAT_OPTIONS = Object.entries(EXPORT_MAP_FORMATS).map(export const EXPORT_HTML_MAP_MODE_OPTIONS = Object.entries(EXPORT_HTML_MAP_MODES).map(entry => ({id: entry[0],- label: entry[1].toLowerCase(),+ label: `modal.exportMap.html.${entry[1].toLowerCase()}`,available: true,url: getHTMLMapModeTileUrl(entry[1])}));@@ -780,15 +814,6 @@ export const DEFAULT_NOTIFICATION_TOPICS = keyMirror({file: null});-export const TOKEN_MISUSE_WARNING =- '* If you do not provide your own token, the map may fail to display at any time when we replace ours to avoid misuse. ';-export const DISCLAIMER =- 'You can change the Mapbox token later using the following instructions: ';-export const MAP_CONFIG_DESCRIPTION =- 'Map config will be included in the Json file. If you are using kepler.gl in your own app. You can copy this config and pass it to ';-export const SHARE_DISCLAIMER =- 'kepler.gl will save your map data to your personal cloud storage, only people with the URL can access your map and data. ' +- 'You can edit/delete the data file in your cloud account anytime.';// Animationexport const BASE_SPEED = 600;export const DEFAULT_TIME_FORMAT = 'MM/DD/YY HH:mm:ssa';diff --git a/src/constants/index.js b/src/constants/index.jsindex 8e94baf99..fecb9f267 100644--- a/src/constants/index.js+++ b/src/constants/index.js@@ -58,7 +58,8 @@ export {SCALE_TYPES,THEME,TRIP_ARC_FIELDS,- TRIP_POINT_FIELDS+ TRIP_POINT_FIELDS,+ LOCALES} from './default-settings';export {GITHUB_BUG_REPORT, GITHUB_USER_GUIDE} from './user-guides';diff --git a/src/layers/aggregation-layer.js b/src/layers/aggregation-layer.jsindex e1f2c62f9..efdd2e4c1 100644--- a/src/layers/aggregation-layer.js+++ b/src/layers/aggregation-layer.js@@ -89,7 +89,7 @@ export default class AggregationLayer extends Layer {color: {aggregation: 'colorAggregation',channelScaleType: CHANNEL_SCALES.colorAggr,- defaultMeasure: 'Point Count',+ defaultMeasure: 'property.pointCount',domain: 'colorDomain',field: 'colorField',key: 'color',@@ -101,7 +101,7 @@ export default class AggregationLayer extends Layer {aggregation: 'sizeAggregation',channelScaleType: CHANNEL_SCALES.sizeAggr,condition: config => config.visConfig.enable3d,- defaultMeasure: 'Point Count',+ defaultMeasure: 'property.pointCount',domain: 'sizeDomain',field: 'sizeField',key: 'size',diff --git a/src/layers/arc-layer/arc-layer.js b/src/layers/arc-layer/arc-layer.jsindex 2c6d7337b..ec2f00789 100644--- a/src/layers/arc-layer/arc-layer.js+++ b/src/layers/arc-layer/arc-layer.js@@ -37,10 +37,10 @@ export const arcPosAccessor = ({lat0, lng0, lat1, lng1}) => d => [export const arcRequiredColumns = ['lat0', 'lng0', 'lat1', 'lng1'];export const arcColumnLabels = {- lat0: 'source lat',- lng0: 'source lng',- lat1: 'target lat',- lng1: 'target lng'+ lat0: 'arc.lat0',+ lng0: 'arc.lng0',+ lat1: 'arc.lat1',+ lng1: 'arc.lng1'};export const arcVisConfigs = {diff --git a/src/layers/cluster-layer/cluster-layer.js b/src/layers/cluster-layer/cluster-layer.jsindex 14967e124..9e97acd2c 100644--- a/src/layers/cluster-layer/cluster-layer.js+++ b/src/layers/cluster-layer/cluster-layer.js@@ -52,7 +52,7 @@ export default class ClusterLayer extends AggregationLayer {color: {aggregation: 'colorAggregation',channelScaleType: CHANNEL_SCALES.colorAggr,- defaultMeasure: 'Point Count',+ defaultMeasure: 'property.pointCount',domain: 'colorDomain',field: 'colorField',key: 'color',diff --git a/src/layers/grid-layer/grid-layer.js b/src/layers/grid-layer/grid-layer.jsindex 770dbba25..9f0394752 100644--- a/src/layers/grid-layer/grid-layer.js+++ b/src/layers/grid-layer/grid-layer.js@@ -43,7 +43,7 @@ export default class GridLayer extends AggregationLayer {super(props);this.registerVisConfig(gridVisConfigs);- this.visConfigSettings.worldUnitSize.label = 'Grid Size (km)';+ this.visConfigSettings.worldUnitSize.label = 'columns.grid.worldUnitSize';}get type() {diff --git a/src/layers/heatmap-layer/heatmap-layer.js b/src/layers/heatmap-layer/heatmap-layer.jsindex cd510bdb6..8738940ca 100644--- a/src/layers/heatmap-layer/heatmap-layer.js+++ b/src/layers/heatmap-layer/heatmap-layer.js@@ -96,7 +96,7 @@ class HeatmapLayer extends MapboxGLLayer {key: 'weight',// supportedFieldTypes can be determined by channelScaleType// or specified here- defaultMeasure: 'density',+ defaultMeasure: 'property.density',supportedFieldTypes: [ALL_FIELD_TYPES.real, ALL_FIELD_TYPES.integer],channelScaleType: CHANNEL_SCALES.size}@@ -110,12 +110,12 @@ class HeatmapLayer extends MapboxGLLayer {getVisualChannelDescription(channel) {return channel === 'color'? {- label: 'color',- measure: 'Density'+ label: 'property.color',+ measure: 'property.density'}: {- label: 'weight',- measure: this.config.weightField ? this.config.weightField.name : 'Density'+ label: 'property.weight',+ measure: this.config.weightField ? this.config.weightField.name : 'property.density'};}diff --git a/src/layers/hexagon-layer/hexagon-layer.js b/src/layers/hexagon-layer/hexagon-layer.jsindex 3e3dd5d79..1b1134015 100644--- a/src/layers/hexagon-layer/hexagon-layer.js+++ b/src/layers/hexagon-layer/hexagon-layer.js@@ -45,7 +45,7 @@ export default class HexagonLayer extends AggregationLayer {super(props);this.registerVisConfig(hexagonVisConfigs);- this.visConfigSettings.worldUnitSize.label = 'Hexagon Radius (km)';+ this.visConfigSettings.worldUnitSize.label = 'columns.hexagon.worldUnitSize';}get type() {diff --git a/src/layers/icon-layer/icon-info-modal.js b/src/layers/icon-layer/icon-info-modal.jsindex ee4dd0544..c9196c04f 100644--- a/src/layers/icon-layer/icon-info-modal.js+++ b/src/layers/icon-layer/icon-info-modal.js@@ -22,6 +22,7 @@ import React from 'react';import styled from 'styled-components';import {line} from 'd3-shape';import {Table, CenterFlexbox} from 'components/common/styled-components';+import { FormattedMessage } from "react-intl";const lineFunction = line().x(d => d[0] * 10)@@ -123,20 +124,16 @@ const IconInfoModalFactory = (svgIcons = []) => {const IconInfoModal = () => (<div className="icon-info-modal"><div className="icon-info-modal__description">- <span>- In your csv, create a column, put the name of the icon you want to draw in it. You can- leave the cell empty if you do not want the icon to show for some points. When the column- is named{' '}- </span>- <code>icon</code>- <span> kepler.gl will automatically create a icon layer for you.</span>+ <FormattedMessage id={'modal.iconInfo.description1'} />{' '}+ <code><FormattedMessage id={'modal.iconInfo.code'} /></code>+ <FormattedMessage id={'modal.iconInfo.description2'}/></div><div className="icon-info-modal__example">- <StyledTitle>Example:</StyledTitle>+ <StyledTitle><FormattedMessage id={'modal.iconInfo.example'}/></StyledTitle><ExampleTable /></div><div className="icon-info-modal__icons">- <StyledTitle>Icons</StyledTitle>+ <StyledTitle><FormattedMessage id={'modal.iconInfo.icons'}/></StyledTitle><IconTable className="icon-info-modal__icons__table">{svgIcons.map(icon => (<IconItem key={icon.id} icon={icon} />diff --git a/src/layers/icon-layer/icon-layer.js b/src/layers/icon-layer/icon-layer.jsindex 80fe2f010..9fde08c48 100644--- a/src/layers/icon-layer/icon-layer.js+++ b/src/layers/icon-layer/icon-layer.js@@ -105,7 +105,7 @@ export default class IconLayer extends Layer {id: 'iconInfo',template: this._layerInfoModal,modalProps: {- title: 'How to draw icons'+ title: 'modal.iconInfo.title'}};}diff --git a/src/layers/layer-factory.js b/src/layers/layer-factory.jsindex 272010a4b..3821ce4a5 100644--- a/src/layers/layer-factory.js+++ b/src/layers/layer-factory.js@@ -48,7 +48,7 @@ export const DEFAULT_TEXT_LABEL = {export const DEFAULT_COLOR_RANGE = DefaultColorRange;export const DEFAULT_CUSTOM_PALETTE = {- name: 'Custom Palette',+ name: 'color.customPalette',type: 'custom',category: 'Custom',colors: []@@ -74,7 +74,7 @@ export const LAYER_VIS_CONFIGS = {thickness: {type: 'number',defaultValue: 2,- label: 'Stroke Width',+ label: 'layerVisConfigs.strokeWidth',isRanged: false,range: [0, 100],step: 0.1,@@ -84,7 +84,7 @@ export const LAYER_VIS_CONFIGS = {strokeWidthRange: {type: 'number',defaultValue: [0, 10],- label: 'Stroke Width Range',+ label: 'layerVisConfigs.strokeWidthRange',isRanged: true,range: [0, 200],step: 0.1,@@ -94,7 +94,7 @@ export const LAYER_VIS_CONFIGS = {trailLength: {type: 'number',defaultValue: 180,- label: 'Stroke Width',+ label: 'layerVisConfigs.strokeWidth',isRanged: false,range: [1, 1000],step: 1,@@ -105,7 +105,7 @@ export const LAYER_VIS_CONFIGS = {radius: {type: 'number',defaultValue: 10,- label: 'Radius',+ label: 'layerVisConfigs.radius',isRanged: false,range: [0, 100],step: 0.1,@@ -115,8 +115,8 @@ export const LAYER_VIS_CONFIGS = {fixedRadius: {defaultValue: false,type: 'boolean',- label: 'Fixed Radius to meter',- description: 'Map radius to absolute radius in meters, e.g. 5 to 5 meters',+ label: 'layerVisConfigs.fixedRadius',+ description: 'layerVisConfigs.fixedRadiusDescription',group: PROPERTY_GROUPS.radius,property: 'fixedRadius'},@@ -126,13 +126,13 @@ export const LAYER_VIS_CONFIGS = {isRanged: true,range: [0, 500],step: 0.1,- label: 'Radius Range',+ label: 'layerVisConfigs.radiusRange',group: PROPERTY_GROUPS.radius,property: 'radiusRange'},clusterRadius: {type: 'number',- label: 'Cluster Radius in Pixels',+ label: 'layerVisConfigs.clusterRadius',defaultValue: 40,isRanged: false,range: [1, 500],@@ -142,7 +142,7 @@ export const LAYER_VIS_CONFIGS = {},clusterRadiusRange: {type: 'number',- label: 'Radius Range in pixels',+ label: 'layerVisConfigs.radiusRangePixels',defaultValue: [1, 40],isRanged: true,range: [1, 150],@@ -153,7 +153,7 @@ export const LAYER_VIS_CONFIGS = {opacity: {type: 'number',defaultValue: DEFAULT_LAYER_OPACITY,- label: 'Opacity',+ label: 'layerVisConfigs.opacity',isRanged: false,range: [0, 1],step: 0.01,@@ -163,7 +163,7 @@ export const LAYER_VIS_CONFIGS = {coverage: {type: 'number',defaultValue: 1,- label: 'Coverage',+ label: 'layerVisConfigs.coverage',isRanged: false,range: [0, 1],step: 0.01,@@ -174,34 +174,34 @@ export const LAYER_VIS_CONFIGS = {outline: {type: 'boolean',defaultValue: false,- label: 'Outline',+ label: 'layer.outline',group: PROPERTY_GROUPS.display,property: 'outline'},colorRange: {type: 'color-range-select',defaultValue: DefaultColorRange,- label: 'Color range',+ label: 'layerVisConfigs.colorRange',group: PROPERTY_GROUPS.color,property: 'colorRange'},strokeColorRange: {type: 'color-range-select',defaultValue: DefaultColorRange,- label: 'Stroke Color range',+ label: 'layerVisConfigs.strokeColorRange',group: PROPERTY_GROUPS.color,property: 'strokeColorRange'},targetColor: {type: 'color-select',- label: 'Target Color',+ label: 'layerVisConfigs.targetColor',defaultValue: null,group: PROPERTY_GROUPS.color,property: 'targetColor'},strokeColor: {type: 'color-select',- label: 'Stroke Color',+ label: 'layerVisConfigs.strokeColor',defaultValue: null,group: PROPERTY_GROUPS.color,property: 'strokeColor'@@ -209,7 +209,7 @@ export const LAYER_VIS_CONFIGS = {aggregation: {type: 'select',defaultValue: AGGREGATION_TYPES.average,- label: 'Color Aggregation',+ label: 'layerVisConfigs.colorAggregation',// aggregation options are based on color field typesoptions: Object.keys(AGGREGATION_TYPES),group: PROPERTY_GROUPS.color,@@ -219,7 +219,7 @@ export const LAYER_VIS_CONFIGS = {sizeAggregation: {type: 'select',defaultValue: AGGREGATION_TYPES.average,- label: 'Height Aggregation',+ label: 'layerVisConfigs.heightAggregation',// aggregation options are based on color field typesoptions: Object.keys(AGGREGATION_TYPES),group: PROPERTY_GROUPS.height,@@ -262,7 +262,7 @@ export const LAYER_VIS_CONFIGS = {resolution: {type: 'number',defaultValue: 8,- label: 'Resolution range',+ label: 'layerVisConfigs.resolution',isRanged: false,range: [0, 13],step: 1,@@ -272,7 +272,7 @@ export const LAYER_VIS_CONFIGS = {sizeScale: {type: 'number',defaultValue: 10,- label: 'Size Scale',+ label: 'layerVisConfigs.sizeScale',isRanged: false,range: [1, 1000],step: 1,@@ -288,7 +288,7 @@ export const LAYER_VIS_CONFIGS = {worldUnitSize: {type: 'number',defaultValue: 1,- label: 'World Unit Size',+ label: 'layerVisConfigs.worldUnitSize',isRanged: false,range: [0, 500],step: 0.0001,@@ -298,7 +298,7 @@ export const LAYER_VIS_CONFIGS = {elevationScale: {type: 'number',defaultValue: 5,- label: 'Elevation Scale',+ label: 'layerVisConfigs.elevationScale',isRanged: false,range: [0, 100],step: 0.1,@@ -308,7 +308,7 @@ export const LAYER_VIS_CONFIGS = {elevationRange: {type: 'number',defaultValue: [0, 500],- label: 'Height Scale',+ label: 'layerVisConfigs.heightScale',isRanged: true,range: [0, 1000],step: 0.01,@@ -328,7 +328,7 @@ export const LAYER_VIS_CONFIGS = {coverageRange: {type: 'number',defaultValue: [0, 1],- label: 'Coverage Range',+ label: 'layerVisConfigs.coverageRange',isRanged: true,range: [0, 1],step: 0.01,@@ -339,29 +339,29 @@ export const LAYER_VIS_CONFIGS = {'hi-precision': {type: 'boolean',defaultValue: false,- label: 'High Precision Rendering',+ label: 'layerVisConfigs.highPrecisionRendering',group: PROPERTY_GROUPS.precision,property: 'hi-precision',- description: 'High precision will result in slower performance'+ description: 'layerVisConfigs.highPrecisionRenderingDescription'},enable3d: {type: 'boolean',defaultValue: false,- label: 'Height',+ label: 'layerVisConfigs.height',group: PROPERTY_GROUPS.height,property: 'enable3d',- description: 'Click button at top right of the map to switch to 3d view'+ description: 'layerVisConfigs.heightDescription'},stroked: {type: 'boolean',- label: 'Stroke',+ label: 'layerVisConfigs.stroke',defaultValue: true,group: PROPERTY_GROUPS.display,property: 'stroked'},filled: {type: 'boolean',- label: 'Fill',+ label: 'layerVisConfigs.fill',defaultValue: false,group: PROPERTY_GROUPS.display,property: 'filled'@@ -369,14 +369,14 @@ export const LAYER_VIS_CONFIGS = {extruded: {type: 'boolean',defaultValue: false,- label: 'Enable Polygon Height',+ label: 'layerVisConfigs.enablePolygonHeight',group: PROPERTY_GROUPS.display,property: 'extruded'},wireframe: {type: 'boolean',defaultValue: false,- label: 'Show Wireframe',+ label: 'layerVisConfigs.showWireframe',group: PROPERTY_GROUPS.display,property: 'wireframe'},@@ -384,7 +384,7 @@ export const LAYER_VIS_CONFIGS = {weight: {type: 'number',defaultValue: 1,- label: 'Weight Intensity',+ label: 'layerVisConfigs.weightIntensity',isRanged: false,range: [0.01, 500],step: 0.01,@@ -395,7 +395,7 @@ export const LAYER_VIS_CONFIGS = {heatmapRadius: {type: 'number',defaultValue: 20,- label: 'Radius',+ label: 'layerVisConfigs.radius',isRanged: false,range: [0, 100],step: 0.1,diff --git a/src/layers/point-layer/point-layer.js b/src/layers/point-layer/point-layer.jsindex fb2d7f8ac..31792bb6b 100644--- a/src/layers/point-layer/point-layer.js+++ b/src/layers/point-layer/point-layer.js@@ -53,7 +53,7 @@ export const pointVisConfigs = {radiusRange: 'radiusRange',filled: {type: 'boolean',- label: 'Fill Color',+ label: 'layer.fillColor',defaultValue: true,property: 'filled'}diff --git a/src/layers/trip-layer/trip-info-modal.js b/src/layers/trip-layer/trip-info-modal.jsindex dcc8cf550..caa0ff02b 100644--- a/src/layers/trip-layer/trip-info-modal.js+++ b/src/layers/trip-layer/trip-info-modal.js@@ -20,6 +20,7 @@import React from 'react';import styled from 'styled-components';+import {FormattedMessage} from 'react-intl';const StyledCode = styled.code`color: ${props => props.theme.titleColorLT};@@ -37,16 +38,15 @@ const TripInfoModalFactory = (svgIcons = []) => {<div className="trip-info-modal"><div className="trip-info-modal__description"><p>- In order to animate the path, the geoJSON data needs to contain `LineString` in its- feature geometry, and the coordinates in the LineString need to have 4 elements in the- formats of- <code> [longitude, latitude, altitude, timestamp] </code>- with the last element being a timestamp. Valid timestamp formats include unix in seconds- such as `1564184363` or in milliseconds such as `1564184363000`.+ <FormattedMessage id={'modal.tripInfo.description1'} />+ <code>+ <FormattedMessage id={'modal.tripInfo.code'} />+ </code>+ <FormattedMessage id={'modal.tripInfo.description2'} /></p></div><div className="trip-info-modal__example">- <StyledTitle>Example:</StyledTitle>+ <StyledTitle><FormattedMessage id={'modal.tripInfo.example'} /></StyledTitle><pre><StyledCode>{`diff --git a/src/layers/trip-layer/trip-layer.js b/src/layers/trip-layer/trip-layer.jsindex 9e4d09ed7..220ddd6ac 100644--- a/src/layers/trip-layer/trip-layer.js+++ b/src/layers/trip-layer/trip-layer.js@@ -111,7 +111,7 @@ export default class TripLayer extends Layer {id: 'iconInfo',template: this._layerInfoModal,modalProps: {- title: 'How to enable trip animation'+ title: 'modal.tripInfo.title'}};}diff --git a/src/localization/en.js b/src/localization/en.jsnew file mode 100644index 000000000..f8f3d361a--- /dev/null+++ b/src/localization/en.js@@ -0,0 +1,436 @@+// Copyright (c) 2020 Uber Technologies, Inc.+//+// Permission is hereby granted, free of charge, to any person obtaining a copy+// of this software and associated documentation files (the "Software"), to deal+// in the Software without restriction, including without limitation the rights+// to use, copy, modify, merge, publish, distribute, sublicense, and/or sell+// copies of the Software, and to permit persons to whom the Software is+// furnished to do so, subject to the following conditions:+//+// The above copyright notice and this permission notice shall be included in+// all copies or substantial portions of the Software.+//+// THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR+// IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,+// FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE+// AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER+// LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM,+// OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN+// THE SOFTWARE.++export default {+ property: {+ weight: 'weight',+ label: 'label',+ fillColor: 'fill color',+ color: 'color',+ strokeColor: 'stroke color',+ radius: 'radius',+ outline: 'outline',+ stroke: 'stroke',+ density: 'density',+ height: 'height',+ sum: 'sum',+ pointCount: 'Point Count'+ },+ placeholder: {+ search: 'Search',+ selectField: 'Select a field',+ yAxis: 'Y Axis',+ selectType: 'Select A Type',+ selectValue: 'Select A Value',+ enterValue: 'Enter a value',+ empty: 'empty'+ },+ misc: {+ by: '',+ valuesIn: 'Values in',+ valueEquals: 'Value equals',+ dataSource: 'Data Source',+ brushRadius: 'Brush Radius (km)',+ empty: ' '+ },+ mapLayers: {+ title: 'Map Layers',+ label: 'Label',+ road: 'Road',+ border: 'Border',+ building: 'Building',+ water: 'Water',+ land: 'Land',+ '3dBuilding': '3d Building'+ },+ panel: {+ text: {+ label: 'label',+ labelWithId: 'Label {labelId}',+ fontSize: 'Font size',+ fontColor: 'Font color',+ textAnchor: 'Text anchor',+ alignment: 'Alignment',+ addMoreLabel: 'Add More Label'+ }+ },+ sidebar: {+ panels: {+ layer: 'Layers',+ filter: 'Filters',+ interaction: 'Interactions',+ basemap: 'Base map'+ }+ },+ layer: {+ required: 'Required*',+ radius: 'Radius',+ color: 'Color',+ fillColor: 'Fill Color',+ outline: 'Outline',+ weight: 'Weight',+ propertyBasedOn: '{property} based on',+ coverage: 'Coverage',+ stroke: 'Stroke',+ strokeWidth: 'Stroke Width',+ strokeColor: 'Stroke Color',+ basic: 'Basic',+ trailLength: 'Trail Length',+ trailLengthDescription: 'Number of seconds for a path to completely fade out',+ newLayer: 'new layer',+ elevationByDescription: 'When off, height is based on count of points',+ colorByDescription: 'When off, color is based on count of points',+ aggregateBy: 'Aggregate {field} by',+ '3DModel': '3D Model',+ '3DModelOptions': '3D Model Options',+ type: {+ point: 'point',+ arc: 'arc',+ line: 'line',+ grid: 'grid',+ hexbin: 'hexbin',+ polygon: 'polygon',+ geojson: 'geojson',+ cluster: 'cluster',+ icon: 'icon',+ heatmap: ' heatmap',+ h3: 'H3',+ trip: 'trip',+ s2: 'S2',+ '3d': '3D'+ }+ },+ layerVisConfigs: {+ strokeWidth: 'Stroke Width',+ strokeWidthRange: 'Stroke Width Range',+ radius: 'Radius',+ fixedRadius: 'Fixed Radius to meter',+ fixedRadiusDescription: 'Map radius to absolute radius in meters, e.g. 5 to 5 meters',+ radiusRange: 'Radius Range',+ clusterRadius: 'Cluster Radius in Pixels',+ radiusRangePixels: 'Radius Range in pixels',+ opacity: 'Opacity',+ coverage: 'Coverage',+ outline: 'Outline',+ colorRange: 'Color range',+ stroke: 'Stroke',+ strokeColor: 'Stroke Color',+ strokeColorRange: 'Stroke Color range',+ targetColor: 'Target Color',+ colorAggregation: 'Color Aggregation',+ heightAggregation: 'Height Aggregation',+ resolutionRange: 'Resolution range',+ sizeScale: 'Size Scale',+ worldUnitSize: 'World Unit Size',+ elevationScale: 'Elevation Scale',+ heightScale: 'Height Scale',+ coverageRange: 'Coverage Range',+ highPrecisionRendering: 'High Precision Rendering',+ highPrecisionRenderingDescription: 'High precision will result in slower performance',+ height: 'Height',+ heightDescription: 'Click button at top right of the map to switch to 3d view',+ fill: 'Fill',+ enablePolygonHeight: 'Enable Polygon Height',+ showWireframe: 'Show Wireframe',+ weightIntensity: 'Weight Intensity',+ zoomScale: 'Zoom Scale',+ heightRange: 'Height Range'+ },+ layerManager: {+ addData: 'Add Data',+ addLayer: 'Add Layer',+ layerBlending: 'Layer Blending'+ },+ mapManager: {+ mapStyle: 'Map style',+ addMapStyle: 'Add Map Style',+ '3dBuildingColor': '3D Building Color'+ },+ layerConfiguration: {+ defaultDescription: 'Calculate {property} based on selected field',+ howTo: 'How to'+ },+ filterManager: {+ addFilter: 'Add Filter'+ },+ datasetTitle: {+ showDataTable: 'Show data table',+ removeDataset: 'Remove dataset'+ },+ datasetInfo: {+ rowCount: '{rowCount} rows'+ },+ tooltip: {+ hideLayer: 'hide layer',+ showLayer: 'show layer',+ hideFeature: 'Hide Feature',+ showFeature: 'Show feature',+ hide: 'hide',+ show: 'show',+ removeLayer: 'Remove layer',+ layerSettings: 'Layer settings',+ closePanel: 'Close current panel',+ switchToDualView: 'Switch to dual map view',+ showLegend: 'show legend',+ disable3DMap: 'Disable 3D Map',+ DrawOnMap: 'Draw on map',+ selectLocale: 'Select locale',+ hideLayerPanel: 'Hide layer panel',+ showLayerPanel: 'Show layer panel',+ moveToTop: 'Move to top of data layers',+ selectBaseMapStyle: 'Select Base Map Style',+ delete: 'Delete',+ timePlayback: 'Time Playback',+ cloudStorage: 'Cloud Storage',+ '3DMap': '3D Map'+ },+ toolbar: {+ exportImage: 'Export Image',+ exportData: 'Export Data',+ exportMap: 'Export Map',+ shareMapURL: 'Share Map URL',+ saveMap: 'Save Map',+ select: 'select',+ polygon: 'polygon',+ rectangle: 'rectangle',+ hide: 'hide',+ show: 'show',+ en: 'English',+ fi: 'Suomi'+ },+ modal: {+ title: {+ deleteDataset: 'Delete Dataset',+ addDataToMap: 'Add Data To Map',+ exportImage: 'Export Image',+ exportData: 'Export Data',+ exportMap: 'Export Map',+ addCustomMapboxStyle: 'Add Custom Mapbox Style',+ saveMap: 'Save Map',+ shareURL: 'Share URL'+ },+ button: {+ delete: 'Delete',+ download: 'Download',+ export: 'Export',+ addStyle: 'Add Style',+ save: 'Save',+ defaultCancel: 'Cancel',+ defaultConfirm: 'Confirm'+ },+ exportImage: {+ ratioTitle: 'Ratio',+ ratioDescription: 'Choose the ratio for various usages.',+ ratioOriginalScreen: 'Original Screen',+ ratioCustom: 'Custom',+ ratio4_3: '4:3',+ ratio16_9: '16:9',+ resolutionTitle: 'Resolution',+ resolutionDescription: 'High resolution is better for prints.',+ mapLegendTitle: 'Map Legend',+ mapLegendAdd: 'Add legend on map'+ },+ exportData: {+ datasetTitle: 'Dataset',+ datasetSubtitle: 'Choose the datasets you want to export',+ allDatasets: 'All',+ dataTypeTitle: 'Data Type',+ dataTypeSubtitle: 'Choose the type of data you want to export',+ filterDataTitle: 'Filter Data',+ filterDataSubtitle: 'You can choose exporting original data or filtered data',+ filteredData: 'Filtered data',+ unfilteredData: 'Unfiltered Data',+ fileCount: '{fileCount} Files',+ rowCount: '{rowCount} Rows'+ },+ deleteData: {+ warning: 'you are going to delete this dataset. It will affect {length} layers'+ },+ addStyle: {+ publishTitle: '1. Publish your style at mapbox or provide access token',+ publishSubtitle1: 'You can create your own map style at',+ publishSubtitle2: 'and',+ publishSubtitle3: 'publish',+ publishSubtitle4: 'it.',+ publishSubtitle5: 'To use private style, paste your',+ publishSubtitle6: 'access token',+ publishSubtitle7:+ 'here. *kepler.gl is a client-side application, data stays in your browser..',+ exampleToken: 'e.g. pk.abcdefg.xxxxxx',+ pasteTitle: '2. Paste style url',+ pasteSubtitle1: 'What is a',+ pasteSubtitle2: 'style URL',+ namingTitle: '3. Name your style'+ },+ shareMap: {+ shareUriTitle: 'Share Map Url',+ shareUriSubtitle: 'Generate a map url to share with others',+ cloudTitle: 'Cloud storage',+ cloudSubtitle: 'Login and upload map data to your personal cloud storage',+ shareDisclaimer:+ 'kepler.gl will save your map data to your personal cloud storage, only people with the URL can access your map and data. ' ++ 'You can edit/delete the data file in your cloud account anytime.',+ gotoPage: 'Go to your Kepler.gl {currentProvider} page'+ },+ statusPanel: {+ mapUploading: 'Map Uploading',+ error: 'Error'+ },+ saveMap: {+ title: 'Cloud storage',+ subtitle: 'Login to save map to your personal cloud storage'+ },+ exportMap: {+ formatTitle: 'Map format',+ formatSubtitle: 'Choose the format to export your map to',+ html: {+ selection: 'Export your map into an interactive html file.',+ tokenTitle: 'Mapbox access token',+ tokenSubtitle: 'Use your own Mapbox access token in the html (optional)',+ tokenPlaceholder: 'Paste your Mapbox access token',+ tokenMisuseWarning:+ '* If you do not provide your own token, the map may fail to display at any time when we replace ours to avoid misuse. ',+ tokenDisclaimer: 'You can change the Mapbox token later using the following instructions: ',+ tokenUpdate: 'How to update an existing map token.',+ modeTitle: 'Map Mode',+ modeSubtitle1: 'Select the app mode. More ',+ modeSubtitle2: 'info',+ modeDescription: 'Allow users to {mode} the map',+ read: 'read',+ edit: 'edit'+ },+ json: {+ configTitle: 'Map Config',+ configDisclaimer:+ 'Map config will be included in the Json file. If you are using kepler.gl in your own app. You can copy this config and pass it to ',+ selection:+ 'Export current map data and config into a single Json file. You can later open the same map by uploading this file to kepler.gl.',+ disclaimer:+ '* Map config is coupled with loaded datasets. ‘dataId’ is used to bind layers, filters, and tooltips to a specific dataset. ' ++ 'When passing this config to addDataToMap, make sure the dataset id matches the dataId/s in this config.'+ }+ },+ loadingDialog: {+ loading: 'Loading...'+ },+ loadData: {+ upload: 'Load Files',+ storage: 'Load from Storage'+ },+ tripInfo: {+ title: 'How to enable trip animation',+ description1:+ 'In order to animate the path, the geoJSON data needs to contain `LineString` in its feature geometry, and the coordinates in the LineString need to have 4 elements in the formats of',+ code: ' [longitude, latitude, altitude, timestamp] ',+ description2:+ 'with the last element being a timestamp. Valid timestamp formats include unix in seconds such as `1564184363` or in milliseconds such as `1564184363000`.',+ example: 'Example:'+ },+ iconInfo: {+ title: 'How to draw icons',+ description1:+ 'In your csv, create a column, put the name of the icon you want to draw in it. You can leave the cell empty if you do not want the icon to show for some points. When the column is named',+ code: 'icon',+ description2: ' kepler.gl will automatically create a icon layer for you.',+ example: 'Example:',+ icons: 'Icons'+ },+ storageMapViewer: {+ lastModified: 'Last modified {lastUpdated} ago',+ back: 'Back'+ },+ overwriteMap: {+ title: 'Saving map...',+ alreadyExists: 'already exists in your {mapSaved}. Would you like to overwrite it?'+ },+ loadStorageMap: {+ back: 'Back',+ goToPage: 'Go to your Kepler.gl {displayName} page',+ storageMaps: 'Storage / Maps',+ noSavedMaps: 'No saved maps yet'+ }+ },+ header: {+ visibleLayers: 'Visible layers',+ layerLegend: 'Layer Legend'+ },+ interactions: {+ tooltip: 'Tooltip',+ brush: 'Brush',+ coordinate: 'Coordinates'+ },+ layerBlending: {+ title: 'Layer Blending',+ additive: 'additive',+ normal: 'normal',+ subtractive: 'subtractive'+ },+ columns: {+ title: 'Columns',+ lat: 'lat',+ lng: 'lon',+ altitude: 'altitude',+ icon: 'icon',+ geojson: 'geojson',+ arc: {+ lat0: 'source lat',+ lng0: 'source lng',+ lat1: 'target lat',+ lng1: 'target lng'+ },+ grid: {+ worldUnitSize: 'Grid Size (km)'+ },+ hexagon: {+ worldUnitSize: 'Hexagon Radius (km)'+ }+ },+ color: {+ customPalette: 'Custom Palette',+ steps: 'steps',+ type: 'type',+ reversed: 'reversed'+ },+ scale: {+ colorScale: 'Color Scale',+ sizeScale: 'Size Scale',+ strokeScale: 'Stroke Scale',+ scale: 'Scale'+ },+ fileUploader: {+ message: 'Drag & Drop Your File(s) Here',+ chromeMessage:+ '*Chrome user: Limit file size to 250mb, if need to upload larger file, try Safari',+ disclaimer:+ '*kepler.gl is a client-side application with no server backend. Data lives only on your machine/browser. ' ++ 'No information or map data is sent to any server.',+ configUploadMessage:+ 'Upload **CSV**, **GeoJson** or saved map **Json**. Read more about [**supported file formats**]',+ browseFiles: 'browse your files',+ uploading: 'Uploading',+ fileNotSupported: 'File {errorFiles} is not supported.',+ or: 'or'+ },+ density: 'density',+ 'Bug Report': 'Bug Report',+ 'User Guide': 'User Guide',+ Save: 'Save',+ Share: 'Share'+};diff --git a/src/localization/fi.js b/src/localization/fi.jsnew file mode 100644index 000000000..a4757f15b--- /dev/null+++ b/src/localization/fi.js@@ -0,0 +1,437 @@+// Copyright (c) 2020 Uber Technologies, Inc.+//+// Permission is hereby granted, free of charge, to any person obtaining a copy+// of this software and associated documentation files (the "Software"), to deal+// in the Software without restriction, including without limitation the rights+// to use, copy, modify, merge, publish, distribute, sublicense, and/or sell+// copies of the Software, and to permit persons to whom the Software is+// furnished to do so, subject to the following conditions:+//+// The above copyright notice and this permission notice shall be included in+// all copies or substantial portions of the Software.+//+// THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR+// IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,+// FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE+// AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER+// LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM,+// OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN+// THE SOFTWARE.++export default {+ property: {+ weight: 'painotus',+ label: 'nimiö',+ fillColor: 'täyttöväri',+ color: 'väri',+ strokeColor: 'viivan väri',+ radius: 'säde',+ outline: 'ääriviiva',+ stroke: 'viiva',+ density: 'tiheys',+ coverage: 'kattavuus',+ sum: 'summa',+ pointCount: 'pisteiden lukumäärä'+ },+ placeholder: {+ search: 'Etsi',+ selectField: 'Valitse kenttä',+ yAxis: 'Y-akseli',+ selectType: 'Valitse tyyppi',+ selectValue: 'Valitse arvo',+ enterValue: 'Anna arvo',+ empty: 'tyhjä'+ },+ misc: {+ by: '',+ valuesIn: 'Arvot joukossa:',+ valueEquals: 'Arvo on yhtäsuuri kuin',+ dataSource: 'Aineistolähde',+ brushRadius: 'Harjan säde (km)',+ empty: ' '+ },+ mapLayers: {+ title: 'Kartan tasot',+ label: 'Nimiöt',+ road: 'Tiet',+ border: 'Rajat',+ building: 'Rakennukset',+ water: 'Vesi',+ land: 'Maa',+ '3dBuilding': '3d-rakennukset'+ },+ panel: {+ text: {+ label: 'Nimiö',+ labelWithId: 'Nimiö {labelId}',+ fontSize: 'Fontin koko',+ fontColor: 'Fontin väri',+ textAnchor: 'Tekstin ankkuri',+ alignment: 'Sijoittelu',+ addMoreLabel: 'Lisää uusia nimiöitä'+ }+ },+ sidebar: {+ panels: {+ layer: 'Tasot',+ filter: 'Suodattimet',+ interaction: 'Interaktiot',+ basemap: 'Taustakartta'+ }+ },+ layer: {+ required: 'Pakollinen*',+ radius: 'Säde',+ weight: 'Painotus',+ propertyBasedOn: '{property} perustuen arvoon',+ color: 'Väri',+ fillColor: 'Täytön väri',+ outline: 'ääriviiva',+ coverage: 'Kattavuus',+ stroke: 'Viiva',+ strokeWidth: 'Viivan paksuus',+ strokeColor: 'Viivan väri',+ basic: 'Perus',+ trailLength: 'Jäljen pituus',+ trailLengthDescription: 'Jäljen kesto sekunteina, ennenkuin se himmenee näkyvistä',+ newLayer: 'uusi taso',+ elevationByDescription: 'Kun asetus on pois päältä, korkeus perustuu pisteiden määrään',+ colorByDescription: 'Kun asetus on pois päältä, väri perustuu pisteiden määrään',+ aggregateBy: 'Aggregoi kenttä {field} by',+ '3DModel': '3D-malli',+ '3DModelOptions': '3D-mallin asetukset',+ type: {+ point: 'piste',+ arc: 'kaari',+ line: 'viiva',+ grid: 'ruudukko',+ hexbin: 'hexbin',+ polygon: 'polygoni',+ geojson: 'geojson',+ cluster: 'klusteri',+ icon: 'kuva',+ heatmap: ' lämpökartta',+ h3: 'H3',+ trip: 'matka',+ s2: 'S2',+ '3d': '3D'+ }+ },+ layerVisConfigs: {+ strokeWidth: 'Viivan paksuus',+ strokeWidthRange: 'Viivan paksuuden rajat',+ radius: 'Säde',+ fixedRadius: 'Vakiosäde metreinä',+ fixedRadiusDescription: 'Kartan säde absoluuttiseksi säteeksi metreinä, esim. 5 -> 5 metriin',+ radiusRange: 'Säteen rajat',+ clusterRadius: 'Klusterien säde pikseleinä',+ radiusRangePixels: 'Säteen rajat pikseleinä',+ opacity: 'Läpinäkyvyys',+ coverage: 'Kattavuus',+ outline: 'Ääriviiva',+ colorRange: 'Värien rajat',+ stroke: 'Viiva',+ strokeColor: 'Viivan väri',+ strokeColorRange: 'Viivan värin rajat',+ targetColor: 'Kohteen väri',+ colorAggregation: 'Värien aggregointi',+ heightAggregation: 'Korkeuden aggregointi',+ resolutionRange: 'Resoluution rajat',+ sizeScale: 'Koon skaala',+ worldUnitSize: 'Yksikkö',+ elevationScale: 'Korottamisen skaala',+ heightScale: 'Korkeuden skaala',+ coverageRange: 'Peittävyyden rajat',+ highPrecisionRendering: 'Tarkka renderöinti',+ highPrecisionRenderingDescription: 'Tarkka renderöinti johtaa hitaampaan suorittamiseen',+ height: 'Korkeus',+ heightDescription: 'Klikkaa oikeasta ylänurkasta nappia vaihtaaksesi 3D-näkymään',+ fill: 'Täyttö',+ enablePolygonHeight: 'Salli polygonien korkeus',+ showWireframe: 'Näytä rautalankamalli',+ weightIntensity: 'Painotuksen intensiteetti',+ zoomScale: 'Zoomausskaala',+ heightRange: 'Korkeuden rajat'+ },+ layerManager: {+ addData: 'Lisää aineisto',+ addLayer: 'Lisää taso',+ layerBlending: 'Tasojen sekoittuvuus'+ },+ mapManager: {+ mapStyle: 'Kartan tyyli',+ addMapStyle: 'Lisää tyyli kartalle',+ '3dBuildingColor': '3D-rakennusten väri'+ },+ layerConfiguration: {+ defaultDescription: 'Laske suureen {property} arvo valitun kentän perusteella',+ howTo: 'Miten toimii'+ },+ filterManager: {+ addFilter: 'Lisää suodatin'+ },+ datasetTitle: {+ showDataTable: 'Näytä attribuuttitaulu',+ removeDataset: 'Poista aineisto'+ },+ datasetInfo: {+ rowCount: '{rowCount} riviä'+ },+ tooltip: {+ hideLayer: 'Piilota taso',+ showLayer: 'Näytä taso',+ hideFeature: 'Piilota kohde',+ showFeature: 'Näytä kohde',+ hide: 'piilota',+ show: 'näytä',+ removeLayer: 'Poista taso',+ layerSettings: 'Tason asetukset',+ closePanel: 'Sulje paneeli',+ switchToDualView: 'Vaihda kaksoiskarrtanäkymään',+ showLegend: 'Näytä selite',+ disable3DMap: 'Poistu 3D-näkymästä',+ DrawOnMap: 'Piirrä kartalle',+ selectLocale: 'Valitse kielisyys',+ hideLayerPanel: 'Piilota tasopaneeli',+ showLayerPanel: 'Näytä tasopaneeli',+ moveToTop: 'Siirrä tasojen päällimmäiseksi',+ selectBaseMapStyle: 'Valitse taustakarttatyyli',+ delete: 'Poista',+ timePlayback: 'Ajan animointi',+ cloudStorage: 'Pilvitallennus',+ '3DMap': '3D-näkymä'+ },+ toolbar: {+ exportImage: 'Vie kuva',+ exportData: 'Vie aineistot',+ exportMap: 'Vie kartta',+ shareMapURL: 'Jaa kartan URL',+ saveMap: 'Tallenna kartta',+ select: 'valitse',+ polygon: 'polygoni',+ rectangle: 'nelikulmio',+ hide: 'piilota',+ show: 'näytä',+ en: 'English',+ fi: 'Suomi'+ },+ modal: {+ title: {+ deleteDataset: 'Poista aineisto',+ addDataToMap: 'Lisää aineistoja kartalle',+ exportImage: 'Vie kuva',+ exportData: 'Vie aineistot',+ exportMap: 'Vie kartta',+ addCustomMapboxStyle: 'Lisää oma Mapbox-tyyli',+ saveMap: 'Tallenna kartta',+ shareURL: 'Jaa URL'+ },+ button: {+ delete: 'Poista',+ download: 'Lataa',+ export: 'Vie',+ addStyle: 'Lisää tyyli',+ save: 'Tallenna',+ defaultCancel: 'Peru',+ defaultConfirm: 'Vahvista'+ },+ exportImage: {+ ratioTitle: 'Kuvasuhde',+ ratioDescription: 'Valitse sopiva kuvasuhde käyttötapaustasi varten.',+ ratioOriginalScreen: 'Alkuperäinen näyttö',+ ratioCustom: 'Kustomoitu',+ ratio4_3: '4:3',+ ratio16_9: '16:9',+ resolutionTitle: 'Resoluutio',+ resolutionDescription: 'Korkea resoluutio on parempi tulostamista varten.',+ mapLegendTitle: 'Kartan selite',+ mapLegendAdd: 'Lisää selite karttaan'+ },+ exportData: {+ datasetTitle: 'Aineistot',+ datasetSubtitle: 'Valitse aineisto, jonka aiot viedä',+ allDatasets: 'Kaikki',+ dataTypeTitle: 'Aineistojen formaatti',+ dataTypeSubtitle: 'Valitse aineistoformaatti valitsemillesi aineistoille',+ filterDataTitle: 'Suodata aineistoja',+ filterDataSubtitle: 'Voit viedä joko alkuperäiset aineistot tai suodatetut aineistot',+ filteredData: 'Suodatetut aineistot',+ unfilteredData: 'Suodattamattomat aineistot',+ fileCount: '{fileCount} tiedostoa',+ rowCount: '{rowCount} riviä'+ },+ deleteData: {+ warning: 'aiot poistaa tämän aineiston. Aineostoa käyttävien tasojen lukumäärä: {length}'+ },+ addStyle: {+ publishTitle: '1. Julkaise tyylisi Mapboxissa tai anna tunniste',+ publishSubtitle1: 'Voit luoda oman karttatyylisi sivulla',+ publishSubtitle2: 'ja',+ publishSubtitle3: 'julkaista',+ publishSubtitle4: 'sen.',+ publishSubtitle5: 'Käyttääksesi yksityistä tyyliä, liitä',+ publishSubtitle6: 'tunnisteesi',+ publishSubtitle7:+ 'tänne. *kepler.gl on client-side sovellus, data pysyy vain selaimessasi...',+ exampleToken: 'esim. pk.abcdefg.xxxxxx',+ pasteTitle: '2. Liitä tyyli-URL',+ pasteSubtitle1: 'Mikä on',+ pasteSubtitle2: 'tyyli-URL?',+ namingTitle: '3. Nimeä tyylisi'+ },+ shareMap: {+ shareUriTitle: 'Jaa kartan URL',+ shareUriSubtitle: 'Luo kartalle URL, jonka voit jakaa muiden kanssa',+ cloudTitle: 'Pilvitallennus',+ cloudSubtitle:+ 'Kirjaudu sisään ja lataa kartta ja aineistot henkilökohtaiseen pilvipalveluun',+ shareDisclaimer:+ 'kepler.gl tallentaa kartan datan henkilökohtaiseen pilvitallennustilaasi, vain ihmiset, joilla on URL, voivat päästä käsiksi karttaan ja aineistoihin. ' ++ 'Voit muokata tiedostoja tai poistaa ne pilvipalvelustasi milloin vain.',+ gotoPage: 'Mene Kepler.gl {currentProvider} sivullesi'+ },+ statusPanel: {+ mapUploading: 'Karttaa ladataan',+ error: 'Virhe'+ },+ saveMap: {+ title: 'Pilvitallennus',+ subtitle: 'Kirjaudu sisään pilvipalveluusi tallentaaksesi kartan'+ },+ exportMap: {+ formatTitle: 'Kartan formaatti',+ formatSubtitle: 'Valitse formaatti, jossa viet kartan',+ html: {+ selection: 'Vie kartta interaktiivisena html-tiedostona',+ tokenTitle: 'Mapbox-tunniste',+ tokenSubtitle: 'Käytä omaa Mapbox-tunnistettasi html-tiedostossa (valinnainen)',+ tokenPlaceholder: 'Liitä Mapbox-tunnisteesi',+ tokenMisuseWarning:+ '* Jos et käytä omaa tunnistettasi, kartta voi lakata toimimasta milloin vain kun vaihdamme omaa tunnistettamme väärinkäytön estämiseksi. ',+ tokenDisclaimer: 'Voit vaihtaa Mapbox-tunnisteesi näiden ohjeiden avulla: ',+ tokenUpdate: 'Kuinka vaihtaa olemassaoleva Mapbox-tunniste',+ modeTitle: 'Kartan tila',+ modeSubtitle1: 'Valitse kartan tila.',+ modeSubtitle2: 'Lisätietoja',+ modeDescription: 'Anna käyttäjien {mode} karttaa',+ read: 'lukea',+ edit: 'muokata'+ },+ json: {+ configTitle: 'Kartan asetukset',+ configDisclaimer:+ 'Kartan asetukset sisältyvät Json-tiedostoon. Jos käytät kirjastoa kepler.gl omassa sovelluksessasi. Voit kopioida asetukset ja antaa ne funktiolle: ',+ selection:+ 'Vie kyseisen kartan aineistot ja asetukset yhdessä json-tiedostossa. Voit myöhemmin avata saman kartan lataamalla tiedoston kepler.gl:n',+ disclaimer:+ '* Kartan asetukset ovat sidoksissa ladattuihin aineistoihin. Arvoa ‘dataId’ käytetään tasojen, suodattimien ja vihjeiden liittämiseksi tiettyyn aineistoon. ' ++ 'Varmista, että aineiston dataId:t vastaavat asetusten arvoja jos lataat asetukset käyttäen `addDataToMap`-funktiolle.'+ }+ },+ loadingDialog: {+ loading: 'Ladataan...'+ },+ loadData: {+ upload: 'Lataa tiedostot',+ storage: 'Lataa tallennustilasta'+ },+ tripInfo: {+ title: 'Kuinka käyttää matka-animaatiota',+ description1:+ 'Reitin animoimiseksi geoJSON-aineiston täytyy olla geometriatyypiltään `LineString`, LineString-koordinaattien täytyy sisältää 4 elementtiä formaatissa:',+ code: ' [pituusaste, leveysaste, korkeus, aikaleima] ',+ description2:+ 'siten, että viimeinen elementti on aikaleima. Aikaleima voi olla muodoltaan unix-sekunteja, kuten `1564184363` tai millisekunteja, kuten `1564184363000`.',+ example: 'Esimerkki:'+ },+ iconInfo: {+ title: 'Miten piirtää kuvia',+ description1:+ 'csv-tiedostossasi, luo sarake nimeltä icon. Voit jättää sen tyhjäksi jos et halua piirtää kuvaa joillain pisteillä. Kun sarakkeen nimi on ',+ code: 'icon',+ description2: ' kepler.gl luo automaattisesti kuvatason sinua varten.',+ example: 'Esimerkki:',+ icons: 'Kuvat'+ },+ storageMapViewer: {+ lastModified: 'Viimeksi muokattu {lastUpdated} sitten',+ back: 'Takaisin'+ },+ overwriteMap: {+ title: 'Tallennetaan karttaa...',+ alreadyExists: 'on jo {mapSaved}:ssa. Haluatko ylikirjoittaa sen?'+ },+ loadStorageMap: {+ back: 'Takaisin',+ goToPage: 'Mene Kepler.gl {displayName} sivullesi',+ storageMaps: 'Tallennus / Kartat',+ noSavedMaps: 'Ei tallennettuja karttoja vielä'+ }+ },+ header: {+ visibleLayers: 'Näkyvissä olevat tasot',+ layerLegend: 'Tason selite'+ },+ interactions: {+ tooltip: 'Vihje',+ brush: 'Harja',+ coordinate: 'Koordinaatit'+ },+ layerBlending: {+ title: 'Tasojen sekoittuvuus',+ additive: 'lisäävä',+ normal: 'normaali',+ subtractive: 'vähentävä'+ },+ columns: {+ title: 'Sarakkeet',+ lat: 'lat',+ lng: 'lng',+ altitude: 'korkeus',+ icon: 'kuva',+ geojson: 'geojson',+ arc: {+ lat0: 'lähdön lat',+ lng0: 'lähdön lng',+ lat1: 'kohteen lat',+ lng1: 'kohteen lng'+ },+ grid: {+ worldUnitSize: 'Ruutujen koko (km)'+ },+ hexagon: {+ worldUnitSize: 'Hexagonien säde (km)'+ }+ },+ color: {+ customPalette: 'Mukautettu paletti',+ steps: 'askeleet',+ type: 'tyyppi',+ reversed: 'käänteinen'+ },+ scale: {+ colorScale: 'Värin skaala',+ sizeScale: 'Koon skaala',+ strokeScale: 'Viivan paksuuden skaala',+ scale: 'Skaala'+ },+ fileUploader: {+ message: 'Raahaa ja pudota tiedostosi tänne',+ chromeMessage:+ '*Chromen käyttäjä: Rajoita tiedostokokosi 250Mb:hen. Jos haluat suurempia tiedostoja, kokeile Safaria',+ disclaimer:+ '*kepler.gl on client-side sovellus, data pysyy vain selaimessasi...' ++ 'Tietoja ei lähetetä palvelimelle.',+ configUploadMessage:+ 'Lisää **CSV**, **GeoJson** tai tallennettu kartta **Json**. Lue lisää [**tuetuista formaateista**]',+ browseFiles: 'selaa tiedostojasi',+ uploading: 'ladataan',+ fileNotSupported: 'Tiedosto {errorFiles} ei ole tuettu.',+ or: 'tai'+ },+ density: 'tiheys',+ 'Bug Report': 'Bugiraportointi',+ 'User Guide': 'Opas',+ Save: 'Tallenna',+ Share: 'Jaa'+};diff --git a/src/localization/index.js b/src/localization/index.jsnew file mode 100644index 000000000..556f6b80e--- /dev/null+++ b/src/localization/index.js@@ -0,0 +1,30 @@+// Copyright (c) 2020 Uber Technologies, Inc.+//+// Permission is hereby granted, free of charge, to any person obtaining a copy+// of this software and associated documentation files (the "Software"), to deal+// in the Software without restriction, including without limitation the rights+// to use, copy, modify, merge, publish, distribute, sublicense, and/or sell+// copies of the Software, and to permit persons to whom the Software is+// furnished to do so, subject to the following conditions:+//+// The above copyright notice and this permission notice shall be included in+// all copies or substantial portions of the Software.+//+// THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR+// IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,+// FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE+// AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER+// LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM,+// OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN+// THE SOFTWARE.++import en from './en';+import fi from './fi';+import {flattenMessages} from 'utils/locale-utils';++const en_flat = flattenMessages(en);++export const messages = {+ en: en_flat,+ fi: {...en_flat, ...flattenMessages(fi)}+};diff --git a/src/reducers/ui-state-updaters.js b/src/reducers/ui-state-updaters.jsindex 31379fc90..9ee6008c0 100644--- a/src/reducers/ui-state-updaters.js+++ b/src/reducers/ui-state-updaters.js@@ -26,7 +26,8 @@ import {EXPORT_HTML_MAP_MODES,EXPORT_IMG_RATIOS,EXPORT_MAP_FORMATS,- RESOLUTIONS+ RESOLUTIONS,+ LOCALES} from 'constants/default-settings';import {createNotification, errorNotification} from 'utils/notifications-utils';import {calculateExportImageSize} from 'utils/export-utils';@@ -83,6 +84,8 @@ const uiStateUpdaters = null;* @property {Object} mapLegend Default: `{show: true, active: false}`* @property {Object} toggle3d Default: `{show: true}`* @property {Object} splitMap Default: `{show: true}`+ * @property {Object} mapDraw Default: `{show: true, active: false}`+ * @property {Object} mapLocale Default: `{show: false, active: false}`* @public*/const DEFAULT_MAP_CONTROLS_FEATURES = {@@ -97,7 +100,8 @@ export const DEFAULT_MAP_CONTROLS = ['mapLegend','toggle3d','splitMap',- 'mapDraw'+ 'mapDraw',+ 'mapLocale'].reduce((final, current) => ({...final,@@ -106,6 +110,7 @@ export const DEFAULT_MAP_CONTROLS = [{});+/*** Default image export config* @memberof uiStateUpdaters@@ -222,7 +227,9 @@ export const INITIAL_UI_STATE = {// ui notificationsnotifications: DEFAULT_NOTIFICATIONS,// load files- loadFiles: DEFAULT_LOAD_FILES+ loadFiles: DEFAULT_LOAD_FILES,+ // Locale of the UI+ locale: LOCALES.en};/* Updaters */@@ -318,6 +325,8 @@ export const toggleMapControlUpdater = (state, {payload: {panelId, index = 0}})}});++/*** Toggle active map control panel* @memberof uiStateUpdaters@@ -634,3 +643,17 @@ export const toggleSplitMapUpdater = state => ({{})});++/**+ * Set the locale of the UI+ * @memberof uiStateUpdaters+ * @param {Object} state `uiState`+ * @param {Object} action+ * @param {String} action.payload locale+ * @returns {Object} nextState+ * @public+ */+export const setLocaleUpdater = (state, {payload: {locale}}) => ({+ ...state,+ locale+});diff --git a/src/reducers/ui-state.js b/src/reducers/ui-state.jsindex 8d3ea05a6..5abdc3c5f 100644--- a/src/reducers/ui-state.js+++ b/src/reducers/ui-state.js@@ -54,7 +54,8 @@ const actionHandler = {[ActionTypes.LOAD_FILES]: uiStateUpdaters.loadFilesUpdater,[ActionTypes.LOAD_FILES_ERR]: uiStateUpdaters.loadFilesErrUpdater,- [ActionTypes.TOGGLE_SPLIT_MAP]: uiStateUpdaters.toggleSplitMapUpdater+ [ActionTypes.TOGGLE_SPLIT_MAP]: uiStateUpdaters.toggleSplitMapUpdater,+ [ActionTypes.SET_LOCALE]: uiStateUpdaters.setLocaleUpdater};/* Reducer */diff --git a/src/reducers/vis-state-updaters.js b/src/reducers/vis-state-updaters.jsindex 0297accf0..c87ae3e7d 100644--- a/src/reducers/vis-state-updaters.js+++ b/src/reducers/vis-state-updaters.js@@ -26,49 +26,46 @@ import get from 'lodash.get';import xor from 'lodash.xor';import copy from 'copy-to-clipboard';import {parseFieldValue} from 'utils/data-utils';-// Tasksimport {LOAD_FILE_TASK} from 'tasks/tasks';-// Actions-import {loadFilesErr, loadNextFile, loadFileSuccess} from 'actions/vis-state-actions';-+import {loadFilesErr, loadFileSuccess, loadNextFile} from 'actions/vis-state-actions';// Utils-import {getDefaultInteraction, findFieldsToShow} from 'utils/interaction-utils';+import {findFieldsToShow, getDefaultInteraction} from 'utils/interaction-utils';import {- FILTER_UPDATER_PROPS,- LIMITED_FILTER_EFFECT_PROPS,applyFilterFieldName,applyFiltersToDatasets,- generatePolygonFilter,+ featureToFilterValue,+ FILTER_UPDATER_PROPS,filterDatasetCPU,+ generatePolygonFilter,getDefaultFilter,- getFilterPlot,getDefaultFilterPlotType,- isInRange,getFilterIdInFeature,- featureToFilterValue,+ getFilterPlot,+ isInRange,+ LIMITED_FILTER_EFFECT_PROPS,updateFilterDataId} from 'utils/filter-utils';-import {setFilterGpuMode, assignGpuChannel} from 'utils/gpu-filter-utils';+import {assignGpuChannel, setFilterGpuMode} from 'utils/gpu-filter-utils';import {createNewDataEntry, sortDatasetByColumn} from 'utils/dataset-utils';import {set, toArray} from 'utils/utils';-import {findDefaultLayer, calculateLayerData} from 'utils/layer-utils/layer-utils';+import {calculateLayerData, findDefaultLayer} from 'utils/layer-utils/layer-utils';import {+ mergeAnimationConfig,mergeFilters,- mergeLayers,mergeInteractions,mergeLayerBlending,- mergeSplitMaps,- mergeAnimationConfig+ mergeLayers,+ mergeSplitMaps} from './vis-state-merger';import {addNewLayersToSplitMap,- removeLayerFromSplitMaps,- computeSplitMapLayers+ computeSplitMapLayers,+ removeLayerFromSplitMaps} from 'utils/split-map-utils';import {Layer, LayerClasses} from 'layers';diff --git a/src/utils/interaction-utils.js b/src/utils/interaction-utils.jsindex 97cfebc58..765921953 100644--- a/src/utils/interaction-utils.js+++ b/src/utils/interaction-utils.js@@ -30,6 +30,7 @@ export function getDefaultInteraction() {return {tooltip: {id: 'tooltip',+ label: 'interactions.tooltip',enabled: true,iconComponent: Messages,config: {@@ -38,6 +39,7 @@ export function getDefaultInteraction() {},brush: {id: 'brush',+ label: 'interactions.brush',enabled: false,iconComponent: Crosshairs,config: {@@ -47,6 +49,7 @@ export function getDefaultInteraction() {},coordinate: {id: 'coordinate',+ label: 'interactions.coordinate',enabled: false,iconComponent: CursorClick,position: nulldiff --git a/src/utils/locale-utils.js b/src/utils/locale-utils.jsnew file mode 100644index 000000000..2dce51ea1--- /dev/null+++ b/src/utils/locale-utils.js@@ -0,0 +1,34 @@+// Copyright (c) 2020 Uber Technologies, Inc.+//+// Permission is hereby granted, free of charge, to any person obtaining a copy+// of this software and associated documentation files (the "Software"), to deal+// in the Software without restriction, including without limitation the rights+// to use, copy, modify, merge, publish, distribute, sublicense, and/or sell+// copies of the Software, and to permit persons to whom the Software is+// furnished to do so, subject to the following conditions:+//+// The above copyright notice and this permission notice shall be included in+// all copies or substantial portions of the Software.+//+// THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR+// IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,+// FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE+// AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER+// LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM,+// OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN+// THE SOFTWARE.++// Flat messages since react-intl does not seem to support nested structures+// Adapted from https://medium.com/siren-apparel-press/internationalization-and-localization-of-sirenapparel-eu-sirenapparel-us-and-sirenapparel-asia-ddee266066a2+export const flattenMessages = (nestedMessages, prefix = '') => {+ return Object.keys(nestedMessages).reduce((messages, key) => {+ const value = nestedMessages[key];+ const prefixedKey = prefix ? `${prefix}.${key}` : key;+ if (typeof value === 'string') {+ messages[prefixedKey] = value;+ } else {+ Object.assign(messages, flattenMessages(value, prefixedKey));+ }+ return messages;+ }, {});+};diff --git a/src/utils/utils.js b/src/utils/utils.jsindex 068a28371..a872c1493 100644--- a/src/utils/utils.js+++ b/src/utils/utils.js@@ -68,6 +68,19 @@ export function camelToTitle(str) {return capitalizeFirstLetter(breakWord);}+/**+ * Convert names to camel style+ * Stroke Color -> strokeColor+ * @param {string} str+ * @returns {string}+ */+export const camelize = str => {+ return str.replace(/(?:^\w|[A-Z]|\b\w|\s+)/g, (match, index) => {+ if (Number(match) === 0) return ''; // or if (/\s+/.test(match)) for white spaces+ return index === 0 ? match.toLowerCase() : match.toUpperCase();+ });+};+/*** Returns the img url for a given map export option* @param mode export optiondiff --git a/test/browser/components/common/file-uploader-test.js b/test/browser/components/common/file-uploader-test.jsindex 40a2e3d63..2ed480d1e 100644--- a/test/browser/components/common/file-uploader-test.js+++ b/test/browser/components/common/file-uploader-test.js@@ -21,7 +21,7 @@import React from 'react';import test from 'tape';import sinon from 'sinon';-import {mountWithTheme} from 'test/helpers/component-utils';+import {IntlWrapper, mountWithTheme} from 'test/helpers/component-utils';import {FileUpload, WarningMsg} from 'components/common/file-uploader/file-upload';import FileDrop from 'components/common/file-uploader/file-drop';@@ -31,7 +31,11 @@ test('Components -> FileUploader.render', t => {let wrapper;t.doesNotThrow(() => {- wrapper = mountWithTheme(<FileUpload />);+ wrapper = mountWithTheme(+ <IntlWrapper>+ <FileUpload />+ </IntlWrapper>+ );}, 'Show not fail without data');t.equal(wrapper.find(FileDrop).length, 1, 'should render FileUploader');@@ -46,7 +50,11 @@ test('Components -> FileUpload.onDrop', t => {t.deepEqual(arg, mockFiles, 'should call onFileUpload with files');});const stopPropagation = sinon.spy();- const wrapper = mountWithTheme(<FileUpload onFileUpload={onFileUpload} />);+ const wrapper = mountWithTheme(+ <IntlWrapper>+ <FileUpload onFileUpload={onFileUpload} />+ </IntlWrapper>+ );t.equal(wrapper.find(FileDrop).length, 1, 'should render FileUploader');@@ -64,7 +72,11 @@ test('Components -> FileUpload.onDrop', t => {t.ok(onFileUpload.called, 'onFileUpload should get called');t.ok(stopPropagation.called, 'stopPropagation should get called');- const files = wrapper.state().files;+ const files = wrapper+ .find(FileUpload)+ .children()+ .first()+ .state().files;t.deepEqual(files, mockFiles, 'should set files to state');@@ -77,7 +89,11 @@ test('Components -> FileUpload.onDrop -> render loading msg', t => {t.deepEqual(arg, mockFiles, 'should call onFileUpload with files');});- const wrapper = mountWithTheme(<FileUpload onFileUpload={onFileUpload} fileLoading />);+ const wrapper = mountWithTheme(+ <IntlWrapper>+ <FileUpload onFileUpload={onFileUpload} fileLoading />+ </IntlWrapper>+ );const FileDropDiv = wrapper.find('.file-uploader__file-drop').at(0);// mock file drop event@@ -108,7 +124,11 @@ test('Components -> FileUpload.onDrop -> render error msg', t => {t.deepEqual(arg, mockFiles, 'should call onFileUpload with files');});- const wrapper = mountWithTheme(<FileUpload onFileUpload={onFileUpload} />);+ const wrapper = mountWithTheme(+ <IntlWrapper>+ <FileUpload onFileUpload={onFileUpload} />+ </IntlWrapper>+ );const FileDropDiv = wrapper.find('.file-uploader__file-drop').at(0);// mock file drop event@@ -125,7 +145,11 @@ test('Components -> FileUpload.onDrop -> render error msg', t => {t.ok(onFileUpload.notCalled, 'onFileUpload should not get called');t.ok(wrapper.find(WarningMsg), 'should render WarningMsg');- const errorFiles = wrapper.state().errorFiles;+ const errorFiles = wrapper+ .find(FileUpload)+ .children()+ .first()+ .state().errorFiles;t.deepEqual(errorFiles, ['tst-file.png'], 'should save files to errorFiles');t.end();@@ -136,7 +160,11 @@ test('Components -> FileUpload.dragOver', t => {const onFileUpload = sinon.spy(arg => {t.deepEqual(arg, mockFiles, 'should call onFileUpload with files');});- const wrapper = mountWithTheme(<FileUpload onFileUpload={onFileUpload} />);+ const wrapper = mountWithTheme(+ <IntlWrapper>+ <FileUpload onFileUpload={onFileUpload} />+ </IntlWrapper>+ );t.equal(wrapper.find(FileDrop).length, 1, 'should render FileUploader');@@ -150,7 +178,11 @@ test('Components -> FileUpload.dragOver', t => {};FileDropDiv.simulate('dragover', mockEvent);- const dragOver = wrapper.state().dragOver;+ const dragOver = wrapper+ .find(FileUpload)+ .children()+ .first()+ .state().dragOver;t.ok(dragOver, 'dragOver should be set to true');t.end();});@@ -160,7 +192,11 @@ test('Components -> FileUpload.dragLeave', t => {const onFileUpload = sinon.spy(arg => {t.deepEqual(arg, mockFiles, 'should call onFileUpload with files');});- const wrapper = mountWithTheme(<FileUpload onFileUpload={onFileUpload} />);+ const wrapper = mountWithTheme(+ <IntlWrapper>+ <FileUpload onFileUpload={onFileUpload} />+ </IntlWrapper>+ );t.equal(wrapper.find(FileDrop).length, 1, 'should render FileUploader');@@ -174,7 +210,11 @@ test('Components -> FileUpload.dragLeave', t => {};FileDropDiv.simulate('dragleave', mockEvent);- const dragOver = wrapper.state().dragOver;+ const dragOver = wrapper+ .find(FileUpload)+ .children()+ .first()+ .state().dragOver;t.notOk(dragOver, 'dragOver should be set to false');t.end();});@@ -184,7 +224,11 @@ test('Components -> UploadButton fileInput', t => {const onFileUpload = sinon.spy(arg => {t.deepEqual(arg, mockFiles, 'should call onFileUpload with files');});- const wrapper = mountWithTheme(<FileUpload onFileUpload={onFileUpload} />);+ const wrapper = mountWithTheme(+ <IntlWrapper>+ <FileUpload onFileUpload={onFileUpload} />+ </IntlWrapper>+ );const uploadButton = wrapper.find(UploadButton);t.equal(uploadButton.length, 1, 'should render UploadButton');const input = uploadButton.find('input');@@ -205,7 +249,11 @@ test('Components -> UploadButton fileInput', t => {input.simulate('change', mockEvent);t.ok(onFileUpload.called, 'onFileUpload should get called');- const files = wrapper.state().files;+ const files = wrapper+ .find(FileUpload)+ .children()+ .first()+ .state().files;t.deepEqual(files, mockFiles, 'should set files to state');diff --git a/test/browser/components/map/map-control-test.js b/test/browser/components/map/map-control-test.jsindex 18c534c02..a277aed9d 100644--- a/test/browser/components/map/map-control-test.js+++ b/test/browser/components/map/map-control-test.js@@ -30,6 +30,8 @@ test('MapControlFactory - display all options', t => {const onTogglePerspective = sinon.spy();const onToggleMapControl = sinon.spy();const onSetEditorMode = sinon.spy();+ const onToggleEditorVisibility = sinon.spy();+ const onSetLocale = sinon.spy();const $ = shallow(<MapControl@@ -38,10 +40,12 @@ test('MapControlFactory - display all options', t => {visibleLayers: {show: true},toggle3d: {show: true},mapLegend: {show: true},- mapDraw: {show: true}+ mapDraw: {show: true},+ mapLocale: {show: true}}}datasets={{}}layers={[]}+ locale={'en'}layersToRender={{}}dragRotate={true}mapIndex={0}@@ -49,10 +53,12 @@ test('MapControlFactory - display all options', t => {onTogglePerspective={onTogglePerspective}onToggleMapControl={onToggleMapControl}onSetEditorMode={onSetEditorMode}+ onToggleEditorVisibility={onToggleEditorVisibility}+ onSetLocale={onSetLocale}/>);- t.equal($.find('ActionPanel').length, 4, 'Should show 4 action panels');+ t.equal($.find('ActionPanel').length, 5, 'Should show 5 action panels');t.end();});diff --git a/test/browser/components/map/map-legend-test.js b/test/browser/components/map/map-legend-test.jsindex a002c430e..828d6653b 100644--- a/test/browser/components/map/map-legend-test.js+++ b/test/browser/components/map/map-legend-test.js@@ -36,7 +36,7 @@ import {expectedSavedLayer0 as hexagonLayer,expectedSavedLayer2 as geojsonLayer} from 'test/helpers/mock-state';-import {mountWithTheme} from 'test/helpers/component-utils';+import {IntlWrapper, mountWithTheme} from 'test/helpers/component-utils';test('Components -> MapLegend.render', t => {t.doesNotThrow(() => {@@ -52,7 +52,11 @@ test('Components -> MapLegend.render -> with layers', t => {let wrapper;t.doesNotThrow(() => {- wrapper = mountWithTheme(<MapLegend layers={layers} />);+ wrapper = mountWithTheme(+ <IntlWrapper>+ <MapLegend layers={layers} />+ </IntlWrapper>+ );}, 'Show not fail with layers');t.equal(diff --git a/test/browser/components/modals/load-data-modal-test.js b/test/browser/components/modals/load-data-modal-test.jsindex 086069ffc..cf97e03e6 100644--- a/test/browser/components/modals/load-data-modal-test.js+++ b/test/browser/components/modals/load-data-modal-test.js@@ -20,7 +20,7 @@import React from 'react';import test from 'tape';-import {mountWithTheme} from 'test/helpers/component-utils';+import {IntlWrapper, mountWithTheme} from 'test/helpers/component-utils';import LoadDataModalFactory from 'components/modals/load-data-modal';import {ModalTabItem} from 'components/modals/modal-tabs';import LoadStorageMapFactory from 'components/modals/load-storage-map';@@ -34,7 +34,11 @@ test('Components -> LoadDataModal.mount', t => {// mountlet wrapper;t.doesNotThrow(() => {- wrapper = mountWithTheme(<LoadDataModal />);+ wrapper = mountWithTheme(+ <IntlWrapper>+ <LoadDataModal />+ </IntlWrapper>+ );}, 'Show not fail without props');t.equal(wrapper.find('.file-uploader').length, 3, 'should render FileUpload');@@ -59,7 +63,11 @@ test('Components -> LoadDataModal -> custom loading method', t => {let wrapper;t.doesNotThrow(() => {- wrapper = mountWithTheme(<LoadDataModal loadingMethods={loadingMethods} />);+ wrapper = mountWithTheme(+ <IntlWrapper>+ <LoadDataModal loadingMethods={loadingMethods} />+ </IntlWrapper>+ );}, 'Show not fail without props');t.equal(wrapper.find(ModalTabItem).length, 1, 'should render 1 ModalTabItem');diff --git a/test/browser/components/modals/save-map-modal-test.js b/test/browser/components/modals/save-map-modal-test.jsindex cc145aea3..5967f1519 100644--- a/test/browser/components/modals/save-map-modal-test.js+++ b/test/browser/components/modals/save-map-modal-test.js@@ -20,12 +20,12 @@import React from 'react';import test from 'tape';-import {mountWithTheme} from 'test/helpers/component-utils';+import {mountWithTheme, IntlWrapper} from 'test/helpers/component-utils';import sinon from 'sinon';-import SaveMapModalFactory from 'components/modals/save-map-modal';+import SaveMapModalFactory from '../../../../src/components/modals/save-map-modal';-import CloudTile from 'components/modals/cloud-tile';-import ImagePreview from 'components/common/image-preview';+import CloudTile from '../../../../src/components/modals/cloud-tile';+import ImagePreview from '../../../../src/components/common/image-preview';import MockProvider from 'test/helpers/mock-provider';const mockProvider = new MockProvider();@@ -38,12 +38,14 @@ test('Components -> SaveMapModal.mount', t => {// mountt.doesNotThrow(() => {mountWithTheme(- <SaveMapModal- onUpdateImageSetting={onUpdateImageSetting}- onSetCloudProvider={onSetCloudProvider}- cloudProviders={[mockProvider]}- currentProvider="taro"- />+ <IntlWrapper>+ <SaveMapModal+ onUpdateImageSetting={onUpdateImageSetting}+ onSetCloudProvider={onSetCloudProvider}+ cloudProviders={[mockProvider]}+ currentProvider="taro"+ />+ </IntlWrapper>);}, 'Show not fail without props');t.ok(onUpdateImageSetting.calledOnce, 'should call onUpdateImageSetting when mount');@@ -63,22 +65,26 @@ test('Components -> SaveMapModal.mount with providers', t => {// mountt.doesNotThrow(() => {mountWithTheme(- <SaveMapModal- onUpdateSetting={() => {}}- onSetCloudProvider={onSetCloudProvider}- cloudProviders={[mockProvider]}- />+ <IntlWrapper>+ <SaveMapModal+ onUpdateSetting={() => {}}+ onSetCloudProvider={onSetCloudProvider}+ cloudProviders={[mockProvider]}+ />+ </IntlWrapper>);}, 'Show not fail mount props');t.ok(onSetCloudProvider.calledWithExactly('taro'), 'should set default provider when mount');const wrapper = mountWithTheme(- <SaveMapModal- onUpdateSetting={() => {}}- onSetCloudProvider={onSetCloudProvider}- cloudProviders={[mockProvider]}- currentProvider="hello"- />+ <IntlWrapper>+ <SaveMapModal+ onUpdateSetting={() => {}}+ onSetCloudProvider={onSetCloudProvider}+ cloudProviders={[mockProvider]}+ currentProvider="hello"+ />+ </IntlWrapper>);t.ok(onSetCloudProvider.calledOnce, 'should not set default provider if it is already set');@@ -96,7 +102,9 @@ test('Components -> SaveMapModal on change input', t => {// mountt.doesNotThrow(() => {wrapper = mountWithTheme(- <SaveMapModal onUpdateSetting={() => {}} onSetMapInfo={onSetMapInfo} />+ <IntlWrapper>+ <SaveMapModal onUpdateSetting={() => {}} onSetMapInfo={onSetMapInfo} />+ </IntlWrapper>);}, 'Show not fail mount props');@@ -127,13 +135,15 @@ test('Components -> SaveMapModal on click provider', t => {// mountt.doesNotThrow(() => {wrapper = mountWithTheme(- <SaveMapModal- cloudProviders={[mockProvider, mockProvider2]}- currentProvider="taro"- onSetCloudProvider={onSetCloudProvider}- onUpdateSetting={() => {}}- onUpdateImageSetting={() => {}}- />+ <IntlWrapper>+ <SaveMapModal+ cloudProviders={[mockProvider, mockProvider2]}+ currentProvider="taro"+ onSetCloudProvider={onSetCloudProvider}+ onUpdateSetting={() => {}}+ onUpdateImageSetting={() => {}}+ />+ </IntlWrapper>);}, 'Show not fail mount props');@@ -169,3 +179,30 @@ test('Components -> SaveMapModal on click provider', t => {t.end();});++test('Components -> SaveMapModal.intl', t => {+ let wrapper;+ // mount English version+ t.doesNotThrow(() => {+ wrapper = mountWithTheme(+ <IntlWrapper>+ <SaveMapModal onUpdateSetting={() => {}} onSetMapInfo={() => {}} />+ </IntlWrapper>+ );+ }, 'Show not fail mount props');++ t.equal(wrapper.find('.title').text(), 'Cloud storage');++ // mount Finnish version+ t.doesNotThrow(() => {+ wrapper = mountWithTheme(+ <IntlWrapper locale={'fi'}>+ <SaveMapModal onUpdateSetting={() => {}} onSetMapInfo={() => {}} />+ </IntlWrapper>+ );+ }, 'Show not fail mount props');++ t.equal(wrapper.find('.title').text(), 'Pilvitallennus');++ t.end();+});diff --git a/test/browser/components/modals/share-map-modal-test.js b/test/browser/components/modals/share-map-modal-test.jsindex fff92832b..3ac4acab4 100644--- a/test/browser/components/modals/share-map-modal-test.js+++ b/test/browser/components/modals/share-map-modal-test.js@@ -20,7 +20,7 @@import React from 'react';import test from 'tape';-import {mountWithTheme} from 'test/helpers/component-utils';+import {IntlWrapper, mountWithTheme} from 'test/helpers/component-utils';import sinon from 'sinon';import ShareMapUrlModalFactory, {SharingUrl} from 'components/modals/share-map-modal';@@ -33,7 +33,11 @@ test('Components -> ShareMapUrlModal.mount', t => {// mountt.doesNotThrow(() => {- mountWithTheme(<ShareMapUrlModal onSetCloudProvider={onSetCloudProvider} />);+ mountWithTheme(+ <IntlWrapper>+ <ShareMapUrlModal onSetCloudProvider={onSetCloudProvider} />+ </IntlWrapper>+ );}, 'Show not fail without props');t.ok(onSetCloudProvider.notCalled, 'should not call onSetCloudProvider when mount');@@ -50,17 +54,21 @@ test('Components -> ShareMapUrlModal.mount with providers', t => {// mountt.doesNotThrow(() => {mountWithTheme(- <ShareMapUrlModal onSetCloudProvider={onSetCloudProvider} cloudProviders={[mockProvider]} />+ <IntlWrapper>+ <ShareMapUrlModal onSetCloudProvider={onSetCloudProvider} cloudProviders={[mockProvider]} />+ </IntlWrapper>);}, 'Show not fail mount props');t.ok(onSetCloudProvider.calledWithExactly('taro'), 'should set default provider when mount');const wrapper = mountWithTheme(- <ShareMapUrlModal- onSetCloudProvider={onSetCloudProvider}- cloudProviders={[mockProvider]}- currentProvider="hello"- />+ <IntlWrapper>+ <ShareMapUrlModal+ onSetCloudProvider={onSetCloudProvider}+ cloudProviders={[mockProvider]}+ currentProvider="hello"+ />+ </IntlWrapper>);t.ok(onSetCloudProvider.calledOnce, 'should not set default provider if it is already set');@@ -79,11 +87,13 @@ test('Components -> ShareMapUrlModal.mount with isLoading', t => {let wrapper;t.doesNotThrow(() => {wrapper = mountWithTheme(- <ShareMapUrlModal- isProviderLoading- onSetCloudProvider={() => {}}- cloudProviders={[mockProvider]}- />+ <IntlWrapper>+ <ShareMapUrlModal+ isProviderLoading+ onSetCloudProvider={() => {}}+ cloudProviders={[mockProvider]}+ />+ </IntlWrapper>);}, 'Show not fail mount with isProviderLoading');@@ -93,11 +103,13 @@ test('Components -> ShareMapUrlModal.mount with isLoading', t => {);wrapper = mountWithTheme(- <ShareMapUrlModal- providerError="something is wrong"- onSetCloudProvider={() => {}}- cloudProviders={[mockProvider]}- />+ <IntlWrapper>+ <ShareMapUrlModal+ providerError="something is wrong"+ onSetCloudProvider={() => {}}+ cloudProviders={[mockProvider]}+ />+ </IntlWrapper>);t.ok(wrapper.find(StatusPanel).length === 1, 'should render StatusPanel when error');t.equal(wrapper.find('.notification-item--message').length, 1, 'should render 1 message');@@ -123,12 +135,14 @@ test('Components -> ShareMapUrlModal.mount with SharingUrl', t => {let wrapper;t.doesNotThrow(() => {wrapper = mountWithTheme(- <ShareMapUrlModal- successInfo={{shareUrl}}- cloudProviders={[mockProvider]}- currentProvider="taro"- onSetCloudProvider={() => {}}- />+ <IntlWrapper>+ <ShareMapUrlModal+ successInfo={{shareUrl}}+ cloudProviders={[mockProvider]}+ currentProvider="taro"+ onSetCloudProvider={() => {}}+ />+ </IntlWrapper>);}, 'Show not fail mount with successInfo');diff --git a/test/browser/components/side-panel/color-selector-test.js b/test/browser/components/side-panel/color-selector-test.jsindex 2efebaf06..402f1e83c 100644--- a/test/browser/components/side-panel/color-selector-test.js+++ b/test/browser/components/side-panel/color-selector-test.js@@ -49,7 +49,7 @@ import {Button} from 'components/common/styled-components';import {COLOR_RANGES} from 'constants/color-ranges';import {StateWFilesFiltersLayerColor, StateWTrips} from 'test/helpers/mock-state';-import {mountWithTheme} from 'test/helpers/component-utils';+import { IntlWrapper, mountWithTheme } from "test/helpers/component-utils";import {hexToRgb} from 'utils/color-utils';test('Components -> ColorSelector.render', t => {@@ -83,7 +83,7 @@ test('Components -> LayerColorSelector.render -> render layer color', t => {const layerConfiguratorProps = getLayerConfiguratorProps(mockProps);t.doesNotThrow(() => {- wrapper = mountWithTheme(<LayerColorSelector {...layerConfiguratorProps} />);+ wrapper = mountWithTheme(<IntlWrapper><LayerColorSelector {...layerConfiguratorProps} /></IntlWrapper> );}, 'Should not fail with layers');const CSInstance = wrapper.find(ColorSelector);@@ -150,7 +150,7 @@ test('Components -> LayerColorSelector.render -> render single color click', t =const layerConfiguratorProps = getLayerConfiguratorProps(mockProps);t.doesNotThrow(() => {- wrapper = mountWithTheme(<LayerColorSelector {...layerConfiguratorProps} />);+ wrapper = mountWithTheme(<IntlWrapper><LayerColorSelector {...layerConfiguratorProps} /></IntlWrapper> );}, 'Should not fail render color select');const CSInstance = wrapper.find(ColorSelector);@@ -196,14 +196,14 @@ test('Components -> ArcLayerColorSelector.render -> render single color', t => {let wrapper;t.doesNotThrow(() => {- wrapper = mountWithTheme(+ wrapper = mountWithTheme(<IntlWrapper><ArcLayerColorSelectorlayer={arcLayer}setColorUI={layerConfiguratorProps.setColorUI}onChangeConfig={layerConfiguratorProps.onChange}onChangeVisConfig={visConfiguratorProps.onChange}/>- );+ </IntlWrapper> );}, 'Should not fail render arc color select');const CSInstance = wrapper.find(ColorSelector);@@ -279,14 +279,14 @@ test('Components -> ArcLayerColorSelector.render -> render single color click',let wrapper;t.doesNotThrow(() => {- wrapper = mountWithTheme(+ wrapper = mountWithTheme(<IntlWrapper><ArcLayerColorSelectorlayer={arcLayer}setColorUI={layerConfiguratorProps.setColorUI}onChangeConfig={layerConfiguratorProps.onChange}onChangeVisConfig={visConfiguratorProps.onChange}/>- );+ </IntlWrapper> );}, 'Should not fail render arc color select');const CSInstance = wrapper.find(ColorSelector);t.equal(CSInstance.length, 1, 'should render 1 ColorSelector');@@ -329,7 +329,7 @@ test('Components -> LayerColorRangeSelector.render -> ColorSelector', t => {let wrapper;t.doesNotThrow(() => {- wrapper = mountWithTheme(<LayerColorRangeSelector {...visConfiguratorProps} />);+ wrapper = mountWithTheme(<IntlWrapper><LayerColorRangeSelector {...visConfiguratorProps} /></IntlWrapper>);}, 'Should not fail render color range select');const CPInstance = wrapper.find(ColorPalette);t.equal(CPInstance.length, 1, 'should render 1 ColorPalette');@@ -388,7 +388,7 @@ test('Components -> LayerColorRangeSelector.render -> ColorSelector -> ColorRanglet wrapper;t.doesNotThrow(() => {- wrapper = mountWithTheme(<LayerColorRangeSelector {...visConfiguratorProps} />);+ wrapper = mountWithTheme(<IntlWrapper><LayerColorRangeSelector {...visConfiguratorProps} /></IntlWrapper> );}, 'Should not fail render color range select');// open color dropdown@@ -544,7 +544,7 @@ test('Components -> LayerColorRangeSelector.render -> ColorSelector -> ColorRangconst visConfiguratorProps = getVisConfiguratorProps(mockProps);let wrapper;t.doesNotThrow(() => {- wrapper = mountWithTheme(<LayerColorRangeSelector {...visConfiguratorProps} />);+ wrapper = mountWithTheme(<IntlWrapper><LayerColorRangeSelector {...visConfiguratorProps} /></IntlWrapper> );}, 'Should not fail render color range select');// open color dropdown@@ -591,7 +591,7 @@ test('Components -> LayerColorRangeSelector.render -> ColorSelector -> ColorRangconst visConfiguratorProps = getVisConfiguratorProps(mockProps);let wrapper;t.doesNotThrow(() => {- wrapper = mountWithTheme(<LayerColorRangeSelector {...visConfiguratorProps} />);+ wrapper = mountWithTheme(<IntlWrapper><LayerColorRangeSelector {...visConfiguratorProps} /></IntlWrapper> );}, 'Should not fail render color range select');// current colorRange// { name: 'Ice And Fire 8',@@ -743,7 +743,7 @@ test('Components -> LayerColorRangeSelector.render -> ColorSelector -> ColorRangconst visConfiguratorProps = getVisConfiguratorProps(mockProps);let wrapper;t.doesNotThrow(() => {- wrapper = mountWithTheme(<LayerColorRangeSelector {...visConfiguratorProps} />);+ wrapper = mountWithTheme(<IntlWrapper><LayerColorRangeSelector {...visConfiguratorProps} /></IntlWrapper> );}, 'Should not fail render color range select');const cp = wrapper.find(CustomPalette);diff --git a/test/browser/components/side-panel/layer-panel-header-test.js b/test/browser/components/side-panel/layer-panel-header-test.jsindex 09e775ed7..a2a1b7880 100644--- a/test/browser/components/side-panel/layer-panel-header-test.js+++ b/test/browser/components/side-panel/layer-panel-header-test.js@@ -26,7 +26,7 @@ import test from 'tape';import {LayerPanelHeaderFactory} from 'components';import {DragHandle} from 'components/side-panel/layer-panel/layer-panel-header';import {appInjector} from 'components/container';-import {mountWithTheme} from 'test/helpers/component-utils';+import {mountWithTheme, IntlWrapper} from 'test/helpers/component-utils';// componentsconst nop = () => {};@@ -46,7 +46,11 @@ test('Components -> LayerPanelHeader.mount -> no prop', t => {// mountlet wrapper;t.doesNotThrow(() => {- wrapper = mountWithTheme(<LayerPanelHeader {...defaultProps} />);+ wrapper = mountWithTheme(+ <IntlWrapper>+ <LayerPanelHeader {...defaultProps} />+ </IntlWrapper>+ );}, 'LayerPanelHeader should not fail without props');t.ok(wrapper.find('.layer-panel__header').length, 'should render layer-panel__header');diff --git a/test/browser/components/side-panel/save-export-dropdown-test.js b/test/browser/components/side-panel/save-export-dropdown-test.jsindex 8ad1221bf..b91d68fa3 100644--- a/test/browser/components/side-panel/save-export-dropdown-test.js+++ b/test/browser/components/side-panel/save-export-dropdown-test.js@@ -27,6 +27,7 @@ import {PanelHeaderDropdownFactory} from 'components/side-panel/panel-header';import ToolbarItem from 'components/common/toolbar-item';+import {IntlWrapper} from 'test/helpers/component-utils';test('SaveExportDropdown', t => {const PanelHeaderDropdown = PanelHeaderDropdownFactory();@@ -40,15 +41,17 @@ test('SaveExportDropdown', t => {const onClose = sinon.spy();const wrapper = mount(- <SaveExportDropdown- onExportImage={onExportImage}- onExportData={onExportData}- onExportConfig={onExportConfig}- onExportMap={onExportMap}- onSaveMap={onSaveMap}- show={true}- onClose={onClose}- />+ <IntlWrapper>+ <SaveExportDropdown+ onExportImage={onExportImage}+ onExportData={onExportData}+ onExportConfig={onExportConfig}+ onExportMap={onExportMap}+ onSaveMap={onSaveMap}+ show={true}+ onClose={onClose}+ />+ </IntlWrapper>);t.equal(wrapper.find(PanelHeaderDropdown).length, 1, 'We should display 1 PanelHeaderDropdown');t.equal(wrapper.find(ToolbarItem).length, 4, 'We should display 4 ToolbarItems');diff --git a/test/browser/components/side-panel/side-panel-test.js b/test/browser/components/side-panel/side-panel-test.jsindex 5b66cd0cf..f248cd54e 100644--- a/test/browser/components/side-panel/side-panel-test.js+++ b/test/browser/components/side-panel/side-panel-test.js@@ -38,7 +38,7 @@ import * as MapStyleActions from 'actions/map-style-actions';import * as UIStateActions from 'actions/ui-state-actions';import {appInjector} from 'components/container';-import {mountWithTheme} from 'test/helpers/component-utils';+import {IntlWrapper, mountWithTheme} from 'test/helpers/component-utils';// componentsconst SidePanel = appInjector.get(SidePanelFactory);@@ -79,7 +79,11 @@ test('Components -> SidePanel.mount -> no prop', t => {// mountlet wrapper;t.doesNotThrow(() => {- wrapper = mountWithTheme(<SidePanel {...defaultProps} />);+ wrapper = mountWithTheme(+ <IntlWrapper>+ <SidePanel {...defaultProps} />+ </IntlWrapper>+ );}, 'SidePanel should not fail without props');t.ok(wrapper.find(PanelHeader).length === 1, 'should render PanelHeader');@@ -99,7 +103,11 @@ test('Components -> SidePanel -> toggle panel', t => {let wrapper;// mountt.doesNotThrow(() => {- wrapper = mountWithTheme(<SidePanel {...defaultProps} uiStateActions={uiStateActions} />);+ wrapper = mountWithTheme(+ <IntlWrapper>+ <SidePanel {...defaultProps} uiStateActions={uiStateActions} />+ </IntlWrapper>+ );}, 'SidePanel should not fail');t.ok(wrapper.find(PanelToggle).length === 1, 'should render PanelToggle');@@ -121,7 +129,11 @@ test('Components -> SidePanel -> render panel', t => {};// mount LayerManagert.doesNotThrow(() => {- wrapper = mountWithTheme(<SidePanel {...defaultProps} uiState={uiState} />);+ wrapper = mountWithTheme(+ <IntlWrapper>+ <SidePanel {...defaultProps} uiState={uiState} />+ </IntlWrapper>+ );}, 'SidePanel should not fail');t.ok(wrapper.find(LayerManager).length === 1, 'should render LayerManager');@@ -132,7 +144,11 @@ test('Components -> SidePanel -> render panel', t => {activeSidePanel: 'filter'};t.doesNotThrow(() => {- wrapper = mountWithTheme(<SidePanel {...defaultProps} uiState={uiState} />);+ wrapper = mountWithTheme(+ <IntlWrapper>+ <SidePanel {...defaultProps} uiState={uiState} />+ </IntlWrapper>+ );}, 'SidePanel should not fail');t.ok(wrapper.find(FilterManager).length === 1, 'should render FilterManager');@@ -142,7 +158,11 @@ test('Components -> SidePanel -> render panel', t => {activeSidePanel: 'interaction'};t.doesNotThrow(() => {- wrapper = mountWithTheme(<SidePanel {...defaultProps} uiState={uiState} />);+ wrapper = mountWithTheme(+ <IntlWrapper>+ <SidePanel {...defaultProps} uiState={uiState} />+ </IntlWrapper>+ );}, 'SidePanel should not fail');t.ok(wrapper.find(InteractionManager).length === 1, 'should render InteractionManager');@@ -152,7 +172,11 @@ test('Components -> SidePanel -> render panel', t => {activeSidePanel: 'map'};t.doesNotThrow(() => {- wrapper = mountWithTheme(<SidePanel {...defaultProps} uiState={uiState} />);+ wrapper = mountWithTheme(+ <IntlWrapper>+ <SidePanel {...defaultProps} uiState={uiState} />+ </IntlWrapper>+ );}, 'SidePanel should not fail');t.ok(wrapper.find(MapManager).length === 1, 'should render MapManager');@@ -203,7 +227,11 @@ test('Components -> SidePanel -> render custom panel', t => {// mount CustomSidePanelt.doesNotThrow(() => {- wrapper = mountWithTheme(<CustomSidePanel {...defaultProps} />);+ wrapper = mountWithTheme(+ <IntlWrapper>+ <CustomSidePanel {...defaultProps} />+ </IntlWrapper>+ );}, 'SidePanel should not fail');t.equal(wrapper.find('.side-panel__tab').length, 6, 'should render 6 panel tabs');@@ -214,7 +242,11 @@ test('Components -> SidePanel -> render custom panel', t => {// mount CustomSidePanel with 1 of the custom panelconst uiState = {...defaultProps.uiState, activeSidePanel: 'rocket'};t.doesNotThrow(() => {- wrapper = mountWithTheme(<CustomSidePanel {...defaultProps} uiState={uiState} />);+ wrapper = mountWithTheme(+ <IntlWrapper>+ <CustomSidePanel {...defaultProps} uiState={uiState} />+ </IntlWrapper>+ );}, 'SidePanel should not fail when mount with custom side panel activated');t.equal(wrapper.find(MyPanels).length, 1, 'should render MyPanels');t.end();@@ -230,7 +262,11 @@ test('Components -> SidePanel -> PanelHeader', t => {let wrapper;// mountt.doesNotThrow(() => {- wrapper = mountWithTheme(<SidePanel {...defaultProps} uiStateActions={uiStateActions} />);+ wrapper = mountWithTheme(+ <IntlWrapper>+ <SidePanel {...defaultProps} uiStateActions={uiStateActions} />+ </IntlWrapper>+ );}, 'SidePanel should not fail');t.ok(wrapper.find(PanelHeader).length === 1, 'should render PanelHeader');@@ -269,7 +305,9 @@ test('Components -> SidePanel -> PanelHeader', t => {};t.doesNotThrow(() => {wrapper = mountWithTheme(- <SidePanel {...defaultProps} uiState={uiState} uiStateActions={uiStateActions} />+ <IntlWrapper>+ <SidePanel {...defaultProps} uiState={uiState} uiStateActions={uiStateActions} />+ </IntlWrapper>);}, 'SidePanel should not fail');@@ -293,7 +331,9 @@ test('Components -> SidePanel -> PanelHeader -> ExportDropDown', t => {// mountt.doesNotThrow(() => {wrapper = mountWithTheme(- <SidePanel {...defaultProps} uiState={uiState} uiStateActions={uiStateActions} />+ <IntlWrapper>+ <SidePanel {...defaultProps} uiState={uiState} uiStateActions={uiStateActions} />+ </IntlWrapper>);}, 'SidePanel should not fail');diff --git a/test/browser/layer-tests/icon-layer-specs.js b/test/browser/layer-tests/icon-layer-specs.jsindex d25b2ca8f..6eb8974fa 100644--- a/test/browser/layer-tests/icon-layer-specs.js+++ b/test/browser/layer-tests/icon-layer-specs.js@@ -40,6 +40,7 @@ import {} from 'test/helpers/layer-utils';import {KeplerGlLayers} from 'layers';import {INITIAL_MAP_STATE} from 'reducers/map-state-updaters';+import { IntlWrapper } from "../../helpers/component-utils";const {IconLayer} = KeplerGlLayers;const columns = {@@ -532,7 +533,7 @@ test('#IconLayer -> fetch icon geometry -> renderIconModal', t => {let wrapper;t.doesNotThrow(() => {- wrapper = mount(<iconLayer.layerInfoModal.template />);+ wrapper = mount(<IntlWrapper><iconLayer.layerInfoModal.template /></IntlWrapper>);}, 'mount layer info modal with icons should not fail');t.equal(wrapper.find('.icon-table__item').length, 3, 'should render 1 icon');diff --git a/test/helpers/component-utils.js b/test/helpers/component-utils.jsindex 61c90f7f9..738a83def 100644--- a/test/helpers/component-utils.js+++ b/test/helpers/component-utils.js@@ -18,9 +18,12 @@// OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN// THE SOFTWARE.+import React from 'react';import {mount} from 'enzyme';import {theme} from 'styles/base';import {ThemeProvider} from 'styled-components';+import { IntlProvider } from "react-intl";+import { messages } from "localization";export function mountWithTheme(node) {return mount(node, {@@ -28,3 +31,9 @@ export function mountWithTheme(node) {wrappingComponentProps: {theme}});}++export const IntlWrapper = ({children, locale='en'}) => (+ <IntlProvider locale={locale} messages={messages[locale]}>+ {children}+ </IntlProvider>+);diff --git a/test/helpers/layer-utils.js b/test/helpers/layer-utils.jsindex 9c873c8f0..56c9e9404 100644--- a/test/helpers/layer-utils.js+++ b/test/helpers/layer-utils.js@@ -37,14 +37,14 @@ import {LayerClasses} from 'layers';import {processCsvData, processGeojson} from 'processors/data-processor';import {applyActions} from 'test/helpers/mock-state';import {visStateReducer} from 'reducers';-// Fixturesimport csvData, {wktCsv} from 'test/fixtures/test-csv-data';-import testLayerData, {bounds, iconGeometry, fieldDomain} from 'test/fixtures/test-layer-data';+import testLayerData, {bounds, fieldDomain, iconGeometry} from 'test/fixtures/test-layer-data';import {geojsonData} from 'test/fixtures/geojson';import tripGeoJson from 'test/fixtures/trip-geojson';import {logStep} from '../../scripts/log';+import {IntlWrapper} from './component-utils';export function testCreateLayer(t, LayerClass, props = {}) {let layer;@@ -98,7 +98,11 @@ export function testCreateCases(t, LayerClass, testCases) {if (layer.layerInfoModal) {t.doesNotThrow(() => {- mount(<layer.layerInfoModal.template />);+ mount(+ <IntlWrapper>+ <layer.layerInfoModal.template />+ </IntlWrapper>+ );}, 'layer info modal should be mountable');}}diff --git a/test/node/reducers/vis-state-test.js b/test/node/reducers/vis-state-test.jsindex ab7f742b6..482cd5c84 100644--- a/test/node/reducers/vis-state-test.js+++ b/test/node/reducers/vis-state-test.js@@ -2412,6 +2412,7 @@ test('#visStateReducer -> REMOVE_DATASET w filter and layer', t => {interactionConfig: {tooltip: {id: 'tooltip',+ label: 'interactions.tooltip',enabled: true,iconComponent: oldState.interactionConfig.tooltip.iconComponent,config: {@@ -2622,6 +2623,7 @@ test('#visStateReducer -> SPLIT_MAP: REMOVE_DATASET', t => {interactionConfig: {tooltip: {id: 'tooltip',+ label: 'interactions.tooltip',enabled: true,iconComponent: oldState.interactionConfig.tooltip.iconComponent,config: {diff --git a/test/node/utils/s2-utils-test.js b/test/node/utils/s2-utils-test.jsindex 680f70731..3acb00508 100644--- a/test/node/utils/s2-utils-test.js+++ b/test/node/utils/s2-utils-test.js@@ -21,7 +21,7 @@import test from 'tape';import {getS2Center} from 'layers/s2-geometry-layer/s2-utils';-test('Utils -> set', t => {+test('Utils -> getS2Center', t => {const s2Toekn = '8085873c';t.deepEqual(getS2Center(s2Toekn), [-122.4637079795235, 37.78228912269449]);t.end();diff --git a/test/node/utils/util-test.js b/test/node/utils/util-test.jsindex d8004f8a2..5b9928a49 100644--- a/test/node/utils/util-test.js+++ b/test/node/utils/util-test.js@@ -19,7 +19,7 @@// THE SOFTWARE.import test from 'tape';-import {set, toArray, getError} from 'utils/utils';+import {set, toArray, getError, camelToTitle, camelize, capitalizeFirstLetter} from 'utils/utils';test('Utils -> set', t => {const obj1 = {map: {map1: 'world'}};@@ -73,3 +73,21 @@ test('Utils -> getError', t => {t.end();});++test('Utils -> camelToTitle', t => {+ t.equal(camelToTitle('camelToTitle'), 'Camel To Title', 'should return titled string');+ t.equal(camelToTitle('strokeColor'), 'Stroke Color', 'should return titled string');+ t.end();+});++test('Utils -> camelize', t=> {+ t.equal(camelize('hello world test string'), 'helloWorldTestString', 'should camelize string');+ t.equal(camelize('Hello World test String'), 'helloWorldTestString', 'should camelize string');+ t.end();+});++test('Utils -> capitalizeFirstLetter', t=> {+ t.equal(capitalizeFirstLetter('hello world'), 'Hello world', 'should capitalize string');+ t.equal(capitalizeFirstLetter(1), 1, 'should ignore other types than string');+ t.end();+});