Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Add Chinese translations #212

Open
wants to merge 8 commits into
base: main
Choose a base branch
from
Open
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
4 changes: 3 additions & 1 deletion electron/plugins/i18n.js
Original file line number Diff line number Diff line change
Expand Up @@ -11,6 +11,7 @@ import ja from './i18n/locales/ja.json' with { type: 'json' }
import ko from './i18n/locales/ko.json' with { type: 'json' }
import pl from './i18n/locales/pl.json' with { type: 'json' }
import ru from './i18n/locales/ru.json' with { type: 'json' }
import zh from './i18n/locales/zh.json' with { type: 'json' }

// i18n

Expand All @@ -30,7 +31,8 @@ const localesData = {
ja,
ko,
pl,
ru
ru,
zh
}

const options = {
Expand Down
13 changes: 13 additions & 0 deletions electron/plugins/i18n/locales/zh.json
Original file line number Diff line number Diff line change
@@ -0,0 +1,13 @@
{
"show": "显示",
"hide": "隐藏",
"about": "关于",
"quit": "退出",
"update": {
"message": "新版本已发布",
"buttons": {
"download": "下载",
"close": "关闭"
}
}
}
4 changes: 4 additions & 0 deletions src/helpers/data/locales.js
Original file line number Diff line number Diff line change
Expand Up @@ -45,5 +45,9 @@ export default [
{
id: 'ru',
name: 'Русский'
},
{
id: 'zh',
name: '中文'
}
]
1 change: 1 addition & 0 deletions src/plugins/dayjs.js
Original file line number Diff line number Diff line change
Expand Up @@ -14,6 +14,7 @@ import 'dayjs/locale/ja'
import 'dayjs/locale/ko'
import 'dayjs/locale/pl'
import 'dayjs/locale/ru'
import 'dayjs/locale/zh'

// i18n

Expand Down
14 changes: 13 additions & 1 deletion src/plugins/i18n.js
Original file line number Diff line number Diff line change
Expand Up @@ -12,6 +12,7 @@ import ja from './i18n/locales/ja.json'
import ko from './i18n/locales/ko.json'
import pl from './i18n/locales/pl.json'
import ru from './i18n/locales/ru.json'
import zh from './i18n/locales/zh.json'
import slavicPluralizationRule
from './i18n/rules/pluralization/slavic.js'

Expand All @@ -28,7 +29,8 @@ const localesData = {
ja,
ko,
pl,
ru
ru,
zh
}

const pluralizationRules = {
Expand Down Expand Up @@ -156,6 +158,16 @@ if (import.meta.hot) {
)
}
)

import.meta.hot.accept(
'./i18n/locales/zh.json',
fileImport => {
i18n.global.setLocaleMessage(
'zh',
fileImport.default
)
}
)
}

export default i18n
Loading