diff --git a/Makefile b/Makefile index b05d030864d..5297cb1e8e4 100755 --- a/Makefile +++ b/Makefile @@ -109,6 +109,8 @@ locales: msgfmt -o modules/login/locale/ja/LC_MESSAGES/login.mo modules/login/locale/ja/LC_MESSAGES/login.po msgfmt -o modules/media/locale/ja/LC_MESSAGES/media.mo modules/media/locale/ja/LC_MESSAGES/media.po msgfmt -o modules/module_manager/locale/ja/LC_MESSAGES/module_manager.mo modules/module_manager/locale/ja/LC_MESSAGES/module_manager.po + msgfmt -o modules/module_manager/locale/hi/LC_MESSAGES/module_manager.mo modules/module_manager/locale/hi/LC_MESSAGES/module_manager.po + npx i18next-conv -l hi -s modules/module_manager/locale/hi/LC_MESSAGES/module_manager.po -t modules/module_manager/locale/hi/LC_MESSAGES/module_manager.json msgfmt -o modules/mri_violations/locale/ja/LC_MESSAGES/mri_violations.mo modules/mri_violations/locale/ja/LC_MESSAGES/mri_violations.po msgfmt -o modules/next_stage/locale/ja/LC_MESSAGES/next_stage.mo modules/next_stage/locale/ja/LC_MESSAGES/next_stage.po msgfmt -o modules/oidc/locale/ja/LC_MESSAGES/oidc.mo modules/oidc/locale/ja/LC_MESSAGES/oidc.po @@ -141,6 +143,8 @@ login: target=login npm run compile module_manager: + msgfmt -o modules/module_manager/locale/hi/LC_MESSAGES/module_manager.mo modules/module_manager/locale/hi/LC_MESSAGES/module_manager.po + npx i18next-conv -l hi -s modules/module_manager/locale/hi/LC_MESSAGES/module_manager.po -t modules/module_manager/locale/hi/LC_MESSAGES/module_manager.json target=module_manager npm run compile mri_violations: diff --git a/modules/module_manager/jsx/modulemanager.js b/modules/module_manager/jsx/modulemanager.js index 27835d3c059..cdfb0d8e06a 100644 --- a/modules/module_manager/jsx/modulemanager.js +++ b/modules/module_manager/jsx/modulemanager.js @@ -5,6 +5,10 @@ import Loader from 'Loader'; import FilterableDataTable from 'FilterableDataTable'; import swal from 'sweetalert2'; import {SelectElement} from 'jsx/Form'; +import i18n from 'I18nSetup'; +import {withTranslation} from 'react-i18next'; + +import hiStrings from '../locale/hi/LC_MESSAGES/module_manager.json'; /** * Module Manager React Component @@ -63,12 +67,13 @@ class ModuleManagerIndex extends Component { * @return {string} a mapped value for the table cell at a given column */ mapColumn(column, cell) { + const {t} = this.props; switch (column) { - case 'Active': + case t('Active', {ns: 'module_manager'}): if (cell === 'Y') { - return 'Yes'; + return t('Yes', {ns: 'loris'}); } else if (cell === 'N') { - return 'No'; + return t('No', {ns: 'loris'}); } // This shouldn't happen, it's a non-nullable // enum in the backend. @@ -85,6 +90,7 @@ class ModuleManagerIndex extends Component { * @param {number} id */ toggleActive(name, value, id) { + const {t} = this.props; fetch( this.props.BaseURL + '/module_manager/modules/' + name, { @@ -98,18 +104,23 @@ class ModuleManagerIndex extends Component { } ).then((response) => { if (response.status != 205) { - swal.fire('Error!', 'Could not update ' + name + '.', 'error'); + swal.fire( + t('Error!', {ns: 'module_manager'}), + t('Could not update module', {ns: 'module_manager', name}), + 'error' + ); } else { const success = this.setModuleDisplayStatus(name, value); if (success === true) { swal.fire({ - title: 'Success!', - text: 'Updated ' + name + ' status! ' + - 'To apply changes the interface must be reloaded. Proceed?', + title: t('Success!', {ns: 'module_manager'}), + text: t('Updated status', {ns: 'module_manager', name}) + + ' ' + t('ReloadPrompt', {ns: 'module_manager'}), type: 'success', showCancelButton: true, - confirmButtonText: 'Reload the page', - cancelButtonText: 'Continue', + confirmButtonText: t('Reload the page', + {ns: 'module_manager'}), + cancelButtonText: t('Continue', {ns: 'module_manager'}), }).then((status) => { if (status.value) { window.location.href = this.props.BaseURL @@ -120,8 +131,9 @@ class ModuleManagerIndex extends Component { // If we get here something went very wrong, because somehow // a module was toggled that isn't in the table. swal.fire( - 'Error!', - 'Could not find module ' + id + '.', + t('Error!', {ns: 'module_manager'}), + t('Could not find module', + {ns: 'module_manager', id}), 'error' ); } @@ -160,13 +172,16 @@ class ModuleManagerIndex extends Component { * @return {*} a formated table cell for a given column */ formatColumn(column, cell, row) { - if (column == 'Active' && this.props.hasEditPermission) { + const {t} = this.props; + if (column == t('Active', + {ns: 'module_manager'}) && this.props.hasEditPermission) { return