Skip to content
Open
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
2 changes: 2 additions & 0 deletions Makefile
Original file line number Diff line number Diff line change
Expand Up @@ -111,6 +111,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
Expand Down
3 changes: 3 additions & 0 deletions locale/hi/LC_MESSAGES/loris.po
Original file line number Diff line number Diff line change
Expand Up @@ -187,6 +187,9 @@ msgstr "उन्नत फ़िल्टर दिखाएँ"
msgid "Hide Advanced Filters"
msgstr "उन्नत फ़िल्टर छुपाएँ"

msgid "Save"
msgstr "सहेजें"

# Data table strings
msgid "{{pageCount}} rows displayed of {{totalCount}}."
msgstr "{{totalCount}} में से {{pageCount}} पंक्तियाँ प्रदर्शित"
Expand Down
3 changes: 3 additions & 0 deletions locale/loris.pot
Original file line number Diff line number Diff line change
Expand Up @@ -199,6 +199,9 @@ msgstr ""
msgid "Hide Advanced Filters"
msgstr ""

msgid "Save"
msgstr ""

msgid "Language"
msgstr ""

Expand Down
30 changes: 20 additions & 10 deletions modules/help_editor/jsx/helpEditorForm.js
Original file line number Diff line number Diff line change
Expand Up @@ -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.
Expand All @@ -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 = [];
Expand Down Expand Up @@ -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'}),
});
});
};
Expand All @@ -95,27 +101,28 @@ const HelpEditorForm = (props) => {
<div className="row">
<div className="col-sm-9">
<TextboxElement
label='Title'
label={t('Title', {ns: 'help_editor'})}
name='title'
value={title}
onUserInput={onUserInput}
/>
<TextareaElement
label='Content'
label={t('Content', {ns: 'help_editor'})}
rows={15}
name='content'
value={content}
onUserInput={onUserInput}
/>
<div className="col-sm-9 col-sm-offset-3">
<p><small>
Open the help dialog to preview the changes.
{t('Open the help dialog to preview the changes.',
{ns: 'help_editor'})}
</small></p>
<input
className="btn btn-sm btn-primary"
id="save-help"
name="fire_away"
value="Save"
value={t('Save', {ns: 'loris'})}
type="submit"
onClick={save}
/>
Expand All @@ -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));
28 changes: 20 additions & 8 deletions modules/help_editor/jsx/help_editor.js
Original file line number Diff line number Diff line change
Expand Up @@ -3,6 +3,10 @@ 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.
Expand Down Expand Up @@ -67,13 +71,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 = <td>{cell}</td>;
switch (column) {
case 'Topic':
case t('Topic', {ns: 'help_editor'}):
url = loris.BaseURL + '/help_editor/edit_help_content/?helpID='
+ row['Help ID'];
result = <td><a href ={url}>{cell}</a></td>;
+ row[t('Help ID', {ns: 'help_editor'})];
result = <td><a href={url}>{cell}</a></td>;
break;
}

Expand All @@ -86,10 +91,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 <h3>An error occured while loading the page.</h3>;
return <h3>{t('An error occured while loading the page.',
Copy link
Collaborator

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

loris namespace

Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

yes,
image

please point to the correct namespace @SKADE2303

{ns: 'loris'})}</h3>;
}

// Waiting for async data to load
Expand All @@ -103,12 +110,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',
}},
Expand All @@ -127,13 +134,18 @@ 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')
).render(
<HelpEditor
<TranslatedHelpEditor
Module="help_editor"
dataURL={loris.BaseURL + '/help_editor/?format=json'}
/>
Expand Down
29 changes: 29 additions & 0 deletions modules/help_editor/locale/help_editor.pot
Original file line number Diff line number Diff line change
Expand Up @@ -21,3 +21,32 @@ 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 "Content update successful!"
msgstr ""

msgid "Close"
msgstr ""

msgid "Content update unsuccessful."
msgstr ""

msgid "Something went wrong"
msgstr ""

msgid "Try again"
msgstr ""
52 changes: 52 additions & 0 deletions modules/help_editor/locale/hi/LC_MESSAGES/help_editor.po
Original file line number Diff line number Diff line change
@@ -0,0 +1,52 @@
# 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 <[email protected]>, 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 <EMAIL@ADDRESS>\n"
"Language-Team: LANGUAGE <[email protected]>\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 "Content update successful!"
msgstr "सामग्री सफलतापूर्वक अपडेट की गई!"

msgid "Close"
msgstr "बंद करें"

msgid "Content update unsuccessful."
msgstr "सामग्री अपडेट असफल रहा।"

msgid "Something went wrong"
msgstr "कुछ गलत हो गया"

msgid "Try again"
msgstr "पुनः प्रयास करें"
Loading