Skip to content

[i18n] Add support for 日本語 #9747

New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Open
wants to merge 1 commit into
base: main
Choose a base branch
from
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
3 changes: 2 additions & 1 deletion .gitignore
Original file line number Diff line number Diff line change
Expand Up @@ -34,4 +34,5 @@ SQL/Archive/autogenerated/*.sql
VERSION
.DS_Store
.eslintcache
tools/logs
tools/logs
*.mo
2 changes: 1 addition & 1 deletion Dockerfile.test.php8
Original file line number Diff line number Diff line change
Expand Up @@ -5,7 +5,7 @@ RUN apt-get update && \
apt-get install -y mariadb-client libzip-dev

# Install PHP extensions
RUN docker-php-ext-install pdo_mysql zip
RUN docker-php-ext-install pdo_mysql zip gettext

# Ensure the logs directory exists
RUN mkdir -p /app/logs
Expand Down
55 changes: 54 additions & 1 deletion Makefile
Original file line number Diff line number Diff line change
Expand Up @@ -32,6 +32,7 @@ clean:
rm -rf vendor
rm -rf node_modules
rm -rf modules/electrophysiology_browser/jsx/react-series-data-viewer/node_modules
rm -f modules/*/locale/*/LC_MESSAGES/*.mo

# Perform static analysis checks
checkstatic: phpdev
Expand All @@ -56,7 +57,59 @@ check: checkstatic unittests
testdata:
php tools/raisinbread_refresh.php

data_release:
locales:
msgfmt -o locale/ja/LC_MESSAGES/loris.mo locale/ja/LC_MESSAGES/loris.po
msgfmt -o modules/new_profile/locale/ja/LC_MESSAGES/new_profile.mo modules/new_profile/locale/ja/LC_MESSAGES/new_profile.po
msgfmt -o modules/acknowledgements/locale/ja/LC_MESSAGES/acknowledgements.mo modules/acknowledgements/locale/ja/LC_MESSAGES/acknowledgements.po
msgfmt -o modules/api_docs/locale/ja/LC_MESSAGES/api_docs.mo modules/api_docs/locale/ja/LC_MESSAGES/api_docs.po
msgfmt -o modules/battery_manager/locale/ja/LC_MESSAGES/battery_manager.mo modules/battery_manager/locale/ja/LC_MESSAGES/battery_manager.po
msgfmt -o modules/behavioural_qc/locale/ja/LC_MESSAGES/behavioural_qc.mo modules/behavioural_qc/locale/ja/LC_MESSAGES/behavioural_qc.po
msgfmt -o modules/brainbrowser/locale/ja/LC_MESSAGES/brainbrowser.mo modules/brainbrowser/locale/ja/LC_MESSAGES/brainbrowser.po
msgfmt -o modules/bvl_feedback/locale/ja/LC_MESSAGES/bvl_feedback.mo modules/bvl_feedback/locale/ja/LC_MESSAGES/bvl_feedback.po
msgfmt -o modules/candidate_list/locale/ja/LC_MESSAGES/candidate_list.mo modules/candidate_list/locale/ja/LC_MESSAGES/candidate_list.po
msgfmt -o modules/candidate_parameters/locale/ja/LC_MESSAGES/candidate_parameters.mo modules/candidate_parameters/locale/ja/LC_MESSAGES/candidate_parameters.po
msgfmt -o modules/candidate_profile/locale/ja/LC_MESSAGES/candidate_profile.mo modules/candidate_profile/locale/ja/LC_MESSAGES/candidate_profile.po
msgfmt -o modules/configuration/locale/ja/LC_MESSAGES/configuration.mo modules/configuration/locale/ja/LC_MESSAGES/configuration.po
msgfmt -o modules/configuration/locale/ja/LC_MESSAGES/configuration.mo modules/configuration/locale/ja/LC_MESSAGES/configuration.po
msgfmt -o modules/conflict_resolver/locale/ja/LC_MESSAGES/conflict_resolver.mo modules/conflict_resolver/locale/ja/LC_MESSAGES/conflict_resolver.po
msgfmt -o modules/create_timepoint/locale/ja/LC_MESSAGES/create_timepoint.mo modules/create_timepoint/locale/ja/LC_MESSAGES/create_timepoint.po
msgfmt -o modules/dashboard/locale/ja/LC_MESSAGES/dashboard.mo modules/dashboard/locale/ja/LC_MESSAGES/dashboard.po
msgfmt -o modules/datadict/locale/ja/LC_MESSAGES/datadict.mo modules/datadict/locale/ja/LC_MESSAGES/datadict.po
msgfmt -o modules/dataquery/locale/ja/LC_MESSAGES/dataquery.mo modules/dataquery/locale/ja/LC_MESSAGES/dataquery.po
msgfmt -o modules/data_release/locale/ja/LC_MESSAGES/data_release.mo modules/data_release/locale/ja/LC_MESSAGES/data_release.po
msgfmt -o modules/dicom_archive/locale/ja/LC_MESSAGES/dicom_archive.mo modules/dicom_archive/locale/ja/LC_MESSAGES/dicom_archive.po
msgfmt -o modules/dictionary/locale/ja/LC_MESSAGES/dictionary.mo modules/dictionary/locale/ja/LC_MESSAGES/dictionary.po
msgfmt -o modules/document_repository/locale/ja/LC_MESSAGES/document_repository.mo modules/document_repository/locale/ja/LC_MESSAGES/document_repository.po
msgfmt -o modules/dqt/locale/ja/LC_MESSAGES/dqt.mo modules/dqt/locale/ja/LC_MESSAGES/dqt.po
msgfmt -o modules/electrophysiology_browser/locale/ja/LC_MESSAGES/electrophysiology_browser.mo modules/electrophysiology_browser/locale/ja/LC_MESSAGES/electrophysiology_browser.po
msgfmt -o modules/electrophysiology_uploader/locale/ja/LC_MESSAGES/electrophysiology_uploader.mo modules/electrophysiology_uploader/locale/ja/LC_MESSAGES/electrophysiology_uploader.po
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/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
msgfmt -o modules/instrument_builder/locale/ja/LC_MESSAGES/instrument_builder.mo modules/instrument_builder/locale/ja/LC_MESSAGES/instrument_builder.po
msgfmt -o modules/instrument_list/locale/ja/LC_MESSAGES/instrument_list.mo modules/instrument_list/locale/ja/LC_MESSAGES/instrument_list.po
msgfmt -o modules/instrument_manager/locale/ja/LC_MESSAGES/instrument_manager.mo modules/instrument_manager/locale/ja/LC_MESSAGES/instrument_manager.po
msgfmt -o modules/instruments/locale/ja/LC_MESSAGES/instruments.mo modules/instruments/locale/ja/LC_MESSAGES/instruments.po
msgfmt -o modules/issue_tracker/locale/ja/LC_MESSAGES/issue_tracker.mo modules/issue_tracker/locale/ja/LC_MESSAGES/issue_tracker.po
msgfmt -o modules/login/locale/ja/LC_MESSAGES/login.mo modules/login/locale/ja/LC_MESSAGES/login.po
msgfmt -o modules/media/locale/ja/LC_MESSAGES/media.mo modules/media/locale/ja/LC_MESSAGES/media.po
msgfmt -o modules/module_manager/locale/ja/LC_MESSAGES/module_manager.mo modules/module_manager/locale/ja/LC_MESSAGES/module_manager.po
msgfmt -o modules/mri_violations/locale/ja/LC_MESSAGES/mri_violations.mo modules/mri_violations/locale/ja/LC_MESSAGES/mri_violations.po
msgfmt -o modules/next_stage/locale/ja/LC_MESSAGES/next_stage.mo modules/next_stage/locale/ja/LC_MESSAGES/next_stage.po
msgfmt -o modules/oidc/locale/ja/LC_MESSAGES/oidc.mo modules/oidc/locale/ja/LC_MESSAGES/oidc.po
msgfmt -o modules/publication/locale/ja/LC_MESSAGES/publication.mo modules/publication/locale/ja/LC_MESSAGES/publication.po
msgfmt -o modules/schedule_module/locale/ja/LC_MESSAGES/schedule_module.mo modules/schedule_module/locale/ja/LC_MESSAGES/schedule_module.po
msgfmt -o modules/server_processes_manager/locale/ja/LC_MESSAGES/server_processes_manager.mo modules/server_processes_manager/locale/ja/LC_MESSAGES/server_processes_manager.po
msgfmt -o modules/statistics/locale/ja/LC_MESSAGES/statistics.mo modules/statistics/locale/ja/LC_MESSAGES/statistics.po
msgfmt -o modules/survey_accounts/locale/ja/LC_MESSAGES/survey_accounts.mo modules/survey_accounts/locale/ja/LC_MESSAGES/survey_accounts.po
msgfmt -o modules/timepoint_list/locale/ja/LC_MESSAGES/timepoint_list.mo modules/timepoint_list/locale/ja/LC_MESSAGES/timepoint_list.po
msgfmt -o modules/user_accounts/locale/ja/LC_MESSAGES/user_accounts.mo modules/user_accounts/locale/ja/LC_MESSAGES/user_accounts.po


data_release:
target=data_release npm run compile

instrument_manager:
Expand Down
8 changes: 6 additions & 2 deletions htdocs/index.php
Original file line number Diff line number Diff line change
Expand Up @@ -30,6 +30,10 @@
// See: https://www.php.net/manual/en/session.configuration.php#ini.session.use-strict-mode
ini_set('session.use_strict_mode', '1');

bind_textdomain_codeset("loris", 'UTF-8');
bindtextdomain("loris", __DIR__ . '/../locale');
textdomain("loris");

// FIXME: The code in NDB_Client should mostly be replaced by middleware.
$client = new \NDB_Client;
$client->initialize();
Expand All @@ -38,7 +42,8 @@
// Middleware that happens on every request. This doesn't include
// any authentication middleware, because that's done dynamically
// based on the module router, depending on if the module is public.
$middlewarechain = (new \LORIS\Middleware\ContentLength())
$middlewarechain = (new \LORIS\Middleware\Language())
->withMiddleware(new \LORIS\Middleware\ContentLength())
->withMiddleware(new \LORIS\Middleware\AWS())
->withMiddleware(new \LORIS\Middleware\ResponseGenerator());

Expand Down Expand Up @@ -82,7 +87,6 @@
->withAttribute("loris", $lorisInstance);

// Now handle the request.
//
$response = $middlewarechain->process($serverrequest, $entrypoint);

// Add the HTTP header line.
Expand Down
118 changes: 118 additions & 0 deletions locale/ja/LC_MESSAGES/loris.po
Original file line number Diff line number Diff line change
@@ -0,0 +1,118 @@
# 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: ja\n"
"MIME-Version: 1.0\n"
"Content-Type: text/plain; charset=UTF-8\n"
"Content-Transfer-Encoding: 8bit\n"

# Smarty template main.tpl strings
msgid "LORIS"
msgstr "ロリス"

msgid "DEV"
msgstr "開発環境"

msgid "Affiliations"
msgstr "所属"

msgid "Site Affiliation"
msgstr "サイトの所属"

msgid "Site Affiliations"
msgstr "サイトの所属"

msgid "Project Affiliation"
msgstr "プロジェクトの所属"

msgid "Project Affiliations"
msgstr "プロジェクトの所属"

msgid "Log Out"
msgstr "ログアウト"

msgid "My Preferences"
msgstr "私の好み"

# Auto extracted strings from PHP
# Menu categories
#: modules/configuration/php/module.class.inc:50
#: modules/help_editor/php/module.class.inc:47
#: modules/instrument_manager/php/module.class.inc:53
#: modules/module_manager/php/module.class.inc:50
#: modules/server_processes_manager/php/module.class.inc:104
#: modules/survey_accounts/php/module.class.inc:48
#: modules/user_accounts/php/module.class.inc:53
msgid "Admin"
msgstr "行政上の"
#: modules/acknowledgements/php/module.class.inc:54
#: modules/api_docs/php/module.class.inc:66
#: modules/battery_manager/php/module.class.inc:55
#: modules/datadict/php/module.class.inc:49
#: modules/data_release/php/module.class.inc:56
#: modules/dictionary/php/module.class.inc:49
#: modules/document_repository/php/module.class.inc:56
#: modules/instrument_builder/php/module.class.inc:48
#: modules/issue_tracker/php/module.class.inc:54
#: modules/schedule_module/php/module.class.inc:49
msgid "Tools"
msgstr "ツール"

#: modules/behavioural_qc/php/module.class.inc:51
#: modules/conflict_resolver/php/module.class.inc:83
#: modules/examiner/php/module.class.inc:50
#: modules/media/php/module.class.inc:33
msgid "Clinical"
msgstr "臨床的"

#: modules/dicom_archive/php/module.class.inc:115
#: modules/imaging_browser/php/module.class.inc:40
#: modules/imaging_qc/php/module.class.inc:50
#: modules/imaging_uploader/php/module.class.inc:54
#: modules/mri_violations/php/module.class.inc:53
msgid "Imaging"
msgstr "イメージング"

#: modules/candidate_list/php/module.class.inc:76
#: modules/new_profile/php/module.class.inc:50
msgid "Candidate"
msgstr "為り手"

#: modules/genomic_browser/php/module.class.inc:53
msgid "Genomics"
msgstr "ゲノミクス"

#: modules/electrophysiology_browser/php/module.class.inc:54
msgid "Electrophysiology"
msgstr "電気生理学"

#: modules/dataquery/php/module.class.inc:33
#: modules/dqt/php/module.class.inc:49
#: modules/publication/php/module.class.inc:55
#: modules/statistics/php/module.class.inc:49
msgid "Reports"
msgstr "レポート"

# Common loris terms. Consider moving these to their own textdomain?
msgid "TimePoint"
msgstr "タイムポイント"

# Common select option labels
msgid "Yes"
msgstr "はい"

msgid "No"
msgstr "いいえ"

118 changes: 118 additions & 0 deletions locale/loris.pot
Original file line number Diff line number Diff line change
@@ -0,0 +1,118 @@
# 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: \n"
"MIME-Version: 1.0\n"
"Content-Type: text/plain; charset=UTF-8\n"
"Content-Transfer-Encoding: 8bit\n"

# Smarty template main.tpl strings
msgid "LORIS"
msgstr ""

msgid "DEV"
msgstr ""

msgid "Affiliations"
msgstr ""

msgid "Site Affiliation"
msgstr ""

msgid "Site Affiliations"
msgstr ""

msgid "Project Affiliation"
msgstr ""

msgid "Project Affiliations"
msgstr ""

msgid "Log Out"
msgstr ""

msgid "My Preferences"
msgstr ""

# Auto extracted strings from PHP
# Menu categories
#: modules/configuration/php/module.class.inc:50
#: modules/help_editor/php/module.class.inc:47
#: modules/instrument_manager/php/module.class.inc:53
#: modules/module_manager/php/module.class.inc:50
#: modules/server_processes_manager/php/module.class.inc:104
#: modules/survey_accounts/php/module.class.inc:48
#: modules/user_accounts/php/module.class.inc:53
msgid "Admin"
msgstr ""
#: modules/acknowledgements/php/module.class.inc:54
#: modules/api_docs/php/module.class.inc:66
#: modules/battery_manager/php/module.class.inc:55
#: modules/datadict/php/module.class.inc:49
#: modules/data_release/php/module.class.inc:56
#: modules/dictionary/php/module.class.inc:49
#: modules/document_repository/php/module.class.inc:56
#: modules/instrument_builder/php/module.class.inc:48
#: modules/issue_tracker/php/module.class.inc:54
#: modules/schedule_module/php/module.class.inc:49
msgid "Tools"
msgstr ""

#: modules/behavioural_qc/php/module.class.inc:51
#: modules/conflict_resolver/php/module.class.inc:83
#: modules/examiner/php/module.class.inc:50
#: modules/media/php/module.class.inc:33
msgid "Clinical"
msgstr ""

#: modules/dicom_archive/php/module.class.inc:115
#: modules/imaging_browser/php/module.class.inc:40
#: modules/imaging_qc/php/module.class.inc:50
#: modules/imaging_uploader/php/module.class.inc:54
#: modules/mri_violations/php/module.class.inc:53
msgid "Imaging"
msgstr ""

#: modules/candidate_list/php/module.class.inc:76
#: modules/new_profile/php/module.class.inc:50
msgid "Candidate"
msgstr ""

#: modules/genomic_browser/php/module.class.inc:53
msgid "Genomics"
msgstr ""

#: modules/electrophysiology_browser/php/module.class.inc:54
msgid "Electrophysiology"
msgstr ""

#: modules/dataquery/php/module.class.inc:33
#: modules/dqt/php/module.class.inc:49
#: modules/publication/php/module.class.inc:55
#: modules/statistics/php/module.class.inc:49
msgid "Reports"
msgstr ""

# Common loris terms. Consider moving these to their own textdomain?
msgid "TimePoint"
msgstr ""

# Common select option labels
msgid "Yes"
msgstr ""

msgid "No"
msgstr ""

23 changes: 23 additions & 0 deletions modules/acknowledgements/locale/acknowledgements.pot
Original file line number Diff line number Diff line change
@@ -0,0 +1,23 @@
# 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: \n"
"MIME-Version: 1.0\n"
"Content-Type: text/plain; charset=UTF-8\n"
"Content-Transfer-Encoding: 8bit\n"

msgid "Acknowledgements"
msgstr ""

Loading
Loading