Skip to content

Commit 7fd2d67

Browse files
committed
feat(i18n): add i18n for setting page
1 parent cf4ea84 commit 7fd2d67

File tree

3 files changed

+120
-15
lines changed

3 files changed

+120
-15
lines changed

packages/frontend/src/locales/en-US/messages.po

Lines changed: 52 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -35,6 +35,10 @@ msgstr "💡 The most common parameters used by services is a <0>period of 30 se
3535
msgid "AAGUID"
3636
msgstr "AAGUID"
3737

38+
#: src/pages/settings.tsx:399
39+
msgid "About"
40+
msgstr "About"
41+
3842
#: src/utilities/cryptography/fido/fido2.tsx:860
3943
msgid "About FIDO2"
4044
msgstr "About FIDO2"
@@ -70,6 +74,10 @@ msgstr "Algorithm:"
7074
msgid "Allow storing credentials on device"
7175
msgstr "Allow storing credentials on device"
7276

77+
#: src/pages/settings.tsx:206
78+
msgid "Appearance"
79+
msgstr "Appearance"
80+
7381
#: src/utilities/cryptography/fido/fido2.tsx:369
7482
msgid "Attestation"
7583
msgstr "Attestation"
@@ -154,6 +162,10 @@ msgstr "Based on your secret"
154162
msgid "Broadcast Address"
155163
msgstr "Broadcast Address"
156164

165+
#: src/pages/settings.tsx:432
166+
msgid "Bug Reports and Feature Requests"
167+
msgstr "Bug Reports and Feature Requests"
168+
157169
#: src/utilities/cryptography/oath/totp.tsx:165
158170
msgid "By default and to be compatible with Google Authenticator, the issuer is set in the query parameters and as the label prefix."
159171
msgstr "By default and to be compatible with Google Authenticator, the issuer is set in the query parameters and as the label prefix."
@@ -171,6 +183,10 @@ msgstr "Calculation Results"
171183
msgid "Challenge"
172184
msgstr "Challenge"
173185

186+
#: src/pages/settings.tsx:419
187+
msgid "Change Log"
188+
msgstr "Change Log"
189+
174190
#: src/utilities/cryptography/oath/totp.tsx:883
175191
msgid "Check Code"
176192
msgstr "Check Code"
@@ -183,6 +199,10 @@ msgstr "Check TOTP Code"
183199
msgid "CHECK TOTP CODE"
184200
msgstr "CHECK TOTP CODE"
185201

202+
#: src/pages/settings.tsx:156
203+
msgid "Checking for updates"
204+
msgstr "Checking for updates"
205+
186206
#: src/utilities/cryptography/oath/totp.tsx:714
187207
msgid "Checking..."
188208
msgstr "Checking..."
@@ -345,6 +365,10 @@ msgstr "Digits"
345365
msgid "Digits:"
346366
msgstr "Digits:"
347367

368+
#: src/pages/settings.tsx:235
369+
msgid "Display Language"
370+
msgstr "Display Language"
371+
348372
#: src/utilities/cryptography/fido/fido2.tsx:326
349373
msgid "Display Name"
350374
msgstr "Display Name"
@@ -406,6 +430,10 @@ msgstr "FIDO2 Authenticator"
406430
msgid "FIDO2 is a standard for passwordless authentication using public-key cryptography."
407431
msgstr "FIDO2 is a standard for passwordless authentication using public-key cryptography."
408432

433+
#: src/pages/settings.tsx:448
434+
msgid "Follow DevUtility"
435+
msgstr "Follow DevUtility"
436+
409437
#: src/utilities/cryptography/oath/totp.tsx:148
410438
msgid "For e.g the users email address. You must set label before to generate ProvisioningURI/QR code"
411439
msgstr "For e.g the users email address. You must set label before to generate ProvisioningURI/QR code"
@@ -418,6 +446,10 @@ msgstr "For subnetting and CIDR conversion. Enter data on the left, view results
418446
msgid "Format / Validate / Minify"
419447
msgstr "Format / Validate / Minify"
420448

