From ad9449fb6635d401a207246faec1cc0c89f5fad9 Mon Sep 17 00:00:00 2001 From: Saket Hatwar Date: Mon, 8 Sep 2025 12:22:51 -0400 Subject: [PATCH 1/6] Change po and pot files --- Makefile | 2 + modules/help_editor/locale/help_editor.pot | 32 +++++++++++ .../locale/hi/LC_MESSAGES/help_editor.po | 55 +++++++++++++++++++ 3 files changed, 89 insertions(+) create mode 100644 modules/help_editor/locale/hi/LC_MESSAGES/help_editor.po diff --git a/Makefile b/Makefile index ae8037c67e6..3689ce1e5ea 100755 --- a/Makefile +++ b/Makefile @@ -123,6 +123,8 @@ locales: msgfmt -o modules/examiner/locale/ja/LC_MESSAGES/examiner.mo modules/examiner/locale/ja/LC_MESSAGES/examiner.po msgfmt -o modules/genomic_browser/locale/ja/LC_MESSAGES/genomic_browser.mo modules/genomic_browser/locale/ja/LC_MESSAGES/genomic_browser.po msgfmt -o modules/help_editor/locale/ja/LC_MESSAGES/help_editor.mo modules/help_editor/locale/ja/LC_MESSAGES/help_editor.po + msgfmt -o modules/help_editor/locale/hi/LC_MESSAGES/help_editor.mo modules/help_editor/locale/hi/LC_MESSAGES/help_editor.po + npx i18next-conv -l hi -s modules/help_editor/locale/hi/LC_MESSAGES/help_editor.po -t modules/help_editor/locale/hi/LC_MESSAGES/help_editor.json msgfmt -o modules/imaging_browser/locale/ja/LC_MESSAGES/imaging_browser.mo modules/imaging_browser/locale/ja/LC_MESSAGES/imaging_browser.po npx i18next-conv -l ja -s modules/imaging_browser/locale/ja/LC_MESSAGES/imaging_browser.po -t modules/imaging_browser/locale/ja/LC_MESSAGES/imaging_browser.json --compatibilityJSON v4 msgfmt -o modules/imaging_qc/locale/ja/LC_MESSAGES/imaging_qc.mo modules/imaging_qc/locale/ja/LC_MESSAGES/imaging_qc.po diff --git a/modules/help_editor/locale/help_editor.pot b/modules/help_editor/locale/help_editor.pot index 5cde67162bc..d4f90040785 100644 --- a/modules/help_editor/locale/help_editor.pot +++ b/modules/help_editor/locale/help_editor.pot @@ -21,3 +21,35 @@ msgstr "" msgid "Help Editor" msgstr "" +msgid "Help ID" +msgstr "" + +msgid "Topic" +msgstr "" + +msgid "Content" +msgstr "" + +msgid "Title" +msgstr "" + +msgid "Open the help dialog to preview the changes." +msgstr "" + +msgid "Save" +msgstr "" + +msgid "Content update successful!" +msgstr "" + +msgid "Close" +msgstr "" + +msgid "Content update unsuccessful." +msgstr "" + +msgid "Something went wrong" +msgstr "" + +msgid "Try again" +msgstr "" \ No newline at end of file diff --git a/modules/help_editor/locale/hi/LC_MESSAGES/help_editor.po b/modules/help_editor/locale/hi/LC_MESSAGES/help_editor.po new file mode 100644 index 00000000000..9d98cbc6613 --- /dev/null +++ b/modules/help_editor/locale/hi/LC_MESSAGES/help_editor.po @@ -0,0 +1,55 @@ +# Default LORIS strings to be translated (English). +# Copy this to a language specific file and add translations to the +# new file. +# Copyright (C) 2025 +# This file is distributed under the same license as the LORIS package. +# Dave MacFarlane , 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 "Help Editor" +msgstr "सहायता संपादक" + +msgid "Help ID" +msgstr "सहायता आईडी" + +msgid "Topic" +msgstr "विषय" + +msgid "Content" +msgstr "सामग्री" + +msgid "Title" +msgstr "शीर्षक" + +msgid "Open the help dialog to preview the changes." +msgstr "परिवर्तनों का पूर्वावलोकन करने के लिए सहायता संवाद खोलें।" + +msgid "Save" +msgstr "सहेजें" + +msgid "Content update successful!" +msgstr "सामग्री सफलतापूर्वक अपडेट की गई!" + +msgid "Close" +msgstr "बंद करें" + +msgid "Content update unsuccessful." +msgstr "सामग्री अपडेट असफल रहा।" + +msgid "Something went wrong" +msgstr "कुछ गलत हो गया" + +msgid "Try again" +msgstr "पुनः प्रयास करें" From b974a5a6ca2038cf7d0388b342e49345ad115290 Mon Sep 17 00:00:00 2001 From: Saket Hatwar Date: Fri, 12 Sep 2025 08:19:50 -0400 Subject: [PATCH 2/6] modify js files --- modules/help_editor/jsx/helpEditorForm.js | 30 +++++++++++++++-------- modules/help_editor/jsx/help_editor.js | 29 ++++++++++++++++------ 2 files changed, 41 insertions(+), 18 deletions(-) diff --git a/modules/help_editor/jsx/helpEditorForm.js b/modules/help_editor/jsx/helpEditorForm.js index 7c758663363..82fe9ccc343 100644 --- a/modules/help_editor/jsx/helpEditorForm.js +++ b/modules/help_editor/jsx/helpEditorForm.js @@ -6,6 +6,9 @@ import Help from 'jsx/Help'; import swal from 'sweetalert2'; import {TextboxElement, TextareaElement} from 'jsx/Form'; import {SelectElement} from 'jsx/Form'; +import {withTranslation} from 'react-i18next'; +import i18n from 'I18nSetup'; +import hiStrings from '../locale/hi/LC_MESSAGES/help_editor.json'; /** * Help Editor Form Page. @@ -20,6 +23,7 @@ import {SelectElement} from 'jsx/Form'; */ const HelpEditorForm = (props) => { + const {t} = props; const [title, setTitle] = useState(props.title ?? ''); const [content, setContent] = useState(props.content ?? ''); const [instrument, setInstrument] = useState(props.instrument ?? ''); @@ -86,17 +90,19 @@ const HelpEditorForm = (props) => { return; } swal.fire({ - title: 'Content update successful!', + title: t('Content update successful!', + {ns: 'help_editor'}), type: 'success', - confirmButtonText: 'Close', + confirmButtonText: t('Close', {ns: 'help_editor'}), }); }).catch((error) => { console.error(error); swal.fire({ - title: 'Content update unsuccessful.', - text: 'Something went wrong', + title: t('Content update unsuccessful.', + {ns: 'help_editor'}), + text: t('Something went wrong', {ns: 'help_editor'}), type: 'error', - confirmButtonText: 'Try again', + confirmButtonText: t('Try again', {ns: 'help_editor'}), }); }); }; @@ -122,13 +128,13 @@ const HelpEditorForm = (props) => { disabled={props.helpid !== null} /> { />

