Skip to content

Commit

Permalink
chore: fix i18n imports
Browse files Browse the repository at this point in the history
Make them all the same and import from locales/index.js to ensure the
translations are always added.
  • Loading branch information
edoardo committed Nov 18, 2022
1 parent 75eb300 commit 3edc8b5
Show file tree
Hide file tree
Showing 32 changed files with 32 additions and 32 deletions.
2 changes: 1 addition & 1 deletion src/components/AboutAOUnit/AboutAOUnit.js
Original file line number Diff line number Diff line change
@@ -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,
Expand All @@ -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'
Expand Down
2 changes: 1 addition & 1 deletion src/components/AboutAOUnit/utils.js
Original file line number Diff line number Diff line change
@@ -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'
Expand Down
2 changes: 1 addition & 1 deletion src/components/CachedDataQueryProvider.js
Original file line number Diff line number Diff line change
@@ -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({})

Expand Down
2 changes: 1 addition & 1 deletion src/components/FileMenu/utils.js
Original file line number Diff line number Diff line change
@@ -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'
Expand Down
Original file line number Diff line number Diff line change
@@ -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'
Expand Down
Original file line number Diff line number Diff line change
@@ -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,
Expand Down
Original file line number Diff line number Diff line change
@@ -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 = {
Expand Down
Original file line number Diff line number Diff line change
@@ -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,
Expand Down
Original file line number Diff line number Diff line change
@@ -1,5 +1,4 @@
import { useDataQuery } from '@dhis2/app-runtime'
import i18n from '@dhis2/d2-i18n'
import {
Modal,
ModalActions,
Expand All @@ -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'

Expand Down
Original file line number Diff line number Diff line change
@@ -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,
Expand Down
Original file line number Diff line number Diff line change
@@ -1,5 +1,4 @@
import { useDataQuery } from '@dhis2/app-runtime'
import i18n from '@dhis2/d2-i18n'
import {
CircularLoader,
IconChevronDown24,
Expand All @@ -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'

Expand Down
Original file line number Diff line number Diff line change
@@ -1,4 +1,3 @@
import i18n from '@dhis2/d2-i18n'
import {
Button,
SharingDialog,
Expand All @@ -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'
Expand Down
Original file line number Diff line number Diff line change
@@ -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 = {
Expand Down
Original file line number Diff line number Diff line change
@@ -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)
Expand Down
Original file line number Diff line number Diff line change
@@ -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,
Expand Down
Original file line number Diff line number Diff line change
@@ -1,4 +1,3 @@
import i18n from '@dhis2/d2-i18n'
import { Parser as RichTextParser } from '@dhis2/d2-ui-rich-text'
import {
Button,
Expand All @@ -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,
Expand Down
Original file line number Diff line number Diff line change
@@ -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 (
Expand Down
Original file line number Diff line number Diff line change
@@ -1,4 +1,3 @@
import i18n from '@dhis2/d2-i18n'
import {
CenteredContent,
CircularLoader,
Expand All @@ -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,
Expand Down
2 changes: 1 addition & 1 deletion src/components/OfflineTooltip.js
Original file line number Diff line number Diff line change
@@ -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 = ({
Expand Down
2 changes: 1 addition & 1 deletion src/components/OpenFileDialog/CreatedByFilter.js
Original file line number Diff line number Diff line change
@@ -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

Expand Down
2 changes: 1 addition & 1 deletion src/components/OpenFileDialog/CustomSelectOption.js
Original file line number Diff line number Diff line change
@@ -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 = ({
Expand Down
2 changes: 1 addition & 1 deletion src/components/OpenFileDialog/NameFilter.js
Original file line number Diff line number Diff line change
@@ -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 }) => (
<Input
Expand Down
2 changes: 1 addition & 1 deletion src/components/OpenFileDialog/OpenFileDialog.js
Original file line number Diff line number Diff line change
@@ -1,5 +1,4 @@
import { useDataQuery } from '@dhis2/app-runtime'
import i18n from '@dhis2/d2-i18n'
import {
Box,
Modal,
Expand All @@ -24,6 +23,7 @@ import React, {
useReducer,
useState,
} from 'react'
import i18n from '../../locales/index.js'
import {
VIS_TYPE_GROUP_ALL,
VIS_TYPE_GROUP_CHARTS,
Expand Down
2 changes: 1 addition & 1 deletion src/components/OpenFileDialog/PaginationControls.js
Original file line number Diff line number Diff line change
@@ -1,7 +1,7 @@
import i18n from '@dhis2/d2-i18n'
import { Pagination } from '@dhis2/ui'
import PropTypes from 'prop-types'
import React from 'react'
import i18n from '../../locales/index.js'

export const PaginationControls = ({ page, pager, onPageChange }) => (
<Pagination
Expand Down
2 changes: 1 addition & 1 deletion src/components/OpenFileDialog/VisTypeFilter.js
Original file line number Diff line number Diff line change
@@ -1,7 +1,7 @@
import i18n from '@dhis2/d2-i18n'
import { SingleSelect, colors } from '@dhis2/ui'
import PropTypes from 'prop-types'
import React from 'react'
import i18n from '../../locales/index.js'
import {
getDisplayNameByVisType,
visTypeIcons,
Expand Down
2 changes: 1 addition & 1 deletion src/components/OpenFileDialog/utils.js
Original file line number Diff line number Diff line change
@@ -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'
Expand Down
2 changes: 1 addition & 1 deletion src/components/Options/VisualizationOptions.js
Original file line number Diff line number Diff line change
@@ -1,4 +1,3 @@
import i18n from '@dhis2/d2-i18n'
import {
ButtonStrip,
Modal,
Expand All @@ -14,6 +13,7 @@ import {
} from '@dhis2/ui'
import PropTypes from 'prop-types'
import React, { useState } from 'react'
import i18n from '../../locales/index.js'
import {
modalContent,
tabSection,
Expand Down
Original file line number Diff line number Diff line change
@@ -1,8 +1,8 @@
import { useDataQuery } from '@dhis2/app-runtime'
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'

const query = {
locales: {
Expand Down
Original file line number Diff line number Diff line change
@@ -1,5 +1,4 @@
import { useAlert, useDataMutation } from '@dhis2/app-runtime'
import i18n from '@dhis2/d2-i18n'
import {
CenteredContent,
DataTable,
Expand All @@ -13,6 +12,7 @@ import {
} from '@dhis2/ui'
import PropTypes from 'prop-types'
import React, { useEffect, useRef, useState } from 'react'
import i18n from '../../../locales/index.js'
import { LocalesSelect } from './LocalesSelect.js'
import { TranslationModalActions } from './TranslationModalActions.js'

Expand Down
Original file line number Diff line number Diff line change
@@ -1,4 +1,3 @@
import i18n from '@dhis2/d2-i18n'
import {
CenteredContent,
CircularLoader,
Expand All @@ -8,6 +7,7 @@ import {
} from '@dhis2/ui'
import PropTypes from 'prop-types'
import React, { useEffect, useState } from 'react'
import i18n from '../../../locales/index.js'
import { TranslationForm } from './TranslationForm.js'
import { TranslationModalActions } from './TranslationModalActions.js'
import { useTranslationsResults } from './useTranslationsResults.js'
Expand Down
Original file line number Diff line number Diff line change
@@ -1,8 +1,8 @@
import { useOnlineStatus } from '@dhis2/app-runtime'
import i18n from '@dhis2/d2-i18n'
import { Button, ButtonStrip, ModalActions } from '@dhis2/ui'
import PropTypes from 'prop-types'
import React from 'react'
import i18n from '../../../locales/index.js'
import { OfflineTooltip } from '../../OfflineTooltip.js'

const SaveButton = ({ disabled, loading, onClick }) => (
Expand Down
Original file line number Diff line number Diff line change
@@ -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({
Expand Down

0 comments on commit 3edc8b5

Please sign in to comment.