refactor: polish jp translation

This commit is contained in:
Tristan Yang
2022-12-02 12:03:30 +08:00
parent d85d9ca85c
commit 0210df6a96
6 changed files with 10 additions and 7 deletions
+2 -1
View File
@@ -56,7 +56,8 @@
"title": "Language",
"desc": "Setting the language",
"en": "English",
"zh": "中文"
"zh": "中文",
"jp": "Japanese"
}
},
"license": {
+1 -1
View File
@@ -57,7 +57,7 @@
"desc": "言語の設定",
"en": "英語",
"zh": "中国語",
"ja": "日本語"
"jp": "日本語"
}
},
"license": {
+2 -1
View File
@@ -57,7 +57,8 @@
"title": "语言",
"desc": "设置界面语言",
"en": "英文",
"zh": "中文"
"zh": "中文",
"jp": "日文"
}
},
"license": {
+1
View File
@@ -1,5 +1,6 @@
import dayjs from "dayjs";
import "dayjs/locale/zh-cn";
import "dayjs/locale/ja";
import relativeTime from "dayjs/plugin/relativeTime";
import isToday from "dayjs/plugin/isToday";
import isYesterday from "dayjs/plugin/isYesterday";
+2 -2
View File
@@ -32,7 +32,7 @@ export const resources = {
} as const;
i18n.on("languageChanged", (lng) => {
console.log("changed", lng);
dayjs.locale(lng === 'zh' ? "zh-cn" : lng);
dayjs.locale(lng === 'zh' ? "zh-cn" : lng === 'jp' ? "ja" : lng);
});
i18n
// load translation using http -> see /public/locales (i.e. https://github.com/i18next/react-i18next/tree/master/example/react/public/locales)
@@ -50,7 +50,7 @@ i18n
ns: ["common", "chat", "member", "setting", "fav", "file", "welcome", "auth"],
defaultNS,
load: "languageOnly",
// lng: "zh",
// lng: "jp",
fallbackLng: 'en',
fallbackNS: "common",
debug: false,
+2 -2
View File
@@ -18,8 +18,8 @@ const Index = () => {
</span>
</p>
<StyledRadio
options={[t("overview.lang.en"), t("overview.lang.zh")]}
values={["en", "zh"]}
options={[t("overview.lang.en"), t("overview.lang.zh"), t("overview.lang.jp")]}
values={["en", "zh", "jp"]}
value={i18n.language.split("-")[0]}
onChange={(v) => {
console.log("wtff", v);