Skip to content
New issue

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

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

Already on GitHub? Sign in to your account

chore: fix i18n imports and usage #1380

Open
wants to merge 7 commits into
base: master
Choose a base branch
from
Open
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
2 changes: 1 addition & 1 deletion src/components/AboutAOUnit/AboutAOUnit.js
Original file line number Diff line number Diff line change
Expand Up @@ -3,7 +3,6 @@ import {
useDataMutation,
useTimeZoneConversion,
} from '@dhis2/app-runtime'
import i18n from '@dhis2/d2-i18n'
import {
Button,
CircularLoader,
Expand All @@ -27,6 +26,7 @@ import React, {
forwardRef,
useImperativeHandle,
} from 'react'
import i18n from '../../locales/index.js'
import { formatList } from '../../modules/list.js'
import { RichTextParser } from '../RichText/index.js'
import styles from './styles/AboutAOUnit.style.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/DataDimension/Calculation/FormulaField.js
Original file line number Diff line number Diff line change
@@ -1,10 +1,10 @@
import i18n from '@dhis2/d2-i18n'
import { Center, CircularLoader } from '@dhis2/ui'
import { useDroppable } from '@dnd-kit/core'
import { SortableContext } from '@dnd-kit/sortable'
import PropTypes from 'prop-types'
import React from 'react'
import FormulaIcon from '../../../assets/FormulaIcon.js'
import i18n from '../../../locales/index.js'
import DropZone from './DropZone.js'
import FormulaItem from './FormulaItem.js'
import styles from './styles/FormulaField.style.js'
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,
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 } from '../../RichText/index.js'
import {
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, colors } from '@dhis2/ui'
import PropTypes from 'prop-types'
import React, { useState } 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 { RichTextEditor } from '../../RichText/index.js'
import { MessageEditorContainer, MessageButtonStrip } from '../common/index.js'

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, useMemo } 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 } from '../../RichText/index.js'
import { MessageEditorContainer, MessageButtonStrip } from '../common/index.js'

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 @@ -11,6 +10,7 @@ import {
} from '@dhis2/ui'
import PropTypes from 'prop-types'
import React, { useState } from 'react'
import i18n from '../../../../locales/index.js'
import {
Message,
MessageStatsBar,
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 { RichTextEditor } from '../../../RichText/index.js'
import {
MessageEditorContainer,
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 { useDhis2ConnectionStatus } 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
2 changes: 1 addition & 1 deletion src/components/PivotTable/PivotTableValueCell.js
Original file line number Diff line number Diff line change
@@ -1,6 +1,6 @@
import i18n from '@dhis2/d2-i18n'
import PropTypes from 'prop-types'
import React, { useRef } from 'react'
import i18n from '../../locales/index.js'
import { applyLegendSet } from '../../modules/pivotTable/applyLegendSet.js'
import { CELL_TYPE_VALUE } from '../../modules/pivotTable/pivotTableConstants.js'
import {
Expand Down
2 changes: 1 addition & 1 deletion src/components/RichText/Editor/Editor.js
Original file line number Diff line number Diff line change
@@ -1,4 +1,3 @@
import i18n from '@dhis2/d2-i18n'
import {
Button,
Popover,
Expand All @@ -14,6 +13,7 @@ import {
import cx from 'classnames'
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 { Parser } from '../Parser/Parser.js'
import {
Expand Down
2 changes: 1 addition & 1 deletion src/components/Toolbar/InterpretationsAndDetailsToggler.js
Original file line number Diff line number Diff line change
@@ -1,7 +1,7 @@
import i18n from '@dhis2/d2-i18n'
import { IconChevronRight24, IconChevronLeft24 } from '@dhis2/ui'
import PropTypes from 'prop-types'
import React from 'react'
import i18n from '../../locales/index.js'
import menuButtonStyles from './MenuButton.styles.js'

export const InterpretationsAndDetailsToggler = ({
Expand Down
2 changes: 1 addition & 1 deletion src/components/Toolbar/UpdateButton.js
Original file line number Diff line number Diff line change
@@ -1,9 +1,9 @@
import { CircularLoader } from '@dhis2-ui/loader'
import i18n from '@dhis2/d2-i18n'
import { colors } from '@dhis2/ui-constants'
import { IconSync16 } from '@dhis2/ui-icons'
import PropTypes from 'prop-types'
import React from 'react'
import i18n from '../../locales/index.js'
import menuButtonStyles from './MenuButton.styles.js'

export const UpdateButton = ({ onClick, disabled, loading, dataTest }) => (
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 @@
} 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 Expand Up @@ -146,7 +146,7 @@
fetchFieldsTranslations(fieldsToTranslate)

fetchTranslations()
}, [fieldsToTranslate])

Check warning on line 149 in src/components/TranslationDialog/TranslationModal/TranslationForm.js

View workflow job for this annotation

GitHub Actions / unit

React Hook useEffect has a missing dependency: 'fetchFieldsTranslations'. Either include it or remove the dependency array

useEffect(() => setNewTranslations(translations), [translations])

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 { useDhis2ConnectionStatus } 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
2 changes: 1 addition & 1 deletion src/components/UserMention/UserList.js
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
2 changes: 1 addition & 1 deletion src/components/UserMention/UserMentionWrapper.js
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/modules/pivotTable/PivotTableEngine.js
Original file line number Diff line number Diff line change
@@ -1,5 +1,5 @@
import i18n from '@dhis2/d2-i18n'
import times from 'lodash/times'
import i18n from '../../locales/index.js'
import {
DIMENSION_TYPE_DATA,
DIMENSION_TYPE_DATA_ELEMENT_GROUP_SET,
Expand Down
Loading