From 911e0bb6dad84c8f6f37ad7559aee687871348e1 Mon Sep 17 00:00:00 2001 From: Saket Hatwar Date: Mon, 8 Sep 2025 12:22:51 -0400 Subject: [PATCH 1/5] 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 b05d030864d..c95470d0b03 100755 --- a/Makefile +++ b/Makefile @@ -98,6 +98,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 msgfmt -o modules/imaging_qc/locale/ja/LC_MESSAGES/imaging_qc.mo modules/imaging_qc/locale/ja/LC_MESSAGES/imaging_qc.po msgfmt -o modules/imaging_uploader/locale/ja/LC_MESSAGES/imaging_uploader.mo modules/imaging_uploader/locale/ja/LC_MESSAGES/imaging_uploader.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 6cff629b4f07b573cf8650a370747ce765afae15 Mon Sep 17 00:00:00 2001 From: Saket Hatwar Date: Fri, 12 Sep 2025 08:19:50 -0400 Subject: [PATCH 2/5] 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 1a07b3902dd..a688743629e 100644 --- a/modules/help_editor/jsx/helpEditorForm.js +++ b/modules/help_editor/jsx/helpEditorForm.js @@ -5,6 +5,9 @@ import Markdown from 'jsx/Markdown'; import Help from 'jsx/Help'; import swal from 'sweetalert2'; import {TextboxElement, TextareaElement} 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. @@ -19,6 +22,7 @@ import {TextboxElement, TextareaElement} from 'jsx/Form'; */ const HelpEditorForm = (props) => { + const {t} = props; const [title, setTitle] = useState(props.title ?? ''); const [content, setContent] = useState(props.content ?? ''); const helpPreview = []; @@ -69,17 +73,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'}), }); }); }; @@ -95,13 +101,13 @@ const HelpEditorForm = (props) => {
{ />

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

@@ -135,6 +142,9 @@ HelpEditorForm.propTypes = { subsection: PropTypes.string, helpid: PropTypes.string, url: 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 7f512cc8546..1b447ea0c7d 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 @@ -103,12 +111,12 @@ class HelpEditor extends React.Component { * queried columns in _setupVariables() in media.class.inc */ 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', }}, @@ -129,11 +137,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 ebc58345ca46b2840dee0cd084fc0644cc98cc68 Mon Sep 17 00:00:00 2001 From: Saket Hatwar Date: Fri, 12 Sep 2025 08:38:23 -0400 Subject: [PATCH 3/5] 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 a688743629e..f591df07058 100644 --- a/modules/help_editor/jsx/helpEditorForm.js +++ b/modules/help_editor/jsx/helpEditorForm.js @@ -74,7 +74,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'}), }); @@ -82,7 +82,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'}), @@ -116,7 +116,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 @@ -135,13 +134,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 7dd1a7703e043ba653724a54e888230fa398b36d Mon Sep 17 00:00:00 2001 From: Saket Hatwar Date: Fri, 19 Sep 2025 07:50:09 -0400 Subject: [PATCH 4/5] 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 de384aa9bfe..d4158983577 100644 --- a/locale/hi/LC_MESSAGES/loris.po +++ b/locale/hi/LC_MESSAGES/loris.po @@ -172,6 +172,9 @@ msgstr "उन्नत फ़िल्टर दिखाएँ" msgid "Hide Advanced Filters" 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 5502469ddfc..fd6b3d80ed0 100644 --- a/locale/loris.pot +++ b/locale/loris.pot @@ -171,6 +171,9 @@ msgstr "" msgid "Hide Advanced Filters" 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 f591df07058..f3013bece68 100644 --- a/modules/help_editor/jsx/helpEditorForm.js +++ b/modules/help_editor/jsx/helpEditorForm.js @@ -122,7 +122,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 150bdc176a1..c63a0980cb8 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 f8d21df6602b3864531b88259c49bc27aa24b2c9 Mon Sep 17 00:00:00 2001 From: Saket Hatwar Date: Tue, 21 Oct 2025 16:18:02 -0400 Subject: [PATCH 5/5] fix --- locale/hi/LC_MESSAGES/loris.po | 3 +++ locale/loris.pot | 3 +++ modules/help_editor/jsx/helpEditorForm.js | 2 +- modules/help_editor/locale/help_editor.pot | 6 +++--- modules/help_editor/locale/hi/LC_MESSAGES/help_editor.po | 3 +++ modules/help_editor/php/edit_help_content.class.inc | 4 ++++ 6 files changed, 17 insertions(+), 4 deletions(-) diff --git a/locale/hi/LC_MESSAGES/loris.po b/locale/hi/LC_MESSAGES/loris.po index d4158983577..da0bd9fbbef 100644 --- a/locale/hi/LC_MESSAGES/loris.po +++ b/locale/hi/LC_MESSAGES/loris.po @@ -117,6 +117,9 @@ msgstr "हाँ" msgid "No" msgstr "नहीं" +msgid "Close" +msgstr "बंद करें" + # Common candidate terms msgid "PSCID" msgstr "पीएससीआईडी" diff --git a/locale/loris.pot b/locale/loris.pot index fd6b3d80ed0..d4c92bb8796 100644 --- a/locale/loris.pot +++ b/locale/loris.pot @@ -116,6 +116,9 @@ msgstr "" msgid "No" msgstr "" +msgid "Close" +msgstr "" + # Common candidate terms msgid "PSCID" msgstr "" diff --git a/modules/help_editor/jsx/helpEditorForm.js b/modules/help_editor/jsx/helpEditorForm.js index f3013bece68..75d713cedd0 100644 --- a/modules/help_editor/jsx/helpEditorForm.js +++ b/modules/help_editor/jsx/helpEditorForm.js @@ -76,7 +76,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); diff --git a/modules/help_editor/locale/help_editor.pot b/modules/help_editor/locale/help_editor.pot index e6ddeedd300..75fda79d3ee 100644 --- a/modules/help_editor/locale/help_editor.pot +++ b/modules/help_editor/locale/help_editor.pot @@ -21,6 +21,9 @@ msgstr "" msgid "Help Editor" msgstr "" +msgid "Edit Help Content" +msgstr "" + msgid "Help ID" msgstr "" @@ -39,9 +42,6 @@ msgstr "" msgid "Content update successful!" msgstr "" -msgid "Close" -msgstr "" - msgid "Content update unsuccessful." 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 9a9a2fd10ea..0f6abb25175 100644 --- a/modules/help_editor/locale/hi/LC_MESSAGES/help_editor.po +++ b/modules/help_editor/locale/hi/LC_MESSAGES/help_editor.po @@ -21,6 +21,9 @@ msgstr "" msgid "Help Editor" msgstr "सहायता संपादक" +msgid "Edit Help Content" +msgstr "सहायता सामग्री संपादित करें" + msgid "Help ID" msgstr "सहायता आईडी" diff --git a/modules/help_editor/php/edit_help_content.class.inc b/modules/help_editor/php/edit_help_content.class.inc index 5b2f6813693..58565b951d3 100644 --- a/modules/help_editor/php/edit_help_content.class.inc +++ b/modules/help_editor/php/edit_help_content.class.inc @@ -144,6 +144,10 @@ class Edit_Help_Content extends \NDB_Form } } + $data['edit_help_text'] = dgettext('help_editor', 'Edit Help Content'); + $data['display_title'] = !empty($data['title']) ? $data['title'] : + $data['edit_help_text']; + $this->tpl_data = $data; return (new \LORIS\Http\Response()) ->withBody(new \LORIS\Http\StringStream($this->display() ?? ""));