449+
#: src/pages/settings.tsx:203
450+
msgid "General"
451+
msgstr "General"
452+
421453
#: src/utilities/cryptography/oath/totp.tsx:872
422454
msgid "Generate Code"
423455
msgstr "Generate Code"
@@ -817,6 +849,22 @@ msgstr "TOTP QR Code"
817849
msgid "Unknown"
818850
msgstr "Unknown"
819851

852+
#: src/pages/settings.tsx:161
853+
msgid "Up to date"
854+
msgstr "Up to date"
855+
856+
#: src/pages/settings.tsx:147
857+
msgid "Update"
858+
msgstr "Update"
859+
860+
#: src/pages/settings.tsx:171
861+
msgid "Update Now"
862+
msgstr "Update Now"
863+
864+
#: src/pages/settings.tsx:151
865+
msgid "Updating"
866+
msgstr "Updating"
867+
820868
#: src/utilities/network/ip.tsx:306
821869
msgid "Usable Host Range"
822870
msgstr "Usable Host Range"
@@ -892,3 +940,7 @@ msgstr "windows"
892940
#: src/utilities/cryptography/oath/totp.tsx:224
893941
msgid "You must verify that the algorithm you want to use is supported by the application your clients might be using."
894942
msgstr "You must verify that the algorithm you want to use is supported by the application your clients might be using."
943+
944+
#: src/pages/settings.tsx:251
945+
msgid "Zoom"
946+
msgstr "Zoom"

packages/frontend/src/locales/zh-CN/messages.po

Lines changed: 53 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -35,6 +35,10 @@ msgstr "💡 服务中最常用的参数<0>包括30秒的验证间隔</0>、<1>S
3535
msgid "AAGUID"
3636
msgstr ""
3737

38+
#: src/pages/settings.tsx:399
39+
msgid "About"
40+
msgstr "关于"
41+
3842
#: src/utilities/cryptography/fido/fido2.tsx:860
3943
msgid "About FIDO2"
4044
msgstr ""
@@ -70,6 +74,10 @@ msgstr "算法:"
7074
msgid "Allow storing credentials on device"
7175
msgstr ""
7276

77+
#: src/pages/settings.tsx:206
78+
msgid "Appearance"
79+
msgstr "外观"
80+
7381
#: src/utilities/cryptography/fido/fido2.tsx:369
7482
msgid "Attestation"
7583
msgstr ""
@@ -154,6 +162,10 @@ msgstr "基于您的密钥"
154162
msgid "Broadcast Address"
155163
msgstr ""
156164

165+
#: src/pages/settings.tsx:432
166+
msgid "Bug Reports and Feature Requests"
167+
msgstr "错误报告和功能请求"
168+
157169
#: src/utilities/cryptography/oath/totp.tsx:165
158170
msgid "By default and to be compatible with Google Authenticator, the issuer is set in the query parameters and as the label prefix."
159171
msgstr "默认情况下,为了与 Google Authenticator 兼容,发行者在查询参数中设置,并作为标签前缀。"
@@ -171,6 +183,10 @@ msgstr ""
171183
msgid "Challenge"
172184
msgstr ""
173185

186+
#: src/pages/settings.tsx:419
187+
msgid "Change Log"
188+
msgstr "更新记录"
189+
174190
#: src/utilities/cryptography/oath/totp.tsx:883
175191
msgid "Check Code"
176192
msgstr "检查验证码"
@@ -183,6 +199,10 @@ msgstr "验证 TOTP 代码"
183199
msgid "CHECK TOTP CODE"
184200
msgstr "验证 TOTP 代码"
185201

202+
#: src/pages/settings.tsx:156
203+
msgid "Checking for updates"
204+
msgstr "检查更新中"
205+
186206
#: src/utilities/cryptography/oath/totp.tsx:714
187207
msgid "Checking..."
188208
msgstr "正在检查……"
@@ -266,7 +286,7 @@ msgstr "创建密钥"
266286
msgid "Create TOTP Secret"
267287
msgstr "创建 TOTP 密钥"
268288

