Skip to content

Commit d1c2fc0

Browse files
authored
[i18n/imaging_browser] Translate imaging QC summary on candidate_profile (#10078)
This translates the "Imaging QC Summary" widget on the candidate_profile and adds Japanese translations as an example.
1 parent 8fa10a8 commit d1c2fc0

File tree

5 files changed

+66
-12
lines changed

5 files changed

+66
-12
lines changed

Makefile

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -121,6 +121,7 @@ locales:
121121
msgfmt -o modules/genomic_browser/locale/ja/LC_MESSAGES/genomic_browser.mo modules/genomic_browser/locale/ja/LC_MESSAGES/genomic_browser.po
122122
msgfmt -o modules/help_editor/locale/ja/LC_MESSAGES/help_editor.mo modules/help_editor/locale/ja/LC_MESSAGES/help_editor.po
123123
msgfmt -o modules/imaging_browser/locale/ja/LC_MESSAGES/imaging_browser.mo modules/imaging_browser/locale/ja/LC_MESSAGES/imaging_browser.po
124+
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
124125
msgfmt -o modules/imaging_qc/locale/ja/LC_MESSAGES/imaging_qc.mo modules/imaging_qc/locale/ja/LC_MESSAGES/imaging_qc.po
125126
msgfmt -o modules/imaging_uploader/locale/ja/LC_MESSAGES/imaging_uploader.mo modules/imaging_uploader/locale/ja/LC_MESSAGES/imaging_uploader.po
126127
msgfmt -o modules/instrument_builder/locale/ja/LC_MESSAGES/instrument_builder.mo modules/instrument_builder/locale/ja/LC_MESSAGES/instrument_builder.po

modules/imaging_browser/jsx/CandidateScanQCSummaryWidget.js

Lines changed: 22 additions & 11 deletions
Original file line numberDiff line numberDiff line change
@@ -1,7 +1,10 @@
11
import '../../../node_modules/c3/c3.css';
22
import c3 from 'c3';
3-
import React, {useEffect} from 'react';
3+
import React, {useEffect, useState} from 'react';
44
import PropTypes from 'prop-types';
5+
import {useTranslation} from 'react-i18next';
6+
import 'I18nSetup';
7+
import jaStrings from '../locale/ja/LC_MESSAGES/imaging_browser.json';
58

69
/**
710
* A CandidateScanQCSummaryWidget is a type of React widget
@@ -12,10 +15,13 @@ import PropTypes from 'prop-types';
1215
* @return {*} - rendered React component
1316
*/
1417
function CandidateScanQCSummaryWidget(props) {
18+
const {t, i18n} = useTranslation();
19+
const [reload, setReload] = useState(0);
1520
useEffect(() => {
1621
const modalities = getModalities(props.Files);
1722
const data = getDataObject(modalities, props.Files);
1823
const visits = getVisits(props.Files);
24+
i18n.addResourceBundle('ja', 'imaging_browser', jaStrings);
1925
c3.generate({
2026
bindto: '#imagebreakdownchart',
2127
data: {
@@ -35,37 +41,42 @@ function CandidateScanQCSummaryWidget(props) {
3541
type: 'category',
3642
categories: visits,
3743
label: {
38-
text: 'Visit',
44+
text: t('Visit', {ns: 'loris'}),
3945
position: 'outer-center',
4046
},
4147
},
4248
y: {
4349
label: {
4450
position: 'outer-middle',
45-
text: 'Number of Scans',
51+
text: t('Number of Scans', {ns: 'imaging_browser'}),
4652
},
4753
},
4854
},
4955
legend: {
5056
show: false,
5157
},
5258
});
53-
});
59+
setReload(reload+1);
60+
}, [t]);
5461

