Skip to content

Commit

Permalink
[Chore]: Technical: Isolate localization (#1858)
Browse files Browse the repository at this point in the history
* Localizations isolation

Signed-off-by: Daria Terekhova <daria.terekhova@actionengine.com>

* Prettier correction

Signed-off-by: Daria Terekhova <daria.terekhova@actionengine.com>

* versions update

Signed-off-by: Daria Terekhova <daria.terekhova@actionengine.com>
  • Loading branch information
dariaterekhova-actionengine committed Jul 22, 2022
1 parent e798f31 commit ad7646a
Show file tree
Hide file tree
Showing 86 changed files with 358 additions and 72 deletions.
1 change: 1 addition & 0 deletions package.json
Expand Up @@ -18,6 +18,7 @@
"workspaces": [
"./src/constants",
"./src/types",
"./src/localization",
"./src/middleware",
"./src/deckgl-layers",
"./src/layers",
Expand Down
Expand Up @@ -21,7 +21,7 @@
import React, {useState, useCallback} from 'react';
import styled from 'styled-components';
import classnames from 'classnames';
import {FormattedMessage} from 'localization';
import {FormattedMessage} from '@kepler.gl/localization';
import {Button, Tooltip, ButtonProps} from 'components/common/styled-components';
import AnimationSpeedSliderFactory from './animation-speed-slider';
import {Reset, Play, Pause, Rocket, AnchorWindow, FreeWindow} from 'components/common/icons';
Expand Down
2 changes: 1 addition & 1 deletion src/components/common/file-uploader/file-upload.tsx
Expand Up @@ -32,7 +32,7 @@ import {GUIDES_FILE_FORMAT_DOC} from '@kepler.gl/constants';
import ReactMarkdown from 'react-markdown';
// Breakpoints
import {media} from 'styles/media-breakpoints';
import {FormattedMessage} from 'localization';
import {FormattedMessage} from '@kepler.gl/localization';

/** @typedef {import('./file-upload').FileUploadProps} FileUploadProps */

Expand Down
2 changes: 1 addition & 1 deletion src/components/common/info-helper.tsx
Expand Up @@ -20,7 +20,7 @@

import React from 'react';
import {useIntl} from 'react-intl';
import {FormattedMessage} from 'localization';
import {FormattedMessage} from '@kepler.gl/localization';
import {Tooltip} from './styled-components';
import {Docs} from 'components/common/icons';
import styled from 'styled-components';
Expand Down
2 changes: 1 addition & 1 deletion src/components/common/item-selector/chickleted-input.tsx
Expand Up @@ -22,7 +22,7 @@ import React, {ElementType, MouseEventHandler, ReactNode} from 'react';

import styled from 'styled-components';
import Delete from '../icons/delete';
import {FormattedMessage} from 'localization';
import {FormattedMessage} from '@kepler.gl/localization';

interface ChickletedInput {
// required properties
Expand Down
2 changes: 1 addition & 1 deletion src/components/common/item-selector/item-selector.tsx
Expand Up @@ -32,7 +32,7 @@ import DropdownList, {ListItem} from './dropdown-list';

import {toArray} from 'utils/utils';
import {injectIntl, IntlShape} from 'react-intl';
import {FormattedMessage} from 'localization';
import {FormattedMessage} from '@kepler.gl/localization';

interface StyledDropdownSelect {
inputTheme?: string;
Expand Down
5 changes: 3 additions & 2 deletions src/components/common/modal.tsx
Expand Up @@ -19,7 +19,7 @@
// THE SOFTWARE.

import React, {Component, ReactNode} from 'react';
import {FormattedMessage} from 'localization';
import {FormattedMessage} from '@kepler.gl/localization';

import styled, {FlattenSimpleInterpolation} from 'styled-components';
import Modal from 'react-modal';
Expand Down Expand Up @@ -158,7 +158,8 @@ interface ModalDialogOwnProps {
children?: ReactNode;
}

export type ModalDialogProps = ModalDialogOwnProps & Omit<ReactModal.Props, "style" | "ariaHideApp" | "className">
export type ModalDialogProps = ModalDialogOwnProps &
Omit<ReactModal.Props, 'style' | 'ariaHideApp' | 'className'>;

export class ModalDialog extends Component<ModalDialogProps> {
static defaultProps = {
Expand Down
2 changes: 1 addition & 1 deletion src/components/common/toolbar-item.tsx
Expand Up @@ -21,7 +21,7 @@
import React from 'react';
import styled from 'styled-components';
import classnames from 'classnames';
import {FormattedMessage} from 'localization';
import {FormattedMessage} from '@kepler.gl/localization';
import {ComponentType, MouseEvent} from 'react';

interface StyledDivProps {
Expand Down
2 changes: 1 addition & 1 deletion src/components/filters/multi-select-filter.tsx
Expand Up @@ -21,7 +21,7 @@
import React from 'react';
import ItemSelector from '../common/item-selector/item-selector';
import {PanelLabel} from '../common/styled-components';
import {FormattedMessage} from 'localization';
import {FormattedMessage} from '@kepler.gl/localization';
import {MultiSelectFilterProps} from './types';

export default function MultiSelectFilterFactory() {
Expand Down
2 changes: 1 addition & 1 deletion src/components/filters/single-select-filter.tsx
Expand Up @@ -21,7 +21,7 @@
import React from 'react';
import ItemSelector from '../common/item-selector/item-selector';
import {PanelLabel, SidePanelSection} from '../common/styled-components';
import {FormattedMessage} from 'localization';
import {FormattedMessage} from '@kepler.gl/localization';
import {SingleSelectFilterProps} from './types';

export default function SingleSelectFilterFactory() {
Expand Down
2 changes: 1 addition & 1 deletion src/components/kepler-gl.tsx
Expand Up @@ -25,7 +25,7 @@ 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 {messages} from '@kepler.gl/localization';
import {RootContext} from 'components/context';
import {OnErrorCallBack, OnSuccessCallBack} from 'actions/provider-actions';

Expand Down
2 changes: 1 addition & 1 deletion src/components/map-container.tsx
Expand Up @@ -61,7 +61,7 @@ import {FILTER_TYPES, GEOCODER_LAYER_ID, THROTTLE_NOTIFICATION_TIME} from '@kepl

import ErrorBoundary from 'components/common/error-boundary';
import {observeDimensions, unobserveDimensions} from '../utils/observe-dimensions';
import {LOCALE_CODES} from 'localization/locales';
import {LOCALE_CODES} from '@kepler.gl/localization';
import {
Datasets,
Filter,
Expand Down
2 changes: 1 addition & 1 deletion src/components/map/locale-panel.tsx
Expand Up @@ -25,7 +25,7 @@ import ToolbarItem from 'components/common/toolbar-item';
import {MapControlButton} from 'components/common/styled-components';
import MapControlTooltipFactory from './map-control-tooltip';
import MapControlToolbarFactory from './map-control-toolbar';
import {FormattedMessage} from '../../localization';
import {FormattedMessage} from '@kepler.gl/localization';
import TippyTooltip from 'components/common/tippy-tooltip';
import {MapControls} from 'reducers';

Expand Down
2 changes: 1 addition & 1 deletion src/components/map/map-control-panel.tsx
Expand Up @@ -20,7 +20,7 @@

import React from 'react';
import styled from 'styled-components';
import {FormattedMessage} from 'localization';
import {FormattedMessage} from '@kepler.gl/localization';
import {IconRoundSmall} from 'components/common/styled-components';
import {Close, Pin} from 'components/common/icons';

Expand Down
2 changes: 1 addition & 1 deletion src/components/map/map-control-tooltip.tsx
Expand Up @@ -20,7 +20,7 @@

import React from 'react';
import {Tooltip} from 'components/common/styled-components';
import {FormattedMessage} from 'localization';
import {FormattedMessage} from '@kepler.gl/localization';

export type MapControlTooltipProps = {
id: string;
Expand Down
2 changes: 1 addition & 1 deletion src/components/map/map-draw-panel.tsx
Expand Up @@ -35,7 +35,7 @@ import ToolbarItem from 'components/common/toolbar-item';
import MapControlTooltipFactory from './map-control-tooltip';
import MapControlPanelFactory from './map-control-panel';
import MapControlToolbarFactory from './map-control-toolbar';
import {FormattedMessage} from '../../localization';
import {FormattedMessage} from '@kepler.gl/localization';
import TippyTooltip from 'components/common/tippy-tooltip';
import {Editor, MapControls} from 'reducers';
import {BaseProps} from 'components/common/icons/base';
Expand Down
2 changes: 1 addition & 1 deletion src/components/map/map-legend-panel.tsx
Expand Up @@ -22,7 +22,7 @@ import React, {ComponentType, useState} from 'react';
import styled from 'styled-components';

import {Legend} from 'components/common/icons';
import {FormattedMessage} from 'localization';
import {FormattedMessage} from '@kepler.gl/localization';
import {MapControlButton} from 'components/common/styled-components';
import MapControlPanelFactory from './map-control-panel';
import MapLegendFactory from './map-legend';
Expand Down
2 changes: 1 addition & 1 deletion src/components/map/map-legend.tsx
Expand Up @@ -23,7 +23,7 @@ import styled from 'styled-components';
import {rgb} from 'd3-color';
import ColorLegend from 'components/common/color-legend';
import {CHANNEL_SCALES, DIMENSIONS} from '@kepler.gl/constants';
import {FormattedMessage} from 'localization';
import {FormattedMessage} from '@kepler.gl/localization';
import {Layer, LayerBaseConfig, VisualChannel, VisualChannelDescription} from '@kepler.gl/layers';

interface StyledMapControlLegendProps {
Expand Down
2 changes: 1 addition & 1 deletion src/components/map/map-popover.tsx
Expand Up @@ -24,7 +24,7 @@ import LayerHoverInfoFactory from './layer-hover-info';
import CoordinateInfoFactory from './coordinate-info';
import {ArrowLeft, ArrowRight, Pin} from 'components/common/icons';
import {injectIntl, IntlShape} from 'react-intl';
import {FormattedMessage} from 'localization';
import {FormattedMessage} from '@kepler.gl/localization';
import Tippy from '@tippyjs/react/headless';
import {LayerHoverProp} from 'utils/layer-utils';

Expand Down
2 changes: 1 addition & 1 deletion src/components/map/split-map-button.tsx
Expand Up @@ -22,7 +22,7 @@ import React, {ComponentType, useCallback, useMemo} from 'react';
import classnames from 'classnames';
import {MapControlButton} from 'components/common/styled-components';
import {Delete, Split} from 'components/common/icons';
import {FormattedMessage} from '../../localization';
import {FormattedMessage} from '@kepler.gl/localization';
import TippyTooltip from '../common/tippy-tooltip';
import {MapControl, MapControls} from 'reducers';

Expand Down
2 changes: 1 addition & 1 deletion src/components/map/toggle-3d-button.tsx
Expand Up @@ -23,7 +23,7 @@ import classnames from 'classnames';

import {Cube3d} from 'components/common/icons';
import {MapControlButton} from 'components/common/styled-components';
import {FormattedMessage} from '../../localization';
import {FormattedMessage} from '@kepler.gl/localization';
import TippyTooltip from 'components/common/tippy-tooltip';
import {MapControls} from 'reducers';

Expand Down
2 changes: 1 addition & 1 deletion src/components/modals/add-map-style-modal.tsx
Expand Up @@ -35,7 +35,7 @@ import {media} from 'styles/media-breakpoints';
// Utils
import {transformRequest} from 'utils/map-style-utils/mapbox-utils';
import {injectIntl, IntlShape} from 'react-intl';
import {FormattedMessage} from 'localization';
import {FormattedMessage} from '@kepler.gl/localization';
import {InputStyle, MapState} from 'reducers';
import mapboxgl from 'mapbox-gl';

Expand Down
2 changes: 1 addition & 1 deletion src/components/modals/delete-data-modal.tsx
Expand Up @@ -21,7 +21,7 @@
import React from 'react';
import styled from 'styled-components';
import DatasetLabel from 'components/common/dataset-label';
import {FormattedMessage} from 'localization';
import {FormattedMessage} from '@kepler.gl/localization';
import {Layer} from '@kepler.gl/layers';
import KeplerTable from 'utils/table-utils/kepler-table';

Expand Down
2 changes: 1 addition & 1 deletion src/components/modals/export-data-modal.tsx
Expand Up @@ -30,7 +30,7 @@ import {
CheckMark
} from 'components/common/styled-components';
import {injectIntl, IntlShape} from 'react-intl';
import {FormattedMessage} from 'localization';
import {FormattedMessage} from '@kepler.gl/localization';
import {Datasets} from 'reducers';

const getDataRowCount = (
Expand Down
2 changes: 1 addition & 1 deletion src/components/modals/export-image-modal.tsx
Expand Up @@ -28,7 +28,7 @@ import {EXPORT_IMG_RATIO_OPTIONS, EXPORT_IMG_RESOLUTION_OPTIONS} from '@kepler.g
import {StyledModalContent, SelectionButton, CheckMark} from 'components/common/styled-components';
import Switch from 'components/common/switch';
import {injectIntl, IntlShape} from 'react-intl';
import {FormattedMessage} from 'localization';
import {FormattedMessage} from '@kepler.gl/localization';
import {ExportImage} from 'reducers';

const ImageOptionList = styled.div`
Expand Down
2 changes: 1 addition & 1 deletion src/components/modals/export-map-modal/export-html-map.tsx
Expand Up @@ -28,7 +28,7 @@ import {
} from '@kepler.gl/constants';
import styled from 'styled-components';
import {injectIntl} from 'react-intl';
import {FormattedMessage} from 'localization';
import {FormattedMessage} from '@kepler.gl/localization';
import {IntlShape} from 'react-intl';

import {setUserMapboxAccessToken, setExportHTMLMapMode, ActionHandler} from 'actions';
Expand Down
2 changes: 1 addition & 1 deletion src/components/modals/export-map-modal/export-json-map.tsx
Expand Up @@ -24,7 +24,7 @@ import {ADD_DATA_TO_MAP_DOC} from '@kepler.gl/constants';
import styled from 'styled-components';
import {StyledExportSection, Button} from 'components/common/styled-components';
import {StyledExportMapSection, StyledWarning, ExportMapLink} from './components';
import {FormattedMessage} from 'localization';
import {FormattedMessage} from '@kepler.gl/localization';
import {CopyToClipboard} from 'react-copy-to-clipboard';

const StyledJsonExportSection = styled(StyledExportSection)`
Expand Down
Expand Up @@ -26,7 +26,7 @@ import {EXPORT_MAP_FORMATS, EXPORT_MAP_FORMAT_OPTIONS} from '@kepler.gl/constant
import {StyledExportMapSection} from './components';
import ExportHtmlMapFactory from './export-html-map';
import ExportJsonMapFactory from './export-json-map';
import {FormattedMessage} from 'localization';
import {FormattedMessage} from '@kepler.gl/localization';
import {ActionHandler, setExportHTMLMapMode, setUserMapboxAccessToken} from 'actions';

interface ExportMapModalFactoryProps {
Expand Down
2 changes: 1 addition & 1 deletion src/components/modals/load-storage-map.tsx
Expand Up @@ -27,7 +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 'localization';
import {FormattedMessage} from '@kepler.gl/localization';
import {MapListItem, Provider} from 'cloud-providers';

const StyledProviderSection = styled.div.attrs({
Expand Down
2 changes: 1 addition & 1 deletion src/components/modals/loading-dialog.tsx
Expand Up @@ -21,7 +21,7 @@
import React from 'react';
import styled from 'styled-components';
import LoadingSpinner from 'components/common/loading-spinner';
import {FormattedMessage} from 'localization';
import {FormattedMessage} from '@kepler.gl/localization';

const StyledSpinner = styled.div`
text-align: center;
Expand Down
2 changes: 1 addition & 1 deletion src/components/modals/overwrite-map-modal.tsx
Expand Up @@ -23,7 +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 'localization';
import {FormattedMessage} from '@kepler.gl/localization';
import {Provider} from 'cloud-providers';

import {ImageModalContainerProps} from './image-modal-container';
Expand Down
2 changes: 1 addition & 1 deletion src/components/modals/save-map-modal.tsx
Expand Up @@ -36,7 +36,7 @@ import {
StyledModalInputFootnote
} from 'components/common/styled-components';
import ImagePreview from 'components/common/image-preview';
import {FormattedMessage} from 'localization';
import {FormattedMessage} from '@kepler.gl/localization';
import {ExportImage, MapInfo} from 'reducers';
import {Provider} from 'cloud-providers';
import {setMapInfo, cleanupExportImage} from 'actions';
Expand Down
2 changes: 1 addition & 1 deletion src/components/modals/share-map-modal.tsx
Expand Up @@ -33,7 +33,7 @@ import {
} from 'components/common/styled-components';
import CloudTile from './cloud-tile';
import StatusPanel from './status-panel';
import {FormattedMessage} from 'localization';
import {FormattedMessage} from '@kepler.gl/localization';
import {Provider} from 'cloud-providers';
import {cleanupExportImage, SetCloudProviderPayload} from 'actions';

Expand Down
2 changes: 1 addition & 1 deletion src/components/modals/status-panel.tsx
Expand Up @@ -23,7 +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 'localization';
import {FormattedMessage} from '@kepler.gl/localization';
import {IconProps} from 'cloud-providers/provider';

const StyledUploader = styled.div`
Expand Down
2 changes: 1 addition & 1 deletion src/components/modals/storage-map-viewer.tsx
Expand Up @@ -22,7 +22,7 @@ import React from 'react';
import styled from 'styled-components';
import moment from 'moment';
import {LeftArrow} from 'components/common/icons';
import {FormattedMessage} from 'localization';
import {FormattedMessage} from '@kepler.gl/localization';

const imageH = 108;

Expand Down
2 changes: 1 addition & 1 deletion src/components/side-panel.tsx
Expand Up @@ -19,7 +19,7 @@
// THE SOFTWARE.

import React, {useCallback, useMemo} from 'react';
import {FormattedMessage} from 'localization';
import {FormattedMessage} from '@kepler.gl/localization';

import {
EXPORT_DATA_ID,
Expand Down
2 changes: 1 addition & 1 deletion src/components/side-panel/common/dataset-info.tsx
Expand Up @@ -21,7 +21,7 @@
import React from 'react';
import styled from 'styled-components';
import {format} from 'd3-format';
import {FormattedMessage} from 'localization';
import {FormattedMessage} from '@kepler.gl/localization';
import {DatasetInfoProps} from './types';

const numFormat = format(',');
Expand Down
2 changes: 1 addition & 1 deletion src/components/side-panel/common/dataset-tag.tsx
Expand Up @@ -19,7 +19,7 @@
// THE SOFTWARE.

import React from 'react';
import {FormattedMessage} from 'localization';
import {FormattedMessage} from '@kepler.gl/localization';
import styled from 'styled-components';
import {DatasetSquare, Tooltip} from 'components';
import {DatasetTagProps, UpdateTableColorTypes} from './types';
Expand Down
2 changes: 1 addition & 1 deletion src/components/side-panel/common/dataset-title.tsx
Expand Up @@ -20,7 +20,7 @@

import React, {createRef, MouseEvent, PureComponent} from 'react';
import styled from 'styled-components';
import {FormattedMessage} from 'localization';
import {FormattedMessage} from '@kepler.gl/localization';

import {CenterFlexbox, Tooltip} from 'components/common/styled-components';
import {ArrowRight, Table, Trash} from 'components/common/icons';
Expand Down
2 changes: 1 addition & 1 deletion src/components/side-panel/common/source-data-selector.tsx
Expand Up @@ -24,7 +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 'localization';
import {FormattedMessage} from '@kepler.gl/localization';
import {DatasetItemProps, SourceDataSelectorProps} from './types';

const defaultPlaceHolder = 'Select A Data Source';
Expand Down
2 changes: 1 addition & 1 deletion src/components/side-panel/filter-manager.tsx
Expand Up @@ -19,7 +19,7 @@
// THE SOFTWARE.

import React, {useCallback, useMemo} from 'react';
import {FormattedMessage} from 'localization';
import {FormattedMessage} from '@kepler.gl/localization';
import {Button, SidePanelDivider, SidePanelSection} from 'components/common/styled-components';
import {Add} from 'components/common/icons';
import SourceDataCatalogFactory from './common/source-data-catalog';
Expand Down
Expand Up @@ -23,7 +23,7 @@ import RangeSliderFactory from 'components/common/range-slider';

import {PanelLabel, SidePanelSection} from 'components/common/styled-components';
import {BRUSH_CONFIG} from 'utils/interaction-utils';
import {FormattedMessage} from 'localization';
import {FormattedMessage} from '@kepler.gl/localization';

BrushConfigFactory.deps = [RangeSliderFactory];

Expand Down
Expand Up @@ -31,7 +31,7 @@ import {
PanelHeaderContent,
PanelContent
} from 'components/common/styled-components';
import {FormattedMessage} from 'localization';
import {FormattedMessage} from '@kepler.gl/localization';

interface InteractionPanelProps {
datasets: any;
Expand Down

0 comments on commit ad7646a

Please sign in to comment.