diff --git a/Makefile b/Makefile index 9e906cc7d45..6892349e0c2 100755 --- a/Makefile +++ b/Makefile @@ -97,6 +97,8 @@ locales: npx i18next-conv -l hi -s modules/datadict/locale/hi/LC_MESSAGES/datadict.po -t modules/datadict/locale/hi/LC_MESSAGES/datadict.json npx i18next-conv -l ja -s modules/datadict/locale/ja/LC_MESSAGES/datadict.po -t modules/datadict/locale/ja/LC_MESSAGES/datadict.json msgfmt -o modules/dataquery/locale/ja/LC_MESSAGES/dataquery.mo modules/dataquery/locale/ja/LC_MESSAGES/dataquery.po + msgfmt -o modules/dataquery/locale/hi/LC_MESSAGES/dataquery.mo modules/dataquery/locale/hi/LC_MESSAGES/dataquery.po + npx i18next-conv -l hi -s modules/dataquery/locale/hi/LC_MESSAGES/dataquery.po -t modules/dataquery/locale/hi/LC_MESSAGES/dataquery.json msgfmt -o modules/data_release/locale/ja/LC_MESSAGES/data_release.mo modules/data_release/locale/ja/LC_MESSAGES/data_release.po npx i18next-conv -l ja -s modules/data_release/locale/ja/LC_MESSAGES/data_release.po -t modules/data_release/locale/ja/LC_MESSAGES/data_release.json msgfmt -o modules/data_release/locale/hi/LC_MESSAGES/data_release.mo modules/data_release/locale/hi/LC_MESSAGES/data_release.po @@ -153,8 +155,9 @@ data_release: modules/data_release/locale/hi/LC_MESSAGES/data_release.mo modules instrument_manager: modules/instrument_manager/locale/ja/LC_MESSAGES/instrument_manager.mo target=instrument_manager npm run compile -dataquery: modules/dataquery/locale/ja/LC_MESSAGES/dataquery.mo - msgfmt -o modules/dataquery/locale/ja/LC_MESSAGES/dataquery.mo modules/dataquery/locale/ja/LC_MESSAGES/dataquery.po +dataquery: + msgfmt -o modules/dataquery/locale/hi/LC_MESSAGES/dataquery.mo modules/dataquery/locale/hi/LC_MESSAGES/dataquery.po + npx i18next-conv -l hi -s modules/dataquery/locale/hi/LC_MESSAGES/dataquery.po -t modules/dataquery/locale/hi/LC_MESSAGES/dataquery.json target=dataquery npm run compile login: modules/login/locale/ja/LC_MESSAGES/login.mo diff --git a/jsx/I18nSetup.d.ts b/jsx/I18nSetup.d.ts new file mode 100644 index 00000000000..ae231792a8f --- /dev/null +++ b/jsx/I18nSetup.d.ts @@ -0,0 +1,4 @@ +declare module 'I18nSetup' { + import i18n from 'i18next'; + export default i18n; +} diff --git a/jsx/Modal.tsx b/jsx/Modal.tsx index 9a2d0f46f19..78c7a6f3bd7 100644 --- a/jsx/Modal.tsx +++ b/jsx/Modal.tsx @@ -1,4 +1,5 @@ import {useState, PropsWithChildren, CSSProperties, ReactNode} from 'react'; +import {useTranslation} from 'react-i18next'; import Swal from 'sweetalert2'; import Loader from './Loader'; import { @@ -38,6 +39,7 @@ const Modal = ({ }: ModalProps) => { const [loading, setLoading] = useState(false); // Tracks loading during submit const [success, setSuccess] = useState(false); // Tracks success after submit + const {t} = useTranslation('loris'); /** * Handles modal close event. Shows a confirmation if `throwWarning` is true. @@ -45,13 +47,14 @@ const Modal = ({ const handleClose = () => { if (throwWarning) { // Display warning if enabled Swal.fire({ - title: 'Are You Sure?', - text: 'Leaving the form will result in the loss of any information ' + - 'entered.', + title: t('Are You Sure?', {ns: 'loris'}), + text: t('Leaving the form will result in the loss ' + +'of any information entered.', + {ns: 'loris'}), type: 'warning', showCancelButton: true, - confirmButtonText: 'Proceed', - cancelButtonText: 'Cancel', + confirmButtonText: t('Proceed', {ns: 'loris'}), + cancelButtonText: t('Cancel', {ns: 'loris'}), }).then((result) => result.value && onClose()); } else { onClose(); // Close immediately if no warning @@ -175,7 +178,7 @@ const Modal = ({ const loader = loading && (