- Open the help dialog to preview the changes. + {t('Open the help dialog to preview the changes.', + {ns: 'help_editor'})}

@@ -164,6 +171,9 @@ HelpEditorForm.propTypes = { url: PropTypes.string, instrument: PropTypes.string, instrumentslist: PropTypes.objectOf(PropTypes.string), + t: PropTypes.func, }; -window.RHelpEditorForm = React.createFactory(HelpEditorForm); +i18n.addResourceBundle('hi', 'help_editor', hiStrings); +window.RHelpEditorForm = React.createFactory( + withTranslation(['help_editor'])(HelpEditorForm)); diff --git a/modules/help_editor/jsx/help_editor.js b/modules/help_editor/jsx/help_editor.js index 5446836f967..aed5c52f3b2 100644 --- a/modules/help_editor/jsx/help_editor.js +++ b/modules/help_editor/jsx/help_editor.js @@ -3,6 +3,11 @@ import Loader from 'Loader'; import PropTypes from 'prop-types'; import {createRoot} from 'react-dom/client'; import React from 'react'; +import i18n from 'I18nSetup'; +import hiStrings from '../locale/hi/LC_MESSAGES/help_editor.json'; +import {withTranslation} from 'react-i18next'; + + /** * Help Editor Archive Page. @@ -67,13 +72,14 @@ class HelpEditor extends React.Component { * @return {*} a formatted table cell for a given column */ formatColumn(column, cell, row) { + const {t} = this.props; let url; let result = {cell}; switch (column) { - case 'Topic': + case t('Topic', {ns: 'help_editor'}): url = loris.BaseURL + '/help_editor/edit_help_content/?helpID=' - + row['Help ID']; - result = {cell}; + + row[t('Help ID', {ns: 'help_editor'})]; + result = {cell}; break; } @@ -86,10 +92,12 @@ class HelpEditor extends React.Component { * @return {JSX} - React markup for the component */ render() { + const {t} = this.props; // If error occurs, return a message. // XXX: Replace this with a UI component for 500 errors. if (this.state.error) { - return

An error occured while loading the page.

; + return

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

; } // Waiting for async data to load @@ -107,12 +115,12 @@ class HelpEditor extends React.Component { {label: 'Adding help content for a specific instrument', action: addHelp}, ]; const fields = [ - {label: 'Help ID', show: false}, - {label: 'Topic', show: true, filter: { + {label: t('Help ID', {ns: 'help_editor'}), show: false}, + {label: t('Topic', {ns: 'help_editor'}), show: true, filter: { name: 'topic', type: 'text', }}, - {label: 'Content', show: true, filter: { + {label: t('Content', {ns: 'help_editor'}), show: true, filter: { name: 'content', type: 'text', }}, @@ -135,11 +143,16 @@ HelpEditor.propTypes = { dataURL: PropTypes.string.isRequired, }; +const TranslatedHelpEditor = withTranslation( + ['help_editor'])(HelpEditor); + window.addEventListener('load', () => { + + i18n.addResourceBundle('hi', 'help_editor', hiStrings); createRoot( document.getElementById('lorisworkspace') ).render( - From 07930697a3a669380695c2d38276ec34e290489a Mon Sep 17 00:00:00 2001 From: Saket Hatwar Date: Fri, 12 Sep 2025 08:38:23 -0400 Subject: [PATCH 3/6] lint --- modules/help_editor/jsx/helpEditorForm.js | 6 +++--- modules/help_editor/jsx/help_editor.js | 5 ++--- 2 files changed, 5 insertions(+), 6 deletions(-) diff --git a/modules/help_editor/jsx/helpEditorForm.js b/modules/help_editor/jsx/helpEditorForm.js index 82fe9ccc343..c0bdb81b108 100644 --- a/modules/help_editor/jsx/helpEditorForm.js +++ b/modules/help_editor/jsx/helpEditorForm.js @@ -91,7 +91,7 @@ const HelpEditorForm = (props) => { } swal.fire({ title: t('Content update successful!', - {ns: 'help_editor'}), + {ns: 'help_editor'}), type: 'success', confirmButtonText: t('Close', {ns: 'help_editor'}), }); @@ -99,7 +99,7 @@ const HelpEditorForm = (props) => { console.error(error); swal.fire({ title: t('Content update unsuccessful.', - {ns: 'help_editor'}), + {ns: 'help_editor'}), text: t('Something went wrong', {ns: 'help_editor'}), type: 'error', confirmButtonText: t('Try again', {ns: 'help_editor'}), @@ -143,7 +143,7 @@ const HelpEditorForm = (props) => {

{t('Open the help dialog to preview the changes.', - {ns: 'help_editor'})} + {ns: 'help_editor'})}

