Skip to content

Commit 779903c

Browse files
author
lorisadmin
committed
Updates .po and .pot files.
2 parents 0d164ab + 0859c3a commit 779903c

33 files changed

Lines changed: 1263 additions & 309 deletions

File tree

.github/workflows/loristest.yml

Lines changed: 2 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -22,6 +22,7 @@ jobs:
2222
# (see https://github.com/actions/runner-images/blob/releases/ubuntu22/20230305/images/linux/Ubuntu2204-Readme.md)
2323
# that updated the list of installed apt packages/apt repositories. That issue may disappear in future Ubuntu images.
2424
run: |
25+
sudo apt-get update
2526
sudo apt install -y imagemagick-6-common libmagickcore-6.q16-7t64 libmagickwand-6.q16-7t64 \
2627
libprotobuf-dev libprotobuf32t64 libprotoc32t64 protobuf-compiler
2728
cd modules/electrophysiology_browser/jsx/react-series-data-viewer/
@@ -270,6 +271,7 @@ jobs:
270271
# (see https://github.com/actions/runner-images/blob/releases/ubuntu22/20230305/images/linux/Ubuntu2204-Readme.md)
271272
# that updated the list of installed apt packages/apt repositories. That issue may disappear in future Ubuntu images.
272273
run: |
274+
sudo apt-get update
273275
sudo apt install -y imagemagick-6-common libmagickcore-6.q16-7t64 libmagickwand-6.q16-7t64 \
274276
libprotobuf-dev libprotobuf32t64 libprotoc32t64 protobuf-compiler gettext
275277
cd modules/electrophysiology_browser/jsx/react-series-data-viewer/

Makefile

Lines changed: 25 additions & 20 deletions
Original file line numberDiff line numberDiff line change
@@ -3,6 +3,9 @@
33
all: node_modules locales VERSION vendor
44
npm run build
55

6+
%.mo: %.po
7+
msgfmt -o $@ $<
8+
69
# If anything changes, re-generate the VERSION file
710
VERSION: .
811
tools/gen-version.sh
@@ -60,13 +63,18 @@ testdata:
6063
php tools/raisinbread_refresh.php
6164

