From c911357873fba4d57f46e6a86dab402861e54574 Mon Sep 17 00:00:00 2001 From: naskya Date: Wed, 13 Sep 2023 21:50:01 +0000 Subject: [PATCH] better locale merge fixes some problems including https://ddoskey.com/notes/9jikq12rmqfv27rh as usual, users may need to clear the browser cache --- locales/index.js | 20 ++++++-------------- 1 file changed, 6 insertions(+), 14 deletions(-) diff --git a/locales/index.js b/locales/index.js index a3cfbaf2b..1cee755fd 100644 --- a/locales/index.js +++ b/locales/index.js @@ -70,20 +70,12 @@ module.exports = Object.entries(locales).reduce( (a, [k, v]) => ( (a[k] = (() => { const [lang] = k.split("-"); - switch (k) { - case "en-US": - return v; - case "ja-JP": - case "ja-KS": - return merge(locales["en-US"], v); - default: - return merge( - locales["en-US"], - locales["ja-JP"], - locales[`${lang}-${primaries[lang]}`] || {}, - v, - ); - } + return k === "en-US" ? v : + merge( + locales["en-US"], + locales[`${lang}-${primaries[lang]}`] || {}, + v, + ); })()), a ),