5562
return <div>
5663
<div id='imagebreakdownchart' />
5764
<ul>
58-
<li>Red bar denotes number of failed QC scans.</li>
59-
<li>Green bar denotes number of passed QC scans.</li>
60-
<li>Grey bar denotes other QC statuses.</li>
65+
<li>{t('Red bar denotes number of failed QC scans.',
66+
{ns: 'imaging_browser'})}</li>
67+
<li>{t('Green bar denotes number of passed QC scans.',
68+
{ns: 'imaging_browser'})}</li>
69+
<li>{t('Grey bar denotes other QC statuses.',
70+
{ns: 'imaging_browser'})}</li>
6171
</ul>
6272
<p>
63-
Different shades represent different modalities.
64-
Only native modalities are displayed in results.
73+
{t('Different shades represent different modalities. '
74+
+ 'Only native modalities are displayed in results.',
75+
{ns: 'imaging_browser'})}
6576
</p>
6677
<p>
67-
Hover over any visit to see detailed modality breakdown for visit,
68-
click to go to imaging browser.
78+
{t('Hover over any visit to see detailed modality breakdown for visit, '
79+
+ 'click to go to imaging browser.', {ns: 'imaging_browser'})}
6980
</p>
7081
</div>;
7182
}

modules/imaging_browser/locale/imaging_browser.pot

Lines changed: 21 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -33,3 +33,24 @@ msgstr ""
3333
msgid "Imaging Session"
3434
msgid_plural "Imaging Sessions"
3535
msgstr[0] ""
36+
37+
msgid "Imaging QC Summary"
38+
msgstr ""
39+
40+
msgid "Number of Scans"
41+
msgstr ""
42+
43+
msgid "Red bar denotes number of failed QC scans."
44+
msgstr ""
45+
46+
msgid "Green bar denotes number of passed QC scans."
47+
msgstr ""
48+
49+
msgid "Grey bar denotes other QC statuses."
50+
msgstr ""
51+
52+
msgid "Different shades represent different modalities. Only native modalities are displayed in results."
53+
msgstr ""
54+
55+
msgid "Hover over any visit to see detailed modality breakdown for visit, click to go to imaging browser."
56+
msgstr ""

modules/imaging_browser/locale/ja/LC_MESSAGES/imaging_browser.po

Lines changed: 21 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -34,3 +34,24 @@ msgstr "新規および保留中のMRI セッション"
3434
msgid "Imaging Session"
3535
msgid_plural "Imaging Sessions"
3636
msgstr[0] "イメージングセッション"
37+
38+
msgid "Imaging QC Summary"
39+
msgstr "画像品質管理の概要"
40+
41+
msgid "Number of Scans"
42+
msgstr "スキャン回数"
43+
44+
msgid "Red bar denotes number of failed QC scans."
45+
msgstr "赤いバーは、品質管理に失敗したスキャンの数を示します。"
46+
47+
msgid "Green bar denotes number of passed QC scans."
48+
msgstr "緑色のバーは、品質管理に合格したが失敗したスキャンの数を示します。"
49+
50+
msgid "Grey bar denotes other QC statuses."
51+
msgstr "灰色のバーはその他の品質管理ステータスを示します。"
52+
53+
msgid "Different shades represent different modalities. Only native modalities are displayed in results."
54+
msgstr "異なる色合いは異なるモダリティを表します。結果にはネイティブモダリティのみが表示されます。"
55+
56+
msgid "Hover over any visit to see detailed modality breakdown for visit, click to go to imaging browser."
57+
msgstr "訪問の上にマウスを移動すると、訪問の詳細なモダリティの内訳が表示されます。クリックすると、イメージング ブラウザーに移動します。"

modules/imaging_browser/php/module.class.inc

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -115,7 +115,7 @@ class Module extends \Module
115115
}
116116
return [
117117
new CandidateWidget(
118-
"Imaging QC Summary",
118+
dgettext("imaging_browser", "Imaging QC Summary"),
119119
$baseURL. "/imaging_browser/js/CandidateScanQCSummaryWidget.js",
120120
"lorisjs.imaging_browser.CandidateScanQCSummaryWidget.default",
121121
[ 'Files' => iterator_to_array($scansummary)],

0 commit comments

Comments
 (0)