6265
locales:
66+
msgfmt -o locale/en/LC_MESSAGES/loris.mo locale/en/LC_MESSAGES/loris.po
67+
npx i18next-conv -l en -s locale/en/LC_MESSAGES/loris.po -t locale/en/LC_MESSAGES/loris.json --compatibilityJSON v4
6368
msgfmt -o locale/ja/LC_MESSAGES/loris.mo locale/ja/LC_MESSAGES/loris.po
64-
npx i18next-conv -l ja -s locale/ja/LC_MESSAGES/loris.po -t locale/ja/LC_MESSAGES/loris.json
69+
npx i18next-conv -l ja -s locale/ja/LC_MESSAGES/loris.po -t locale/ja/LC_MESSAGES/loris.json --compatibilityJSON v4
6570
msgfmt -o locale/hi/LC_MESSAGES/loris.mo locale/hi/LC_MESSAGES/loris.po
66-
npx i18next-conv -l hi -s locale/hi/LC_MESSAGES/loris.po -t locale/hi/LC_MESSAGES/loris.json
71+
npx i18next-conv -l hi -s locale/hi/LC_MESSAGES/loris.po -t locale/hi/LC_MESSAGES/loris.json --compatibilityJSON v4
6772
msgfmt -o locale/es/LC_MESSAGES/loris.mo locale/es/LC_MESSAGES/loris.po
68-
npx i18next-conv -l es -s locale/es/LC_MESSAGES/loris.po -t locale/es/LC_MESSAGES/loris.json
73+
npx i18next-conv -l es -s locale/es/LC_MESSAGES/loris.po -t locale/es/LC_MESSAGES/loris.json --compatibilityJSON v4
6974
msgfmt -o modules/new_profile/locale/ja/LC_MESSAGES/new_profile.mo modules/new_profile/locale/ja/LC_MESSAGES/new_profile.po
75+
npx i18next-conv -l ja -s modules/new_profile/locale/ja/LC_MESSAGES/new_profile.po -t modules/new_profile/locale/ja/LC_MESSAGES/new_profile.json
76+
msgfmt -o modules/new_profile/locale/hi/LC_MESSAGES/new_profile.mo modules/new_profile/locale/hi/LC_MESSAGES/new_profile.po
77+
npx i18next-conv -l hi -s modules/new_profile/locale/hi/LC_MESSAGES/new_profile.po -t modules/new_profile/locale/hi/LC_MESSAGES/new_profile.json
7078
msgfmt -o modules/acknowledgements/locale/ja/LC_MESSAGES/acknowledgements.mo modules/acknowledgements/locale/ja/LC_MESSAGES/acknowledgements.po
7179
msgfmt -o modules/api_docs/locale/ja/LC_MESSAGES/api_docs.mo modules/api_docs/locale/ja/LC_MESSAGES/api_docs.po
7280
msgfmt -o modules/battery_manager/locale/ja/LC_MESSAGES/battery_manager.mo modules/battery_manager/locale/ja/LC_MESSAGES/battery_manager.po
@@ -122,6 +130,7 @@ locales:
122130
msgfmt -o modules/module_manager/locale/ja/LC_MESSAGES/module_manager.mo modules/module_manager/locale/ja/LC_MESSAGES/module_manager.po
123131
msgfmt -o modules/mri_violations/locale/ja/LC_MESSAGES/mri_violations.mo modules/mri_violations/locale/ja/LC_MESSAGES/mri_violations.po
124132
msgfmt -o modules/next_stage/locale/ja/LC_MESSAGES/next_stage.mo modules/next_stage/locale/ja/LC_MESSAGES/next_stage.po
133+
msgfmt -o modules/next_stage/locale/es/LC_MESSAGES/next_stage.mo modules/next_stage/locale/es/LC_MESSAGES/next_stage.po
125134
msgfmt -o modules/oidc/locale/ja/LC_MESSAGES/oidc.mo modules/oidc/locale/ja/LC_MESSAGES/oidc.po
126135
msgfmt -o modules/publication/locale/ja/LC_MESSAGES/publication.mo modules/publication/locale/ja/LC_MESSAGES/publication.po
127136
msgfmt -o modules/schedule_module/locale/ja/LC_MESSAGES/schedule_module.mo modules/schedule_module/locale/ja/LC_MESSAGES/schedule_module.po
@@ -134,55 +143,51 @@ locales:
134143
msgfmt -o modules/user_accounts/locale/ja/LC_MESSAGES/user_accounts.mo modules/user_accounts/locale/ja/LC_MESSAGES/user_accounts.po
135144

136145

137-
acknowledgements:
146+
acknowledgements: modules/acknowledgements/locale/ja/LC_MESSAGES/acknowledgements.mo
138147
target=acknowledgements npm run compile
139148

140149
create_timepoint:
141150
target=data_release npm run compile
142151

143-
data_release:
144-
msgfmt -o modules/data_release/locale/hi/LC_MESSAGES/data_release.mo modules/data_release/locale/hi/LC_MESSAGES/data_release.po
152+
data_release: modules/data_release/locale/hi/LC_MESSAGES/data_release.mo modules/data_release/locale/ja/LC_MESSAGES/data_release.mo
145153
npx i18next-conv -l hi -s modules/data_release/locale/hi/LC_MESSAGES/data_release.po -t modules/data_release/locale/hi/LC_MESSAGES/data_release.json
146-
msgfmt -o modules/data_release/locale/ja/LC_MESSAGES/data_release.mo modules/data_release/locale/ja/LC_MESSAGES/data_release.po
147154
npx i18next-conv -l ja -s modules/data_release/locale/ja/LC_MESSAGES/data_release.po -t modules/data_release/locale/ja/LC_MESSAGES/data_release.json
148155
target=data_release npm run compile
149156

150-
instrument_manager:
157+
instrument_manager: modules/instrument_manager/locale/ja/LC_MESSAGES/instrument_manager.mo
151158
target=instrument_manager npm run compile
152159

153-
dataquery:
160+
dataquery: modules/dataquery/locale/ja/LC_MESSAGES/dataquery.mo
154161
msgfmt -o modules/dataquery/locale/ja/LC_MESSAGES/dataquery.mo modules/dataquery/locale/ja/LC_MESSAGES/dataquery.po
155162
target=dataquery npm run compile
156163

157-
login:
164+
login: modules/login/locale/ja/LC_MESSAGES/login.mo
158165
target=login npm run compile
159166

160-
module_manager:
167+
module_manager: modules/module_manager/locale/ja/LC_MESSAGES/module_manager.mo
161168
target=module_manager npm run compile
162169

