Add Japanese language support and translations

Co-authored-by: kz2870 <kz2870@users.noreply.github.com>
This commit is contained in:
Takahisa-Okawa
2025-11-05 22:25:15 +09:00
parent 4cb85f6480
commit 9de40f067b
13 changed files with 932 additions and 3 deletions

View File

@@ -1,15 +1,21 @@
import { createIntl, createIntlCache } from "react-intl";
import langEn from "./lang/en.json";
import langJa from "./lang/ja.json";
import langList from "./lang/lang-list.json";
// first item of each array should be the language code,
// not the country code
// Remember when adding to this list, also update check-locales.js script
const localeOptions = [["en", "en-US"]];
const localeOptions = [
["en", "en-US"],
["ja", "ja-JP"]
];
const loadMessages = (locale?: string): typeof langList & typeof langEn => {
const thisLocale = locale || "en";
switch (thisLocale.slice(0, 2)) {
case "ja":
return Object.assign({}, langList, langJa);
default:
return Object.assign({}, langList, langEn);
}
@@ -17,6 +23,9 @@ const loadMessages = (locale?: string): typeof langList & typeof langEn => {
const getFlagCodeForLocale = (locale?: string) => {
switch (locale) {
case "ja-JP":
case "ja":
return "JP";
default:
return "EN";
}