{t('An error occured while loading the page.', - {ns: 'help_editor'})}; + {ns: 'help_editor'})}; } // Waiting for async data to load @@ -141,13 +140,13 @@ class HelpEditor extends React.Component { HelpEditor.propTypes = { dataURL: PropTypes.string.isRequired, + t: PropTypes.func, }; const TranslatedHelpEditor = withTranslation( ['help_editor'])(HelpEditor); window.addEventListener('load', () => { - i18n.addResourceBundle('hi', 'help_editor', hiStrings); createRoot( document.getElementById('lorisworkspace') From f9b5e0cfa6cbb9fd5ee2e54f459f11039c08dd35 Mon Sep 17 00:00:00 2001 From: Saket Hatwar Date: Fri, 19 Sep 2025 07:50:09 -0400 Subject: [PATCH 4/6] ove --- locale/hi/LC_MESSAGES/loris.po | 3 +++ locale/loris.pot | 3 +++ modules/help_editor/jsx/helpEditorForm.js | 2 +- modules/help_editor/jsx/help_editor.js | 2 +- modules/help_editor/locale/help_editor.pot | 3 --- modules/help_editor/locale/hi/LC_MESSAGES/help_editor.po | 3 --- 6 files changed, 8 insertions(+), 8 deletions(-) diff --git a/locale/hi/LC_MESSAGES/loris.po b/locale/hi/LC_MESSAGES/loris.po index e19c9f495a2..95917cdf03b 100644 --- a/locale/hi/LC_MESSAGES/loris.po +++ b/locale/hi/LC_MESSAGES/loris.po @@ -241,6 +241,9 @@ msgstr "सहेजें" msgid "Reset" msgstr "रीसेट करें" +msgid "Save" +msgstr "सहेजें" + # Data table strings msgid "{{pageCount}} rows displayed of {{totalCount}}." msgstr "{{totalCount}} में से {{pageCount}} पंक्तियाँ प्रदर्शित" diff --git a/locale/loris.pot b/locale/loris.pot index 139852bb837..6355df17e18 100644 --- a/locale/loris.pot +++ b/locale/loris.pot @@ -249,6 +249,9 @@ msgstr "" msgid "Reset" msgstr "" +msgid "Save" +msgstr "" + # Data table strings msgid "{{pageCount}} rows displayed of {{totalCount}}." msgstr "" diff --git a/modules/help_editor/jsx/helpEditorForm.js b/modules/help_editor/jsx/helpEditorForm.js index c0bdb81b108..0844e562467 100644 --- a/modules/help_editor/jsx/helpEditorForm.js +++ b/modules/help_editor/jsx/helpEditorForm.js @@ -149,7 +149,7 @@ const HelpEditorForm = (props) => { className="btn btn-sm btn-primary" id="save-help" name="fire_away" - value={t('Save', {ns: 'help_editor'})} + value={t('Save', {ns: 'loris'})} type="submit" onClick={save} /> diff --git a/modules/help_editor/jsx/help_editor.js b/modules/help_editor/jsx/help_editor.js index 82bb30dd3b6..af8927fcf7a 100644 --- a/modules/help_editor/jsx/help_editor.js +++ b/modules/help_editor/jsx/help_editor.js @@ -96,7 +96,7 @@ class HelpEditor extends React.Component { // XXX: Replace this with a UI component for 500 errors. if (this.state.error) { return

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