163-
mri_violations:
170+
mri_violations: modules/mri_violations/locale/ja/LC_MESSAGES/mri_violations.mo
164171
target=mri_violations npm run compile
165172

166-
issue_tracker:
173+
issue_tracker: modules/issue_tracker/locale/ja/LC_MESSAGES/issue_tracker.mo
167174
target=issue_tracker npm run compile
168175

169-
candidate_list:
170-
msgfmt -o modules/candidate_list/locale/ja/LC_MESSAGES/candidate_list.mo modules/candidate_list/locale/ja/LC_MESSAGES/candidate_list.po
176+
candidate_list: modules/candidate_list/locale/ja/LC_MESSAGES/candidate_list.mo modules/candidate_list/locale/hi/LC_MESSAGES/candidate_list.mo
171177
npx i18next-conv -l ja -s modules/candidate_list/locale/ja/LC_MESSAGES/candidate_list.po -t modules/candidate_list/locale/ja/LC_MESSAGES/candidate_list.json
172-
msgfmt -o modules/candidate_list/locale/hi/LC_MESSAGES/candidate_list.mo modules/candidate_list/locale/hi/LC_MESSAGES/candidate_list.po
173178
npx i18next-conv -l hi -s modules/candidate_list/locale/hi/LC_MESSAGES/candidate_list.po -t modules/candidate_list/locale/hi/LC_MESSAGES/candidate_list.json
174179
target=candidate_list npm run compile
175180

176-
candidate_parameters:
181+
candidate_parameters: modules/candidate_parameters/locale/ja/LC_MESSAGES/candidate_parameters.mo
177182
target=candidate_parameters npm run compile
178183

179-
dashboard:
184+
dashboard: modules/dashboard/locale/ja/LC_MESSAGES/dashboard.mo
180185
target=dashboard npm run compile
181186

182-
publication:
187+
publication: modules/publication/locale/ja/LC_MESSAGES/publication.mo
183188
target=publication npm run compile
184189

185-
server_processes_manager:
190+
server_processes_manager: modules/server_processes_manager/locale/ja/LC_MESSAGES/server_processes_manager.mo
186191
target=server_processes_manager npm run compile
187192

188193
conflict_resolver:

SQL/0000-00-03-ConfigTables.sql

Lines changed: 12 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -12,10 +12,21 @@ CREATE TABLE `ConfigSettings` (
1212
`Parent` int(11) DEFAULT NULL,
1313
`Label` varchar(255) DEFAULT NULL,
1414
`OrderNumber` int(11) DEFAULT NULL,
15+
`Multilingual` boolean DEFAULT false,
1516
PRIMARY KEY (`ID`),
1617
UNIQUE KEY `Name` (`Name`)
1718
) ENGINE=InnoDB DEFAULT CHARSET=utf8;
1819

20+
CREATE TABLE `ConfigI18n` (
21+
`Value` text NOT NULL,
22+
`ConfigID` int(11) DEFAULT NULL,
23+
`LanguageID` int(10) unsigned DEFAULT NULL,
24+
KEY `ConfigID` (`ConfigID`),
25+
KEY `LanguageID` (`LanguageID`),
26+
CONSTRAINT `ConfigI18n_ibfk_1` FOREIGN KEY (`ConfigID`) REFERENCES `ConfigSettings` (`ID`),
27+
CONSTRAINT `ConfigI18n_ibfk_2` FOREIGN KEY (`LanguageID`) REFERENCES `language` (`language_id`)
28+
) ENGINE=InnoDB DEFAULT CHARSET=utf8mb4 COLLATE=utf8mb4_unicode_ci;
29+
1930

