From 3edc8b54cddad182199712fb42a045272d9b630f Mon Sep 17 00:00:00 2001 From: Edoardo Sabadelli Date: Fri, 18 Nov 2022 11:33:01 +0100 Subject: [PATCH] chore: fix i18n imports Make them all the same and import from locales/index.js to ensure the translations are always added. --- src/components/AboutAOUnit/AboutAOUnit.js | 2 +- src/components/AboutAOUnit/utils.js | 2 +- src/components/CachedDataQueryProvider.js | 2 +- src/components/FileMenu/utils.js | 2 +- src/components/Interpretations/InterpretationModal/Comment.js | 2 +- .../Interpretations/InterpretationModal/CommentAddForm.js | 2 +- .../Interpretations/InterpretationModal/CommentDeleteButton.js | 2 +- .../Interpretations/InterpretationModal/CommentUpdateForm.js | 2 +- .../Interpretations/InterpretationModal/InterpretationModal.js | 2 +- .../Interpretations/InterpretationsUnit/InterpretationForm.js | 2 +- .../Interpretations/InterpretationsUnit/InterpretationsUnit.js | 2 +- .../Interpretations/common/Interpretation/Interpretation.js | 2 +- .../common/Interpretation/InterpretationDeleteButton.js | 2 +- .../common/Interpretation/InterpretationSharingLink.js | 2 +- .../common/Interpretation/InterpretationUpdateForm.js | 2 +- .../Interpretations/common/RichTextEditor/RichTextEditor.js | 2 +- src/components/Interpretations/common/UserMention/UserList.js | 2 +- .../Interpretations/common/UserMention/UserMentionWrapper.js | 2 +- src/components/OfflineTooltip.js | 2 +- src/components/OpenFileDialog/CreatedByFilter.js | 2 +- src/components/OpenFileDialog/CustomSelectOption.js | 2 +- src/components/OpenFileDialog/NameFilter.js | 2 +- src/components/OpenFileDialog/OpenFileDialog.js | 2 +- src/components/OpenFileDialog/PaginationControls.js | 2 +- src/components/OpenFileDialog/VisTypeFilter.js | 2 +- src/components/OpenFileDialog/utils.js | 2 +- src/components/Options/VisualizationOptions.js | 2 +- .../TranslationDialog/TranslationModal/LocalesSelect.js | 2 +- .../TranslationDialog/TranslationModal/TranslationForm.js | 2 +- .../TranslationDialog/TranslationModal/TranslationModal.js | 2 +- .../TranslationModal/TranslationModalActions.js | 2 +- .../TranslationModal/useTranslationsResults.js | 2 +- 32 files changed, 32 insertions(+), 32 deletions(-) diff --git a/src/components/AboutAOUnit/AboutAOUnit.js b/src/components/AboutAOUnit/AboutAOUnit.js index 0fb7fb78e..ca0893011 100644 --- a/src/components/AboutAOUnit/AboutAOUnit.js +++ b/src/components/AboutAOUnit/AboutAOUnit.js @@ -1,5 +1,4 @@ import { useDataQuery, useDataMutation } from '@dhis2/app-runtime' -import i18n from '@dhis2/d2-i18n' import { Parser as RichTextParser } from '@dhis2/d2-ui-rich-text' import { Button, @@ -24,6 +23,7 @@ import React, { forwardRef, useImperativeHandle, } from 'react' +import i18n from '../../locales/index.js' import { formatList } from '../../modules/list.js' import styles from './styles/AboutAOUnit.style.js' import { getTranslatedString, AOTypeMap } from './utils.js' diff --git a/src/components/AboutAOUnit/utils.js b/src/components/AboutAOUnit/utils.js index eb0295cf6..b5874a5c5 100644 --- a/src/components/AboutAOUnit/utils.js +++ b/src/components/AboutAOUnit/utils.js @@ -1,4 +1,4 @@ -import i18n from '@dhis2/d2-i18n' +import i18n from '../../locales/index.js' export const AO_TYPE_VISUALIZATION = 'visualization' export const AO_TYPE_MAP = 'map' diff --git a/src/components/CachedDataQueryProvider.js b/src/components/CachedDataQueryProvider.js index 47646a1f1..32adc57d4 100644 --- a/src/components/CachedDataQueryProvider.js +++ b/src/components/CachedDataQueryProvider.js @@ -1,8 +1,8 @@ import { useDataQuery } from '@dhis2/app-runtime' -import i18n from '@dhis2/d2-i18n' import { Layer, CenteredContent, CircularLoader, NoticeBox } from '@dhis2/ui' import PropTypes from 'prop-types' import React, { createContext, useContext } from 'react' +import i18n from '../locales/index.js' const CachedDataQueryCtx = createContext({}) diff --git a/src/components/FileMenu/utils.js b/src/components/FileMenu/utils.js index 7cca04a9d..a513289e7 100644 --- a/src/components/FileMenu/utils.js +++ b/src/components/FileMenu/utils.js @@ -1,4 +1,4 @@ -import i18n from '@dhis2/d2-i18n' +import i18n from '../../locales/index.js' export const FILE_TYPE_EVENT_REPORT = 'eventReport' export const FILE_TYPE_VISUALIZATION = 'visualization' diff --git a/src/components/Interpretations/InterpretationModal/Comment.js b/src/components/Interpretations/InterpretationModal/Comment.js index 2e7e07637..f00f761c5 100644 --- a/src/components/Interpretations/InterpretationModal/Comment.js +++ b/src/components/Interpretations/InterpretationModal/Comment.js @@ -1,7 +1,7 @@ -import i18n from '@dhis2/d2-i18n' import { IconEdit16 } from '@dhis2/ui' import PropTypes from 'prop-types' import React, { useState } from 'react' +import i18n from '../../../locales/index.js' import { Message, MessageIconButton, MessageStatsBar } from '../common/index.js' import { CommentDeleteButton } from './CommentDeleteButton.js' import { CommentUpdateForm } from './CommentUpdateForm.js' diff --git a/src/components/Interpretations/InterpretationModal/CommentAddForm.js b/src/components/Interpretations/InterpretationModal/CommentAddForm.js index 9cae2d4a7..8de0fc376 100644 --- a/src/components/Interpretations/InterpretationModal/CommentAddForm.js +++ b/src/components/Interpretations/InterpretationModal/CommentAddForm.js @@ -1,8 +1,8 @@ import { useDataMutation } from '@dhis2/app-runtime' -import i18n from '@dhis2/d2-i18n' import { Button } from '@dhis2/ui' import PropTypes from 'prop-types' import React, { useRef, useState } from 'react' +import i18n from '../../../locales/index.js' import { RichTextEditor, MessageEditorContainer, diff --git a/src/components/Interpretations/InterpretationModal/CommentDeleteButton.js b/src/components/Interpretations/InterpretationModal/CommentDeleteButton.js index 228896126..6386c4bb7 100644 --- a/src/components/Interpretations/InterpretationModal/CommentDeleteButton.js +++ b/src/components/Interpretations/InterpretationModal/CommentDeleteButton.js @@ -1,8 +1,8 @@ import { useDataMutation } from '@dhis2/app-runtime' -import i18n from '@dhis2/d2-i18n' import { IconDelete16 } from '@dhis2/ui' import PropTypes from 'prop-types' import React from 'react' +import i18n from '../../../locales/index.js' import { MessageIconButton } from '../common/index.js' const mutation = { diff --git a/src/components/Interpretations/InterpretationModal/CommentUpdateForm.js b/src/components/Interpretations/InterpretationModal/CommentUpdateForm.js index 1b1dec89c..060e944ab 100644 --- a/src/components/Interpretations/InterpretationModal/CommentUpdateForm.js +++ b/src/components/Interpretations/InterpretationModal/CommentUpdateForm.js @@ -1,8 +1,8 @@ import { useDataMutation } from '@dhis2/app-runtime' -import i18n from '@dhis2/d2-i18n' import { Button, spacers, colors } from '@dhis2/ui' import PropTypes from 'prop-types' import React, { useState, useRef } from 'react' +import i18n from '../../../locales/index.js' import { MessageEditorContainer, RichTextEditor, diff --git a/src/components/Interpretations/InterpretationModal/InterpretationModal.js b/src/components/Interpretations/InterpretationModal/InterpretationModal.js index f2d693838..59602f10f 100644 --- a/src/components/Interpretations/InterpretationModal/InterpretationModal.js +++ b/src/components/Interpretations/InterpretationModal/InterpretationModal.js @@ -1,5 +1,4 @@ import { useDataQuery } from '@dhis2/app-runtime' -import i18n from '@dhis2/d2-i18n' import { Modal, ModalActions, @@ -16,6 +15,7 @@ import cx from 'classnames' import PropTypes from 'prop-types' import React, { useEffect, useState } from 'react' import css from 'styled-jsx/css' +import i18n from '../../../locales/index.js' import { InterpretationThread } from './InterpretationThread.js' import { useModalContentWidth } from './useModalContentWidth.js' diff --git a/src/components/Interpretations/InterpretationsUnit/InterpretationForm.js b/src/components/Interpretations/InterpretationsUnit/InterpretationForm.js index 67f95d0ad..b0d811553 100644 --- a/src/components/Interpretations/InterpretationsUnit/InterpretationForm.js +++ b/src/components/Interpretations/InterpretationsUnit/InterpretationForm.js @@ -1,8 +1,8 @@ import { useDataMutation } from '@dhis2/app-runtime' -import i18n from '@dhis2/d2-i18n' import { Button, Input } from '@dhis2/ui' import PropTypes from 'prop-types' import React, { useRef, useState } from 'react' +import i18n from '../../../locales/index.js' import { RichTextEditor, MessageEditorContainer, diff --git a/src/components/Interpretations/InterpretationsUnit/InterpretationsUnit.js b/src/components/Interpretations/InterpretationsUnit/InterpretationsUnit.js index 3a6d6d257..42ac08201 100644 --- a/src/components/Interpretations/InterpretationsUnit/InterpretationsUnit.js +++ b/src/components/Interpretations/InterpretationsUnit/InterpretationsUnit.js @@ -1,5 +1,4 @@ import { useDataQuery } from '@dhis2/app-runtime' -import i18n from '@dhis2/d2-i18n' import { CircularLoader, IconChevronDown24, @@ -16,6 +15,7 @@ import React, { useImperativeHandle, forwardRef, } from 'react' +import i18n from '../../../locales/index.js' import { InterpretationForm } from './InterpretationForm.js' import { InterpretationList } from './InterpretationList.js' diff --git a/src/components/Interpretations/common/Interpretation/Interpretation.js b/src/components/Interpretations/common/Interpretation/Interpretation.js index 736d78da5..2dc12ea53 100644 --- a/src/components/Interpretations/common/Interpretation/Interpretation.js +++ b/src/components/Interpretations/common/Interpretation/Interpretation.js @@ -1,4 +1,3 @@ -import i18n from '@dhis2/d2-i18n' import { Button, SharingDialog, @@ -9,6 +8,7 @@ import { } from '@dhis2/ui' import PropTypes from 'prop-types' import React, { useState } from 'react' +import i18n from '../../../../locales/index.js' import { Message, MessageStatsBar, MessageIconButton } from '../index.js' import { InterpretationDeleteButton } from './InterpretationDeleteButton.js' import { InterpretationUpdateForm } from './InterpretationUpdateForm.js' diff --git a/src/components/Interpretations/common/Interpretation/InterpretationDeleteButton.js b/src/components/Interpretations/common/Interpretation/InterpretationDeleteButton.js index cae57b00b..573b18ce3 100644 --- a/src/components/Interpretations/common/Interpretation/InterpretationDeleteButton.js +++ b/src/components/Interpretations/common/Interpretation/InterpretationDeleteButton.js @@ -1,8 +1,8 @@ import { useDataMutation } from '@dhis2/app-runtime' -import i18n from '@dhis2/d2-i18n' import { IconDelete16 } from '@dhis2/ui' import PropTypes from 'prop-types' import React from 'react' +import i18n from '../../../../locales/index.js' import { MessageIconButton } from '../index.js' const mutation = { diff --git a/src/components/Interpretations/common/Interpretation/InterpretationSharingLink.js b/src/components/Interpretations/common/Interpretation/InterpretationSharingLink.js index f13f6a94a..d381df6de 100644 --- a/src/components/Interpretations/common/Interpretation/InterpretationSharingLink.js +++ b/src/components/Interpretations/common/Interpretation/InterpretationSharingLink.js @@ -1,7 +1,7 @@ -import i18n from '@dhis2/d2-i18n' import { SharingDialog, colors, spacers } from '@dhis2/ui' import PropTypes from 'prop-types' import React, { useState } from 'react' +import i18n from '../../../../locales/index.js' const InterpretationSharingLink = ({ type, id }) => { const [showSharingDialog, setShowSharingDialog] = useState(false) diff --git a/src/components/Interpretations/common/Interpretation/InterpretationUpdateForm.js b/src/components/Interpretations/common/Interpretation/InterpretationUpdateForm.js index cf900fdf1..acc8f64b0 100644 --- a/src/components/Interpretations/common/Interpretation/InterpretationUpdateForm.js +++ b/src/components/Interpretations/common/Interpretation/InterpretationUpdateForm.js @@ -1,8 +1,8 @@ import { useDataMutation } from '@dhis2/app-runtime' -import i18n from '@dhis2/d2-i18n' import { Button, spacers, colors } from '@dhis2/ui' import PropTypes from 'prop-types' import React, { useState } from 'react' +import i18n from '../../../../locales/index.js' import { MessageEditorContainer, RichTextEditor, diff --git a/src/components/Interpretations/common/RichTextEditor/RichTextEditor.js b/src/components/Interpretations/common/RichTextEditor/RichTextEditor.js index ba2eba9fe..4d9ea52e4 100644 --- a/src/components/Interpretations/common/RichTextEditor/RichTextEditor.js +++ b/src/components/Interpretations/common/RichTextEditor/RichTextEditor.js @@ -1,4 +1,3 @@ -import i18n from '@dhis2/d2-i18n' import { Parser as RichTextParser } from '@dhis2/d2-ui-rich-text' import { Button, @@ -14,6 +13,7 @@ import { } from '@dhis2/ui' import PropTypes from 'prop-types' import React, { forwardRef, useRef, useEffect, useState } from 'react' +import i18n from '../../../../locales/index.js' import { UserMentionWrapper } from '../UserMention/UserMentionWrapper.js' import { convertCtrlKey, diff --git a/src/components/Interpretations/common/UserMention/UserList.js b/src/components/Interpretations/common/UserMention/UserList.js index 5aa04a844..8cc56e5c5 100644 --- a/src/components/Interpretations/common/UserMention/UserList.js +++ b/src/components/Interpretations/common/UserMention/UserList.js @@ -1,7 +1,7 @@ -import i18n from '@dhis2/d2-i18n' import { MenuItem } from '@dhis2/ui' import PropTypes from 'prop-types' import React from 'react' +import i18n from '../../../../locales/index.js' export const UserList = ({ users, selectedUserIndex, onUserClick, pager }) => { return ( diff --git a/src/components/Interpretations/common/UserMention/UserMentionWrapper.js b/src/components/Interpretations/common/UserMention/UserMentionWrapper.js index 394cc39bc..0fb4607d5 100644 --- a/src/components/Interpretations/common/UserMention/UserMentionWrapper.js +++ b/src/components/Interpretations/common/UserMention/UserMentionWrapper.js @@ -1,4 +1,3 @@ -import i18n from '@dhis2/d2-i18n' import { CenteredContent, CircularLoader, @@ -11,6 +10,7 @@ import { } from '@dhis2/ui' import PropTypes from 'prop-types' import React, { useState, useRef } from 'react' +import i18n from '../../../../locales/index.js' import { resolvedHeaderStyle, userMentionWrapperClasses, diff --git a/src/components/OfflineTooltip.js b/src/components/OfflineTooltip.js index 633e2011e..096ef120c 100644 --- a/src/components/OfflineTooltip.js +++ b/src/components/OfflineTooltip.js @@ -1,9 +1,9 @@ import { useOnlineStatus } from '@dhis2/app-runtime' -import i18n from '@dhis2/d2-i18n' import { Tooltip } from '@dhis2/ui' import cx from 'classnames' import PropTypes from 'prop-types' import React from 'react' +import i18n from '../locales/index.js' import { styles } from './styles/OfflineTooltip.style.js' const OfflineTooltip = ({ diff --git a/src/components/OpenFileDialog/CreatedByFilter.js b/src/components/OpenFileDialog/CreatedByFilter.js index b7bd74a43..ae43db1f3 100644 --- a/src/components/OpenFileDialog/CreatedByFilter.js +++ b/src/components/OpenFileDialog/CreatedByFilter.js @@ -1,7 +1,7 @@ -import i18n from '@dhis2/d2-i18n' import { SingleSelect, SingleSelectOption } from '@dhis2/ui' import PropTypes from 'prop-types' import React from 'react' +import i18n from '../../locales/index.js' // TODO change the "Created by" prefix to "Creator" or something that does not require a context for the translators diff --git a/src/components/OpenFileDialog/CustomSelectOption.js b/src/components/OpenFileDialog/CustomSelectOption.js index c920b26ce..f1dab7e5b 100644 --- a/src/components/OpenFileDialog/CustomSelectOption.js +++ b/src/components/OpenFileDialog/CustomSelectOption.js @@ -1,8 +1,8 @@ -import i18n from '@dhis2/d2-i18n' import { MenuDivider, Tooltip } from '@dhis2/ui' import cx from 'classnames' import PropTypes from 'prop-types' import React from 'react' +import i18n from '../../locales/index.js' import styles from './styles/CustomSelectOption.style.js' const CustomSelectOptionItem = ({ diff --git a/src/components/OpenFileDialog/NameFilter.js b/src/components/OpenFileDialog/NameFilter.js index 1b6f3b2e3..0e05aed71 100644 --- a/src/components/OpenFileDialog/NameFilter.js +++ b/src/components/OpenFileDialog/NameFilter.js @@ -1,7 +1,7 @@ -import i18n from '@dhis2/d2-i18n' import { Input } from '@dhis2/ui' import PropTypes from 'prop-types' import React from 'react' +import i18n from '../../locales/index.js' export const NameFilter = ({ dataTest, value, onChange }) => ( ( ( diff --git a/src/components/TranslationDialog/TranslationModal/useTranslationsResults.js b/src/components/TranslationDialog/TranslationModal/useTranslationsResults.js index bed37cf8e..844cc62d3 100644 --- a/src/components/TranslationDialog/TranslationModal/useTranslationsResults.js +++ b/src/components/TranslationDialog/TranslationModal/useTranslationsResults.js @@ -1,6 +1,6 @@ import { useAlert, useDataQuery } from '@dhis2/app-runtime' -import i18n from '@dhis2/d2-i18n' import { useRef } from 'react' +import i18n from '../../../locales/index.js' export const useTranslationsResults = ({ resource }) => { const translationsQueryRef = useRef({