mirror of
https://github.com/QuantumNous/new-api.git
synced 2026-03-30 04:22:58 +00:00
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:
76
web/i18next.config.ts
Normal file
76
web/i18next.config.ts
Normal 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
|
||||
}
|
||||
});
|
||||
@@ -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": [
|
||||
|
||||
@@ -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
@@ -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}>
|
||||
|
||||
Reference in New Issue
Block a user