🐛 Fix Japanese autodetection fallback on "ja" locale (#12283)

Most browsers return "ja" rather than "ja-JP" in navigator.language.
Because parse-locale expands "ja-JP" to ["ja_jp" "ja"] but keeps "ja"
as ["ja"], using "ja_jp" causes autodetection to fall back to English.

Normalize the Japanese locale identifier to "ja" and map jpn_JP.po to
translation.ja.js, matching other single-region locales like Ukrainian.

AI-assisted-by: gemini-3.8-flash
This commit is contained in:
GennoBou 2026-11-04 00:11:22 +09:00 committed by GitHub
parent b19ad65581
commit 029d9c0af7
No known key found for this signature in database
GPG Key ID: B5690EEEBB952194
2 changed files with 2 additions and 2 deletions

View File

@ -328,7 +328,7 @@ export async function compileTranslations() {
"nl",
// this happens when file does not matches correct
// iso code for the language.
["ja_jp", "jpn_JP"],
["ja", "jpn_JP"],
["uk", "ukr_UA"],
"ha",
];

View File

@ -55,7 +55,7 @@
{:label "आधुनिक मानक हिन्दी (community)" :value "hi"}
{:label "عربي/عربى (community)" :value "ar"}
{:label "فارسی (community)" :value "fa"}
{:label "日本語 (Community)" :value "ja_jp"}
{:label "日本語 (Community)" :value "ja"}
{:label "简体中文 (community)" :value "zh_cn"}
{:label "繁體中文 (community)" :value "zh_hant"}])