2031
CREATE TABLE `Config` (
2132
`ID` int(11) NOT NULL AUTO_INCREMENT,
@@ -88,7 +99,7 @@ INSERT INTO ConfigSettings (Name, Description, Visible, AllowMultiple, DataType,
8899

89100

90101
INSERT INTO ConfigSettings (Name, Description, Visible, AllowMultiple, Label, OrderNumber) VALUES ('dashboard', 'Settings that affect the appearance of the dashboard and its charts', 1, 0, 'Dashboard', 5);
91-
INSERT INTO ConfigSettings (Name, Description, Visible, AllowMultiple, DataType, Parent, Label, OrderNumber) SELECT 'projectDescription', 'Description of the study displayed in main dashboard panel', 1, 0, 'textarea', ID, 'Project Description', 1 FROM ConfigSettings WHERE Name="dashboard";
102+
INSERT INTO ConfigSettings (Name, Description, Visible, AllowMultiple, DataType, Parent, Label, OrderNumber, Multilingual) SELECT 'projectDescription', 'Description of the study displayed in main dashboard panel', 1, 0, 'textarea', ID, 'Project Description', 1, true FROM ConfigSettings WHERE Name="dashboard";
92103
INSERT INTO ConfigSettings (Name, Description, Visible, AllowMultiple, DataType, Parent, Label, OrderNumber) SELECT 'recruitmentTarget', 'Target number of participants for the study', 1, 0, 'text', ID, 'Target number of participants', 2 FROM ConfigSettings WHERE Name="dashboard";
93104

94105
INSERT INTO ConfigSettings (Name, Description, Visible, AllowMultiple, Label, OrderNumber) VALUES ('imaging_modules', 'DICOM Archive and Imaging Browser settings', 1, 0, 'Imaging Modules', 6);
Lines changed: 16 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,16 @@
1+
ALTER table ConfigSettings ADD COLUMN Multilingual boolean DEFAULT false;
2+
UPDATE ConfigSettings SET Multilingual=true WHERE Name='projectDescription';
3+
4+
CREATE TABLE `ConfigI18n` (
5+
`Value` text NOT NULL,
6+
`ConfigID` int(11) DEFAULT NULL,
7+
`LanguageID` int(10) unsigned DEFAULT NULL,
8+
KEY `ConfigID` (`ConfigID`),
9+
KEY `LanguageID` (`LanguageID`),
10+
CONSTRAINT `ConfigI18n_ibfk_1` FOREIGN KEY (`ConfigID`) REFERENCES `ConfigSettings` (`ID`),
11+
CONSTRAINT `ConfigI18n_ibfk_2` FOREIGN KEY (`LanguageID`) REFERENCES `language` (`language_id`)
12+
) ENGINE=InnoDB DEFAULT CHARSET=utf8mb4 COLLATE=utf8mb4_unicode_ci;
13+
14+
-- Sample translation of projectDescription for testing. We do not have a
15+
-- foreign key value in the 'language' table to add it to RB.
16+
-- INSERT INTO ConfigI18n VALUES ('このデータベースは、様々な場所で収集された画像データと行動データの両方をオンラインで保存するための仕組みを提供します。このフレームワークには、このプロセスを可能な限り効率的かつシンプルにするためのツールがいくつか用意されています。データベースに関する詳細な情報については、右上のヘルプアイコンをクリックしてください。それ以外の場合は、DCCまでお気軽にお問い合わせください。私たちは、データ収集を楽しいものにすることを目指しています。', 48, 2)
Lines changed: 131 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,131 @@
1+
# Translating LORIS
2+
3+
## Overview
4+
5+
Helping with translating LORIS into a language that you speak is
6+
an easy way to help LORIS without touching any code.
7+
8+
If you're using a language that is already translated and a translation
9+
appears wrong, the first thing you can do is [open a bug report.](https://github.com/aces/Loris/issues/new?template=bug_report.md). Try and include
10+
the page, incorrect words, and correct phrasing (and/or dialect if applicable)
11+
in your bug report.
12+
13+
Otherwise, you most likely want to help with one of two tasks:
14+
- Adding a new language to LORIS
15+
- Adding translations for an existing language to a module in LORIS.
16+
17+
The steps for each are similar.
18+
19+
## Architecture
20+
21+
Translatable strings used by LORIS are stored in `.po` (portable object)
22+
files which is the standard used by `gettext` library. These are compiled
23+
into both the `json` files used by the javascript frontend, and the `mo` files
24+
used by the PHP backend, so that the same translations are used throughout
25+
LORIS.
26+
27+
(For advanced usage of the format in languages that include multiple forms of
28+
plural an internet search is likely to provide better guidance than this
29+
documentation, which is aimed at contributing to LORIS.)
30+
31+
Each translatable module in LORIS has a `locale` subdirectory for strings that
32+
are specific to that module (ie. `modules/candidate_list/locale` for the
33+
`candidate_list`) while LORIS has a `locale` directory on the top level
34+
for terms that are used throughout LORIS.
35+
36+
Within the locale directories, there is a `.pot` (".po template") file with
37+
the same name as the module (or "loris.pot" for the core terms). The `.pot`
38+
is a template with translateable strings for a new language.
39+
40+
Both `po` and `pot` files have similar structures and can be either be edited
41+
by hand or with any translation software which supports the format.
42+
43+
Inside the locale directory, there is a subdirectory for each supported language.
44+
The language directory has an `LC_MESSAGES` subdirectory which has the `.po` file
45+
with the translated strings for that language. (This directory structure is imposed
46+
by gettext and not specific to LORIS.)
47+
48+
The primary difference between adding a new language or adding translations for
49+
an existing language is whether the language subdirectory already exists.
50+
51+
## Example
52+
53+
Suppose you wanted to translate LORIS to a fictional language which is exactly
54+
the same as English but every word starts with "L". This fictional language has
55+
the language code of "lo".
56+
57+
The first thing step is to create the `locale/lo/LC_MESSAGES` directory and
58+
copy the `locale/loris.pot` template to `locale/lo/LC_MESSAGES/loris.po`.
59+
60+
Within the file, near the top of the there is a block of metadata for the file
61+
which looks something like:
62+
63+
```
64+
"Project-Id-Version: LORIS 27\n"
65+
"Report-Msgid-Bugs-To: https://github.com/aces/Loris/issues\n"
66+
"POT-Creation-Date: 2025-04-08 14:37-0400\n"
67+
"PO-Revision-Date: YEAR-MO-DA HO:MI+ZONE\n"
68+
"Last-Translator: FULL NAME <EMAIL@ADDRESS>\n"
69+
"Language-Team: LANGUAGE <LL@li.org>\n"
70+
"Language: \n"
71+
"MIME-Version: 1.0\n"
72+
"Content-Type: text/plain; charset=UTF-8\n"
73+
"Content-Transfer-Encoding: 8bit\n"
74+
```
75+
76+
You can edit it as appropriate, but the most important part (from a technical
77+
perspective) is that the "Language" line needs to be updated to match your
78+
language's language code, in this example it would be changed to read:
79+
80+
```
81+
"Language: lo\n"
82+
```
83+
84+
(This step may already be done if you're updating an existing language.)
85+
86+
Next, comes inserting the translations themselves.
87+
88+
The template you copied you copied should have a series of msgid/msgstr lines such
89+
as the following:
90+
91+
```
92+
msgid "LORIS"
93+
msgstr ""
94+
95+
msgid "DEV"
96+
msgstr ""
97+
98+
msgid "Affiliations"
99+
msgstr ""
100+
```
101+
102+
msgid is generally the English string, and msgstr should be updated with the
103+
translation. In our fictional language, this would become:
104+
105+
```
106+
msgid "LORIS"
107+
msgstr "LORIS"
108+
109+
msgid "DEV"
110+
msgstr "LDEV"
111+
112+
msgid "Affiliations"
113+
msgstr "Laffiliations"
114+
```
115+
116+
Congratulations, you've translated LORIS into the fictional `lo` language!
117+
118+
You can repeat this process for any module within the module's `locale`
119+
directory.
120+
121+
## Send Pull Request
122+
123+
The last step is to send a pull request to LORIS so that your translation
124+
can be included in the next release. Due to the size of LORIS, it's best to translate one module at a time and send one pull request per module.
125+
126+
If you're not familiar with git or GitHub you can review [GitHub's](https://docs.github.com/en/pull-requests/collaborating-with-pull-requests/proposing-changes-to-your-work-with-pull-requests/creating-a-pull-request) provides documentation on how
127+
to send a pull request.
128+
129+
If you still not sure how to send a pull request, including the `po` file
130+
that you've created in a GitHub issue, a developer may be able to help you
131+
or create it for you.

jsx/I18nSetup.js

Lines changed: 4 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -4,6 +4,7 @@ import {initReactI18next} from 'react-i18next';
44
import jaResources from '../locale/ja/LC_MESSAGES/loris.json';
55
import hiResources from '../locale/hi/LC_MESSAGES/loris.json';
66
import esResources from '../locale/es/LC_MESSAGES/loris.json';
7+
import enResources from '../locale/en/LC_MESSAGES/loris.json';
78

89
const resources = {
910
ja: {
@@ -15,6 +16,9 @@ const resources = {
1516
es: {
1617
loris: esResources,
1718
},
19+
en: {
20+
loris: enResources,
21+
},
1822
};
1923

2024
i18n

0 commit comments

Comments
 (0)