feat: add i18n configuration and expand translation glossary

Add comprehensive i18next configuration for internationalization support with Chinese, English, and French locales. Configure extraction settings and ignore patterns for React components. Expand translation glossary with security and billing terminology including Two-Factor Authentication, 2FA, and pricing multiplier terms.
This commit is contained in:
Dmitriy Safonov
2025-10-09 23:14:24 +03:00
parent df0ae9294d
commit c7661167cf
8 changed files with 6234 additions and 4709 deletions

76
web/i18next.config.ts Normal file
View File

@@ -0,0 +1,76 @@
import { defineConfig } from 'i18next-cli';
export default defineConfig({
locales: [
"zh",
"en",
"fr"
],
extract: {
input: [
"src/**/*.{js,jsx,ts,tsx}"
],
ignore: [
"src/i18n/**/*"
],
output: "src/i18n/locales/{{language}}.json",
ignoredAttributes: [
"data-testid",
"aria-label",
"role",
"className",
"id",
"key",
"shape",
"color",
"size",
"theme",
"position",
"layout",
"margin",
"trigger",
"itemKey",
"defaultActiveKey",
"field",
"value",
"rel",
"name",
"validateStatus",
"direction",
"clipRule",
"fillRule",
"viewBox",
"editorType",
"autoComplete",
"fill",
"searchPosition",
"uploadTrigger",
"accept",
"uploadTrigger",
"placement",
"rowKey",
"style",
"align",
"crossOrigin",
"field",
"data-name",
"data-index",
"data-type",
"height",
"width",
"overflow",
"keyPrefix",
"htmlType",
"mode",
"maxHeight",
"hoverStyle",
"selectedStyle"
],
sort: true,
disablePlurals: true,
removeUnusedKeys: true,
nsSeparator: false,
keySeparator: false,
mergeNamespaces: true
}
});

View File

@@ -17,6 +17,7 @@
"history": "^5.3.0",
"i18next": "^23.16.8",
"i18next-browser-languagedetector": "^7.2.0",
"i18next-cli": "^1.10.3",
"katex": "^0.16.22",
"lucide-react": "^0.511.0",
"marked": "^4.1.1",
@@ -49,7 +50,11 @@
"lint:fix": "prettier . --write",
"eslint": "bunx eslint \"**/*.{js,jsx}\" --cache",
"eslint:fix": "bunx eslint \"**/*.{js,jsx}\" --fix --cache",
"preview": "vite preview"
"preview": "vite preview",
"i18n:extract": "bunx i18next-cli extract",
"i18n:status": "bunx i18next-cli status",
"i18n:sync": "bunx i18next-cli sync",
"i18n:lint": "bunx i18next-cli lint"
},
"eslintConfig": {
"extends": [

View File

@@ -31,15 +31,9 @@ i18n
.init({
load: 'languageOnly',
resources: {
en: {
translation: enTranslation,
},
zh: {
translation: zhTranslation,
},
fr: {
translation: frTranslation,
},
en: enTranslation,
zh: zhTranslation,
fr: frTranslation,
},
fallbackLng: 'zh',
interpolation: {

File diff suppressed because it is too large Load Diff

File diff suppressed because it is too large Load Diff

File diff suppressed because it is too large Load Diff

View File

@@ -105,7 +105,7 @@ export default function SettingGlobalModel(props) {
})
}
extraText={
'开启后,所有请求将直接透传给上游,不会进行任何处理(重定向和渠道适配也将失效),请谨慎开启'
t('开启后,所有请求将直接透传给上游,不会进行任何处理(重定向和渠道适配也将失效),请谨慎开启')
}
/>
</Col>
@@ -116,7 +116,7 @@ export default function SettingGlobalModel(props) {
<Col span={24}>
<Banner
type='warning'
description='警告启用保活后如果已经写入保活数据后渠道出错系统无法重试如果必须开启推荐设置尽可能大的Ping间隔'
description={t('警告启用保活后如果已经写入保活数据后渠道出错系统无法重试如果必须开启推荐设置尽可能大的Ping间隔')}
/>
</Col>
</Row>
@@ -131,7 +131,7 @@ export default function SettingGlobalModel(props) {
'general_setting.ping_interval_enabled': value,
})
}
extraText={'开启后将定期发送ping数据保持连接活跃'}
extraText={t('开启后将定期发送ping数据保持连接活跃')}
/>
</Col>
<Col xs={24} sm={12} md={8} lg={8} xl={8}>