mirror of
https://github.com/QuantumNous/new-api.git
synced 2026-03-30 03:43:39 +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:
@@ -54,6 +54,20 @@ This document provides standard translation references for key terminology in th
|
||||
| 代理 | Proxy | 代理服务器地址 | Proxy server address |
|
||||
| 模型重定向 | Model Mapping | 请求体中模型名称替换 | Model name replacement in request body |
|
||||
|
||||
## 安全相关 (Security Related)
|
||||
|
||||
| 中文 | English | 说明 | Description |
|
||||
|------|---------|------|-------------|
|
||||
| 两步验证 | Two-Factor Authentication | 为账户提供额外安全保护的验证方式 | Additional security verification method for accounts |
|
||||
| 2FA | Two-Factor Authentication | 两步验证的缩写 | Abbreviation for Two-Factor Authentication |
|
||||
|
||||
## 计费相关 (Billing Related)
|
||||
|
||||
| 中文 | English | 说明 | Description |
|
||||
|------|---------|------|-------------|
|
||||
| 倍率 | Ratio | 价格计算的乘数因子 | Multiplier factor used for price calculation |
|
||||
| 倍率 | Multiplier | 价格计算的乘数因子(同义词) | Multiplier factor used for price calculation (synonym) |
|
||||
|
||||
## 翻译注意事项 (Translation Guidelines)
|
||||
|
||||
- **提示 (Prompt)** = 模型输入内容 / Model input content
|
||||
|
||||
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