269-
#: src/utilities/cryptography/oath/totp.tsx:289
289+
#: src/utilities/cryptography/totp.tsx:289
270290
msgid "CREATE TOTP SECRET"
271291
msgstr "创建 TOTP 密钥"
272292

@@ -345,6 +365,10 @@ msgstr "验证码长度"
345365
msgid "Digits:"
346366
msgstr "验证码长度:"
347367

368+
#: src/pages/settings.tsx:235
369+
msgid "Display Language"
370+
msgstr "显示语言"
371+
348372
#: src/utilities/cryptography/fido/fido2.tsx:326
349373
msgid "Display Name"
350374
msgstr ""
@@ -406,6 +430,10 @@ msgstr ""
406430
msgid "FIDO2 is a standard for passwordless authentication using public-key cryptography."
407431
msgstr ""
408432

433+
#: src/pages/settings.tsx:448
434+
msgid "Follow DevUtility"
435+
msgstr "关注 DevUtility"
436+
409437
#: src/utilities/cryptography/oath/totp.tsx:148
410438
msgid "For e.g the users email address. You must set label before to generate ProvisioningURI/QR code"
411439
msgstr "例如用户的电子邮件地址。在生成 ProvisioningURI/QR 码之前,必须先设置标签"
@@ -418,6 +446,10 @@ msgstr ""
418446
msgid "Format / Validate / Minify"
419447
msgstr "格式化 / 验证 / 压缩"
420448

449+
#: src/pages/settings.tsx:203
450+
msgid "General"
451+
msgstr "通用"
452+
421453
#: src/utilities/cryptography/oath/totp.tsx:872
422454
msgid "Generate Code"
423455
msgstr "获取验证码"
@@ -817,6 +849,22 @@ msgstr ""
817849
msgid "Unknown"
818850
msgstr ""
819851

852+
#: src/pages/settings.tsx:161
853+
msgid "Up to date"
854+
msgstr "已是最新"
855+
856+
#: src/pages/settings.tsx:147
857+
msgid "Update"
858+
msgstr "更新"
859+
860+
#: src/pages/settings.tsx:171
861+
msgid "Update Now"
862+
msgstr "立刻更新"
863+
864+
#: src/pages/settings.tsx:151
865+
msgid "Updating"
866+
msgstr "正在更新中"
867+
820868
#: src/utilities/network/ip.tsx:306
821869
msgid "Usable Host Range"
822870
msgstr ""
@@ -892,3 +940,7 @@ msgstr ""
892940
#: src/utilities/cryptography/oath/totp.tsx:224
893941
msgid "You must verify that the algorithm you want to use is supported by the application your clients might be using."
894942
msgstr ""
943+
944+
#: src/pages/settings.tsx:251
945+
msgid "Zoom"
946+
msgstr "缩放"

packages/frontend/src/pages/settings.tsx

Lines changed: 15 additions & 14 deletions
Original file line numberDiff line numberDiff line change
@@ -13,6 +13,7 @@
1313
* See LICENSE file for details or contact [email protected]
1414
*/
1515

