Skip to content

Commit 62c1095

Browse files
authored
Merge pull request #122 from maotoumao/dev
修改默认语言
2 parents 6fa80b0 + 4fa5707 commit 62c1095

File tree

2 files changed

+12
-3
lines changed

2 files changed

+12
-3
lines changed

res/lang/zh-CN.json

+1-1
Original file line numberDiff line numberDiff line change
@@ -282,7 +282,7 @@
282282
"play_lower_quality_version": "播放更低音质",
283283
"play_higher_quality_version": "播放更高音质",
284284
"when_play_error": "播放失败时",
285-
"pause": "暂停",
285+
"pause": "暂停播放",
286286
"skip_to_next": "自动播放下一首",
287287
"double_click_music_list": "双击音乐列表时",
288288
"add_music_to_playlist": "将目标单曲添加到播放队列",

src/shared/i18n/main.ts

+11-2
Original file line numberDiff line numberDiff line change
@@ -58,9 +58,18 @@ export async function setupI18n(options?: ISetupI18nOptions) {
5858
if (defaultLang && !allLangs.includes(defaultLang)) {
5959
defaultLang = undefined;
6060
}
61+
6162
if (!defaultLang) {
62-
defaultLang =
63-
app.getLocale() || allLangs.includes("en-US") ? "en-US" : allLangs[0];
63+
const appLocale = app.getLocale();
64+
if (allLangs.includes(appLocale)) {
65+
defaultLang = appLocale;
66+
} else if (appLocale.includes("zh") && allLangs.includes("zh-CN")) {
67+
defaultLang = "zh-CN";
68+
} else if (allLangs.includes("en-US")) {
69+
defaultLang = "en-US";
70+
} else {
71+
defaultLang = allLangs[0];
72+
}
6473
}
6574

6675
const langContent = await readLangContent(defaultLang);

0 commit comments

Comments
 (0)