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 An error occured while loading the page.; + return

{t('An error occured while loading the page.', + {ns: 'loris'})}

; } // Waiting for async data to load @@ -194,20 +211,20 @@ class ModuleManagerIndex extends Component { } const fields = [ - {label: 'Name', show: true, filter: { + {label: t('Name', {ns: 'module_manager'}), show: true, filter: { name: 'Name', type: 'text', }}, - {label: 'Full Name', show: true, filter: { + {label: t('Full Name', {ns: 'module_manager'}), show: true, filter: { name: 'Full Name', type: 'text', }}, - {label: 'Active', show: true, filter: { + {label: t('Active', {ns: 'module_manager'}), show: true, filter: { name: 'Active', type: 'select', options: { - 'Y': 'Yes', - 'N': 'No', + 'Y': t('Yes', {ns: 'loris'}), + 'N': t('No', {ns: 'loris'}), }, }}, ]; @@ -226,13 +243,19 @@ ModuleManagerIndex.propTypes = { dataURL: PropTypes.string.isRequired, BaseURL: PropTypes.string, hasEditPermission: PropTypes.bool, + t: PropTypes.func.isRequired, }; +const TranslatedModuleManagerIndex = + withTranslation(['module_manager', 'loris'])(ModuleManagerIndex); + window.addEventListener('load', () => { + i18n.addResourceBundle('hi', 'module_manager', hiStrings); + createRoot( document.getElementById('lorisworkspace') ).render( - , 2025. +# +msgid "" +msgstr "" +"Project-Id-Version: LORIS 27\n" +"Report-Msgid-Bugs-To: https://github.com/aces/Loris/issues\n" +"POT-Creation-Date: 2025-04-08 14:37-0400\n" +"PO-Revision-Date: YEAR-MO-DA HO:MI+ZONE\n" +"Last-Translator: FULL NAME \n" +"Language-Team: LANGUAGE \n" +"Language: hi\n" +"MIME-Version: 1.0\n" +"Content-Type: text/plain; charset=UTF-8\n" +"Content-Transfer-Encoding: 8bit\n" + +msgid "Module Manager" +msgstr "मॉड्यूल प्रबंधक" + +msgid "Error!" +msgstr "त्रुटि!" + +msgid "Could not update" +msgstr "मॉड्यूल {{name}} को अद्यतन नहीं किया जा सका।" + +msgid "Success!" +msgstr "सफलता!" + +msgid "Updated" +msgstr "{{name}} की स्थिति अद्यतन की गई!" + +msgid "status!" +msgstr "स्थिति!" + +msgid "To apply changes the interface must be reloaded. Proceed?" +msgstr "परिवर्तनों को लागू करने के लिए इंटरफ़ेस को पुनः लोड करना आवश्यक है। क्या आप आगे बढ़ना चाहते हैं?" + +msgid "Reload the page" +msgstr "पृष्ठ पुनः लोड करें" + +msgid "Continue" +msgstr "जारी रखें" + +msgid "Could not find module" +msgstr "मॉड्यूल {{id}} नहीं मिला।" + +msgid "Full Name" +msgstr "पूरा नाम" + +msgid "ReloadPrompt" +msgstr "परिवर्तनों को लागू करने के लिए इंटरफ़ेस को पुनः लोड करना आवश्यक है। क्या आप आगे बढ़ना चाहते हैं?" diff --git a/modules/module_manager/locale/module_manager.pot b/modules/module_manager/locale/module_manager.pot index 37c5ef59dc7..df6b1ba1dc0 100644 --- a/modules/module_manager/locale/module_manager.pot +++ b/modules/module_manager/locale/module_manager.pot @@ -21,3 +21,35 @@ msgstr "" msgid "Module Manager" msgstr "" +msgid "Error!" +msgstr "" + +msgid "Could not update" +msgstr "" + +msgid "Success!" +msgstr "" + +msgid "Updated" +msgstr "" + +msgid "status!" +msgstr "" + +msgid "To apply changes the interface must be reloaded. Proceed?" +msgstr "" + +msgid "Reload the page" +msgstr "" + +msgid "Continue" +msgstr "" + +msgid "Could not find module" +msgstr "" + +msgid "Full Name" +msgstr "" + +msgid "ReloadPrompt" +msgstr "" \ No newline at end of file