; + {ns: 'loris'})}; } // Waiting for async data to load diff --git a/modules/help_editor/locale/help_editor.pot b/modules/help_editor/locale/help_editor.pot index d4f90040785..e6ddeedd300 100644 --- a/modules/help_editor/locale/help_editor.pot +++ b/modules/help_editor/locale/help_editor.pot @@ -36,9 +36,6 @@ msgstr "" msgid "Open the help dialog to preview the changes." msgstr "" -msgid "Save" -msgstr "" - msgid "Content update successful!" msgstr "" diff --git a/modules/help_editor/locale/hi/LC_MESSAGES/help_editor.po b/modules/help_editor/locale/hi/LC_MESSAGES/help_editor.po index 9d98cbc6613..9a9a2fd10ea 100644 --- a/modules/help_editor/locale/hi/LC_MESSAGES/help_editor.po +++ b/modules/help_editor/locale/hi/LC_MESSAGES/help_editor.po @@ -36,9 +36,6 @@ msgstr "शीर्षक" msgid "Open the help dialog to preview the changes." msgstr "परिवर्तनों का पूर्वावलोकन करने के लिए सहायता संवाद खोलें।" -msgid "Save" -msgstr "सहेजें" - msgid "Content update successful!" msgstr "सामग्री सफलतापूर्वक अपडेट की गई!" From 14575a7a6a1e4aca0e6b53de53f7a7f1645f3d8f Mon Sep 17 00:00:00 2001 From: Saket Hatwar Date: Tue, 21 Oct 2025 16:18:02 -0400 Subject: [PATCH 5/6] fix --- locale/hi/LC_MESSAGES/loris.po | 2 ++ locale/loris.pot | 1 + modules/help_editor/jsx/helpEditorForm.js | 14 +++++++------- modules/help_editor/jsx/help_editor.js | 5 +++-- modules/help_editor/locale/help_editor.pot | 12 +++++++++--- .../locale/hi/LC_MESSAGES/help_editor.po | 9 +++++++++ .../help_editor/php/edit_help_content.class.inc | 4 ++++ 7 files changed, 35 insertions(+), 12 deletions(-) diff --git a/locale/hi/LC_MESSAGES/loris.po b/locale/hi/LC_MESSAGES/loris.po index 95917cdf03b..b9989255586 100644 --- a/locale/hi/LC_MESSAGES/loris.po +++ b/locale/hi/LC_MESSAGES/loris.po @@ -154,6 +154,8 @@ msgstr "रद्द करें" msgid "Success!" msgstr "सफलता!" +msgid "Close" +msgstr "बंद करें" # Common candidate terms msgid "PSCID" diff --git a/locale/loris.pot b/locale/loris.pot index 6355df17e18..ed6b5e6a172 100644 --- a/locale/loris.pot +++ b/locale/loris.pot @@ -155,6 +155,7 @@ msgid "Cancel" msgstr "" msgid "Success!" +msgid "Close" msgstr "" # Common candidate terms diff --git a/modules/help_editor/jsx/helpEditorForm.js b/modules/help_editor/jsx/helpEditorForm.js index 0844e562467..3d5243d5b9b 100644 --- a/modules/help_editor/jsx/helpEditorForm.js +++ b/modules/help_editor/jsx/helpEditorForm.js @@ -76,15 +76,15 @@ const HelpEditorForm = (props) => { method: 'POST', body: formData, }).then((response) => { - console.log(response); - if (response.status !== 200) { swal.fire({ - title: 'Content update unsuccessful.', - text: 'Help content cannot be added to an instrument ' + title: t('Content update unsuccessful.', + {ns: 'help_editor'}), + text: t('Help content cannot be added to an instrument ' + 'that has already been registered.', + {ns: 'help_editor'}), type: 'error', - confirmButtonText: 'Try again', + confirmButtonText: t('Try again', {ns: 'help_editor'}), }); console.error(response.status); return; @@ -93,7 +93,7 @@ const HelpEditorForm = (props) => { title: t('Content update successful!', {ns: 'help_editor'}), type: 'success', - confirmButtonText: t('Close', {ns: 'help_editor'}), + confirmButtonText: t('Close', {ns: 'loris'}), }); }).catch((error) => { console.error(error); @@ -120,7 +120,7 @@ const HelpEditorForm = (props) => { tpl_data = $data; return (new \LORIS\Http\Response()) ->withBody(new \LORIS\Http\StringStream($this->display() ?? "")); From 8c932dea7805217194462ff11662827624f88456 Mon Sep 17 00:00:00 2001 From: T Saket Hatwar <112693309+SKADE2303@users.noreply.github.com> Date: Wed, 5 Nov 2025 03:21:45 +0530 Subject: [PATCH 6/6] remove duplicate --- locale/hi/LC_MESSAGES/loris.po | 4 +--- 1 file changed, 1 insertion(+), 3 deletions(-) diff --git a/locale/hi/LC_MESSAGES/loris.po b/locale/hi/LC_MESSAGES/loris.po index b9989255586..7b7b5489119 100644 --- a/locale/hi/LC_MESSAGES/loris.po +++ b/locale/hi/LC_MESSAGES/loris.po @@ -154,6 +154,7 @@ msgstr "रद्द करें" msgid "Success!" msgstr "सफलता!" + msgid "Close" msgstr "बंद करें" @@ -243,9 +244,6 @@ msgstr "सहेजें" msgid "Reset" msgstr "रीसेट करें" -msgid "Save" -msgstr "सहेजें" - # Data table strings msgid "{{pageCount}} rows displayed of {{totalCount}}." msgstr "{{totalCount}} में से {{pageCount}} पंक्तियाँ प्रदर्शित"