16+
import { Trans } from "@lingui/react/macro";
1617
import { relaunch } from "@tauri-apps/plugin-process";
1718
import { check } from "@tauri-apps/plugin-updater";
1819
import {
@@ -45,7 +46,7 @@ import {
4546
import { Separator } from "@/components/ui/separator";
4647

4748
interface SettingItemProps {
48-
title: string;
49+
title: React.ReactNode;
4950
description?: string;
5051
children: React.ReactNode;
5152
}
@@ -143,21 +144,21 @@ const UpdateItem = () => {
143144
);
144145

145146
return (
146-
<SettingItem title="更新">
147+
<SettingItem title={<Trans>Update</Trans>}>
147148
<div className="flex items-center gap-3">
148149
{isUpdating ? (
149150
<Badge variant="secondary" className="text-xs">
150-
正在更新中
151+
<Trans>Updating</Trans>
151152
<Loader2Icon className="h-3 w-3 animate-spin" />
152153
</Badge>
153154
) : isLoading ? (
154155
<Badge variant="secondary" className="text-xs">
155-
检查更新中
156+
<Trans>Checking for updates</Trans>
156157
<Loader2Icon className="h-3 w-3 animate-spin" />
157158
</Badge>
158159
) : update === null ? (
159160
<Badge variant="secondary" className="text-xs">
160-
已是最新
161+
<Trans>Up to date</Trans>
161162
</Badge>
162163
) : (
163164
<Button
@@ -167,7 +168,7 @@ const UpdateItem = () => {
167168
setIsUpdating(true);
168169
}}
169170
>
170-
立刻更新
171+
<Trans>Update Now</Trans>
171172
</Button>
172173
)}
173174
</div>
@@ -199,10 +200,10 @@ export default function SettingsPage() {
199200
{/* 通用设置 */}
200201
<Card>
201202
<CardHeader className="pb-4">
202-
<CardTitle className="text-base font-medium">通用</CardTitle>
203+
<CardTitle className="text-base font-medium"><Trans>General</Trans></CardTitle>
203204
</CardHeader>
204205
<CardContent className="space-y-6">
205-
<SettingItem title="外观">
206+
<SettingItem title={<Trans>Appearance</Trans>}>
206207
<div className="flex items-center gap-1 rounded-lg border p-1">
207208
<Button
208209
variant={settings.theme === "system" ? "secondary" : "ghost"}
@@ -231,7 +232,7 @@ export default function SettingsPage() {
231232
</div>
232233
</SettingItem>
233234

234-
<SettingItem title="显示语言">
235+
<SettingItem title={<Trans>Display Language</Trans>}>
235236
<Select
236237
value={settings.language}
237238
onValueChange={(value) => updateSetting("language", value)}
@@ -247,7 +248,7 @@ export default function SettingsPage() {
247248
</Select>
248249
</SettingItem>
249250

250-
<SettingItem title="缩放">
251+
<SettingItem title={<Trans>Zoom</Trans>}>
251252
<div className="flex items-center gap-2">
252253
<Button
253254
variant="outline"
@@ -395,7 +396,7 @@ export default function SettingsPage() {
395396
{/* 关于 */}
396397
<Card>
397398
<CardHeader className="pb-4">
398-
<CardTitle className="text-base font-medium">关于</CardTitle>
399+
<CardTitle className="text-base font-medium"><Trans>About</Trans></CardTitle>
399400
</CardHeader>
400401
<CardContent className="space-y-6">
401402
<UpdateItem />
@@ -415,7 +416,7 @@ export default function SettingsPage() {
415416
className="flex items-center gap-1 hover:text-foreground transition-colors"
416417
>
417418
<DownloadIcon className="h-3.5 w-3.5" />
418-
更新记录
419+
<Trans>Change Log</Trans>
419420
</button>
420421
<button
421422
type="button"
@@ -428,7 +429,7 @@ export default function SettingsPage() {
428429
className="flex items-center gap-1 hover:text-foreground transition-colors"
429430
>
430431
<InfoIcon className="h-3.5 w-3.5" />
431-
错误报告和功能请求
432+
<Trans>Bug Reports and Feature Requests</Trans>
432433
</button>
433434
{/* <button
434435
type="button"
@@ -444,7 +445,7 @@ export default function SettingsPage() {
444445

445446
<div className="flex items-center justify-between text-sm text-muted-foreground">
446447
<div className="flex items-center gap-6">
447-
<span>关注 DevUtility</span>
448+
<span><Trans>Follow DevUtility</Trans></span>
448449
{/* <span>隐私政策</span> */}
449450
</div>
450451
<div className="flex items-center gap-4">

0 commit comments

Comments
 (0)