Skip to content

Commit 252870c

Browse files
committed
feat: add chinese (simplified) support
1 parent b9b014a commit 252870c

File tree

38 files changed

+937
-41
lines changed

38 files changed

+937
-41
lines changed

src/components/language-notification.tsx

Lines changed: 16 additions & 7 deletions
Original file line numberDiff line numberDiff line change
@@ -23,9 +23,7 @@ import { changeDateLocale } from '../lib/dates'
2323
import { cn } from '../lib/utils'
2424

2525
export const LanguageNotification = memo(() => {
26-
const { i18n, t } = useTranslation(['settings'], {
27-
keyPrefix: 'app-settings.form.language.dialog',
28-
})
26+
const { i18n, t } = useTranslation(['settings', 'general'])
2927

3028
const [selected, setSelected] = useState<Language>()
3129

@@ -54,12 +52,18 @@ export const LanguageNotification = memo(() => {
5452
hideCloseButton
5553
>
5654
<DialogHeader>
57-
<DialogTitle className="text-center">{t('title')}</DialogTitle>
55+
<DialogTitle className="text-center">
56+
{t('app-settings.form.language.dialog.title')}
57+
</DialogTitle>
5858
</DialogHeader>
5959

6060
<ul className="border-l-8- list-disc pl-6 py-1 text-muted-foreground">
61-
<li className="">{t('notes.1')}</li>
62-
<li className="">{t('notes.2')}</li>
61+
<li className="">
62+
{t('app-settings.form.language.dialog.notes.1')}
63+
</li>
64+
<li className="">
65+
{t('app-settings.form.language.dialog.notes.2')}
66+
</li>
6367
</ul>
6468

6569
<RadioGroup
@@ -84,6 +88,11 @@ export const LanguageNotification = memo(() => {
8488
/>
8589
<Label htmlFor={`language-option-${language.id}`}>
8690
{language.title}
91+
{language.completed === false
92+
? ` ${t('under-translation', {
93+
ns: 'general',
94+
})}`
95+
: ''}
8796
</Label>
8897
</div>
8998
))}
@@ -94,7 +103,7 @@ export const LanguageNotification = memo(() => {
94103
onClick={handleConfirmSelection}
95104
disabled={!selected}
96105
>
97-
{t('submit-button')}
106+
{t('app-settings.form.language.dialog.submit-button')}
98107
</Button>
99108
</DialogContent>
100109
</Dialog>

src/config/constants/settings.ts

Lines changed: 6 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -4,6 +4,7 @@ export const defaultAppLanguage: Language = Language.English
44
export const availableLanguages: Array<{
55
id: Language
66
title: string
7+
completed?: boolean
78
}> = [
89
{
910
id: Language.English,
@@ -13,4 +14,9 @@ export const availableLanguages: Array<{
1314
id: Language.Spanish,
1415
title: 'Español',
1516
},
17+
{
18+
id: Language.Chinese,
19+
title: '简体中文',
20+
// completed: false,
21+
},
1622
]

src/lib/validations/schemas/settings.ts

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -13,7 +13,7 @@ import { Language } from '../../../locales/resources'
1313

1414
export const appLanguageSchema = z.object({
1515
i18n: z
16-
.enum([Language.English, Language.Spanish])
16+
.enum([Language.English, Language.Spanish, Language.Chinese])
1717
.default(Language.English),
1818
})
1919

Lines changed: 4 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,4 @@
1+
{
2+
"good-to-know": "Good To Know:",
3+
"link": "You can go to <2>https://www.epicgames.com/account/eula-history</2> and click the \"I Agree\" button at the bottom of the page:"
4+
}

src/locales/en-US/general.json

Lines changed: 7 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -7,7 +7,9 @@
77
"revert": "Revert",
88
"search": "Search",
99
"success": "Success",
10-
"update": "Update"
10+
"update": "Update",
11+
"accepted": "Accepted",
12+
"verify": "Verify"
1113
},
1214
"form": {
1315
"credentials": {
@@ -27,7 +29,7 @@
2729
"placeholder_private": "Search on your accounts",
2830
"search-empty": "No account found",
2931
"select": "Select account",
30-
"selected": "Account selected",
32+
"selected": "Selected account",
3133
"no-available": "No accounts available",
3234
"no-linked": "No linked accounts",
3335
"no-options": "No accounts",
@@ -125,7 +127,7 @@
125127
"error": "Couldn't generate screenshot, please try again later"
126128
}
127129
},
128-
"account-selected": "Account selected: <2>{{name}}</2>",
130+
"account-selected": "Selected account: <2>{{name}}</2>",
129131
"boosts": "Boost/s",
130132
"credits": "Credits",
131133
"current": "Current",
@@ -148,5 +150,6 @@
148150
"unknown": "Unknown",
149151
"update-information": "Update Information",
150152
"user-agent": "User Agent",
151-
"generate-screenshot": "Generate Screenshot"
153+
"generate-screenshot": "Generate Screenshot",
154+
"under-translation": "(Under Translation)"
152155
}
Lines changed: 4 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,4 @@
1+
{
2+
"good-to-know": "Bueno Saber:",
3+
"link": "Puedes ir a <2>https://www.epicgames.com/account/eula-history</2> y hacer clic en el botón \"Acepto\" ubicado al final de la página:"
4+
}

src/locales/es-419/general.json

Lines changed: 5 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -7,7 +7,9 @@
77
"revert": "Revertir",
88
"search": "Buscar",
99
"success": "Completado",
10-
"update": "Actualizar"
10+
"update": "Actualizar",
11+
"accepted": "Aceptado",
12+
"verify": "Verificar"
1113
},
1214
"form": {
1315
"credentials": {
@@ -148,5 +150,6 @@
148150
"unknown": "Desconocido",
149151
"update-information": "Actualizar Información",
150152
"user-agent": "Agente De Usuario",
151-
"generate-screenshot": "Generar Captura"
153+
"generate-screenshot": "Generar Captura",
154+
"under-translation": "(En Traducción)"
152155
}

src/locales/resources.ts

Lines changed: 73 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -18,6 +18,7 @@ import enUS_stwOperations_XPBoosts from './en-US/stw-operations/xpboosts.json'
1818
import enUS_stwOperations_Llamas from './en-US/stw-operations/llamas.json'
1919
import enUS_stwOperations_Unlock from './en-US/stw-operations/unlock.json'
2020
import enUS_accountManagement_VBucksInformation from './en-US/account-management/vbucks-information.json'
21+
import enUS_accountManagement_EULA from './en-US/account-management/eula.json'
2122
import enUS_accountManagement_RedeemCodes from './en-US/account-management/redeem-codes.json'
2223
import enUS_accountManagement_DevicesAuth from './en-US/account-management/devices-auth.json'
2324
import enUS_accountManagement_EpicSettings from './en-US/account-management/epic-settings.json'
@@ -51,6 +52,7 @@ const enUS = {
5152
'redeem-codes': enUS_accountManagement_RedeemCodes,
5253
'devices-auth': enUS_accountManagement_DevicesAuth,
5354
'epic-settings': enUS_accountManagement_EpicSettings,
55+
eula: enUS_accountManagement_EULA,
5456
},
5557
'advanced-mode': {
5658
'matchmaking-track': enUS_advancedMode_MatchmakingTrack,
@@ -83,6 +85,7 @@ import es419_stwOperations_XPBoosts from './es-419/stw-operations/xpboosts.json'
8385
import es419_stwOperations_Llamas from './es-419/stw-operations/llamas.json'
8486
import es419_stwOperations_Unlock from './es-419/stw-operations/unlock.json'
8587
import es419_accountManagement_VBucksInformation from './es-419/account-management/vbucks-information.json'
88+
import es419_accountManagement_EULA from './es-419/account-management/eula.json'
8689
import es419_accountManagement_RedeemCodes from './es-419/account-management/redeem-codes.json'
8790
import es419_accountManagement_DevicesAuth from './es-419/account-management/devices-auth.json'
8891
import es419_accountManagement_EpicSettings from './es-419/account-management/epic-settings.json'
@@ -116,6 +119,7 @@ const es419 = {
116119
'redeem-codes': es419_accountManagement_RedeemCodes,
117120
'devices-auth': es419_accountManagement_DevicesAuth,
118121
'epic-settings': es419_accountManagement_EpicSettings,
122+
eula: es419_accountManagement_EULA,
119123
},
120124
'advanced-mode': {
121125
'matchmaking-track': es419_advancedMode_MatchmakingTrack,
@@ -130,16 +134,85 @@ const es419 = {
130134
},
131135
}
132136

137+
/**
138+
* @file zh-CN
139+
*/
140+
import zhCN_sidebar from './zh-CN/sidebar.json'
141+
import zhCN_general from './zh-CN/general.json'
142+
import zhCN_history from './zh-CN/history.json'
143+
import zhCN_settings from './zh-CN/settings.json'
144+
import zhCN_alerts from './zh-CN/home.json'
145+
import zhCN_zones from './zh-CN/zones.json'
146+
import zhCN_stwOperations_AutoKick from './zh-CN/stw-operations/auto-kick.json'
147+
import zhCN_stwOperations_HomebaseName from './zh-CN/stw-operations/homebase-name.json'
148+
import zhCN_stwOperations_SaveQuests from './zh-CN/stw-operations/save-quests.json'
149+
import zhCN_stwOperations_Party from './zh-CN/stw-operations/party.json'
150+
import zhCN_stwOperations_Urns from './zh-CN/stw-operations/urns.json'
151+
import zhCN_stwOperations_XPBoosts from './zh-CN/stw-operations/xpboosts.json'
152+
import zhCN_stwOperations_Llamas from './zh-CN/stw-operations/llamas.json'
153+
import zhCN_stwOperations_Unlock from './zh-CN/stw-operations/unlock.json'
154+
import zhCN_accountManagement_VBucksInformation from './zh-CN/account-management/vbucks-information.json'
155+
import zhCN_accountManagement_EULA from './zh-CN/account-management/eula.json'
156+
import zhCN_accountManagement_RedeemCodes from './zh-CN/account-management/redeem-codes.json'
157+
import zhCN_accountManagement_DevicesAuth from './zh-CN/account-management/devices-auth.json'
158+
import zhCN_accountManagement_EpicSettings from './zh-CN/account-management/epic-settings.json'
159+
import zhCN_advancedMode_MatchmakingTrack from './zh-CN/advanced-mode/matchmaking-track.json'
160+
import zhCN_advancedMode_WorldInfo from './zh-CN/advanced-mode/world-info.json'
161+
import zhCN_myAccounts_General from './zh-CN/accounts/general.json'
162+
import zhCN_myAccounts_AuthCode from './zh-CN/accounts/auth-code.json'
163+
import zhCN_myAccounts_ExchangeCode from './zh-CN/accounts/exchange-code.json'
164+
import zhCN_myAccounts_DeviceAuth from './zh-CN/accounts/device-auth.json'
165+
import zhCN_myAccounts_RemoveAccount from './zh-CN/accounts/remove-account.json'
166+
167+
const zhCN = {
168+
sidebar: zhCN_sidebar,
169+
general: zhCN_general,
170+
history: zhCN_history,
171+
settings: zhCN_settings,
172+
alerts: zhCN_alerts,
173+
zones: zhCN_zones,
174+
'stw-operations': {
175+
'auto-kick': zhCN_stwOperations_AutoKick,
176+
'homebase-name': zhCN_stwOperations_HomebaseName,
177+
'save-quests': zhCN_stwOperations_SaveQuests,
178+
party: zhCN_stwOperations_Party,
179+
urns: zhCN_stwOperations_Urns,
180+
xpboosts: zhCN_stwOperations_XPBoosts,
181+
llamas: zhCN_stwOperations_Llamas,
182+
unlock: zhCN_stwOperations_Unlock,
183+
},
184+
'account-management': {
185+
'vbucks-information': zhCN_accountManagement_VBucksInformation,
186+
'redeem-codes': zhCN_accountManagement_RedeemCodes,
187+
'devices-auth': zhCN_accountManagement_DevicesAuth,
188+
'epic-settings': zhCN_accountManagement_EpicSettings,
189+
eula: zhCN_accountManagement_EULA,
190+
},
191+
'advanced-mode': {
192+
'matchmaking-track': zhCN_advancedMode_MatchmakingTrack,
193+
'world-info': zhCN_advancedMode_WorldInfo,
194+
},
195+
accounts: {
196+
general: zhCN_myAccounts_General,
197+
'auth-code': zhCN_myAccounts_AuthCode,
198+
'exchange-code': zhCN_myAccounts_ExchangeCode,
199+
'device-auth': zhCN_myAccounts_DeviceAuth,
200+
'remove-account': zhCN_myAccounts_RemoveAccount,
201+
},
202+
}
203+
133204
/**
134205
* Export resources
135206
*/
136207

137208
export enum Language {
138209
English = 'en-US',
139210
Spanish = 'es-419',
211+
Chinese = 'zh-CN',
140212
}
141213

142214
export const resources: Resource = {
143215
[Language.English]: enUS,
144216
[Language.Spanish]: es419,
217+
[Language.Chinese]: zhCN,
145218
}
Lines changed: 18 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,18 @@
1+
{
2+
"description": "选择一个账户并管理您创建的设备授权。用户代理、创建时间和最后访问时间将显示以下信息:位置、IP地址和日期。",
3+
"form": {
4+
"submit-button": "请求设备授权"
5+
},
6+
"results": {
7+
"title": "找到的设备:<1>{{total}}</1>",
8+
"item": {
9+
"created": "创建时间",
10+
"last-access": "最后访问时间"
11+
}
12+
},
13+
"notifications": {
14+
"no-devices": "未找到设备",
15+
"success": "设备ID {{deviceId}} 已成功移除",
16+
"error": "尝试移除设备ID {{deviceId}} 时发生错误"
17+
}
18+
}
Lines changed: 11 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,11 @@
1+
{
2+
"form": {
3+
"generate-button": "生成链接",
4+
"open-button": "<0>打开账户设置</0> <1 />"
5+
},
6+
"notifications": {
7+
"clipboard": "链接已复制到剪贴板",
8+
"success": "Epic Games 设置链接已生成",
9+
"error": "处理您的请求时发生错误"
10+
}
11+
}

0 commit comments

Comments
 (0)