Skip to content

feat(localization): added zh_TW - #2913

Merged
Calcium-Ion merged 19 commits into
QuantumNous:mainfrom
olivertzeng:locale
Feb 11, 2026
Merged

feat(localization): added zh_TW#2913
Calcium-Ion merged 19 commits into
QuantumNous:mainfrom
olivertzeng:locale

Conversation

@olivertzeng

@olivertzeng olivertzeng commented Feb 11, 2026

Copy link
Copy Markdown
Contributor

Added zh_TW in localizations

No breaking changes

Summary by CodeRabbit

  • New Features

    • Explicit support for Simplified (zh-CN) and Traditional (zh-TW) Chinese across the app; language selector and defaults updated to prefer zh-CN while offering both variants.
    • Added full Traditional Chinese UI translations.
  • Documentation

    • Updated README language navigation to distinguish Simplified/Traditional Chinese; normalized note and path formatting.
    • Minor typography and formatting consistency improvements across localized READMEs.

@olivertzeng

Copy link
Copy Markdown
Contributor Author

#2910

@coderabbitai

coderabbitai Bot commented Feb 11, 2026

Copy link
Copy Markdown
Contributor

Note

Reviews paused

It looks like this branch is under active development. To avoid overwhelming you with review comments due to an influx of new commits, CodeRabbit has automatically paused this review. You can configure this behavior by changing the reviews.auto_review.auto_pause_after_reviewed_commits setting.

Use the following commands to manage reviews:

  • @coderabbitai resume to resume automatic reviews.
  • @coderabbitai review to trigger a single review.

Use the checkboxes below for quick actions:

  • ▶️ Resume reviews
  • 🔍 Trigger review

Walkthrough

Split Chinese locale support into explicit Simplified (zh-CN) and Traditional (zh-TW) variants across backend and frontend i18n, added Traditional Chinese translations and README, and adjusted README language navigation/blockquote formatting.

Changes

Cohort / File(s) Summary
Documentation README Updates
README.md, README.fr.md, README.ja.md, README.zh_CN.md, README.zh_TW.md
Reworked language navigation to surface zh-CN / zh-TW, converted [!NOTE]/[!IMPORTANT] blocks to blockquote-style > markers, minor typography and path-description formatting changes; added full README.zh_TW.md.
Backend i18n Core
i18n/i18n.go, i18n/locales/..., controller/model_sync.go
Replaced LangZh with LangZhCN (zh-CN) and LangZhTW (zh-TW); init loads zh-CN and zh-TW; normalizeLang and SupportedLanguages updated; added i18n/locales/zh-TW.yaml; adjusted locale normalization in model_sync.go.
Frontend i18n Setup
web/src/i18n/i18n.js, web/src/i18n/.../zh-CN.json, web/src/i18n/.../zh-TW.json
Split single zh resource into zh-CN and zh-TW imports/resources; changed fallbackLng to zh-CN and load option to currentOnly.
Frontend Language Selectors / Preferences
web/src/components/.../PreferencesSettings.jsx, web/src/components/layout/headerbar/LanguageSelector.jsx, web/src/components/table/models/modals/SyncWizardModal.jsx
Replaced 'zh' option with distinct 'zh-CN' (简体中文, 🇨🇳) and 'zh-TW' (繁體中文, 🇹🇼) options; default language initialization changed to zh-CN; some previous language options commented out.
i18n Locale Data (new)
i18n/locales/zh-TW.yaml
Added Traditional Chinese translations for multiple namespaces (data/content-only addition).

Sequence Diagram(s)

sequenceDiagram
    participant User
    participant Frontend as Frontend (React)
    participant Backend as API Server
    participant I18n as i18n Service/Files

    rect rgba(100,150,240,0.5)
    User->>Frontend: select language (zh-CN / zh-TW)
    Frontend->>I18n: load resource (zh-CN.json / zh-TW.json)
    Frontend->>Backend: request data (Accept-Language: zh-CN / zh-TW)
    Backend->>I18n: normalizeLang -> map to zh-CN / zh-TW
    Backend->>Frontend: localized response/content
    end
Loading

Estimated code review effort

🎯 4 (Complex) | ⏱️ ~45 minutes

Possibly related PRs

Suggested reviewers

  • Calcium-Ion

Poem

🐰
I hopped from zh to two bright streams,
简体 and 繁體 — double dreams.
Docs refreshed and flags in sight,
Two tongues now share the light. ✨

🚥 Pre-merge checks | ✅ 2 | ❌ 1
❌ Failed checks (1 warning)
Check name Status Explanation Resolution
Docstring Coverage ⚠️ Warning Docstring coverage is 75.00% which is insufficient. The required threshold is 80.00%. Write docstrings for the functions missing them to satisfy the coverage threshold.
✅ Passed checks (2 passed)
Check name Status Explanation
Description Check ✅ Passed Check skipped - CodeRabbit’s high-level summary is enabled.
Title check ✅ Passed The title 'feat(localization): added zh_TW' accurately describes the primary change—adding Traditional Chinese localization support—which aligns with the main changeset focus across multiple files and the PR objectives.

✏️ Tip: You can configure your own custom pre-merge checks in the settings.

✨ Finishing touches
🧪 Generate unit tests (beta)
  • Create PR with unit tests
  • Post copyable unit tests in a comment

Thanks for using CodeRabbit! It's free for OSS, and your support helps us grow. If you like it, consider giving us a shout-out.

❤️ Share

Comment @coderabbitai help to get the list of available commands and usage tips.

@coderabbitai coderabbitai Bot left a comment

Copy link
Copy Markdown
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Actionable comments posted: 1

Caution

Some comments are outside the diff and can’t be posted inline due to platform limitations.

⚠️ Outside diff range comments (3)
web/src/components/settings/personal/cards/PreferencesSettings.jsx (1)

41-41: ⚠️ Potential issue | 🟡 Minor

Stale default language code 'zh'.

The fallback 'zh' no longer corresponds to any registered i18n resource. After aligning the keys, update this to 'zh-CN':

-  const [currentLanguage, setCurrentLanguage] = useState(i18n.language || 'zh');
+  const [currentLanguage, setCurrentLanguage] = useState(i18n.language || 'zh-CN');
i18n/i18n.go (2)

200-215: ⚠️ Potential issue | 🔴 Critical

Bug: strings.ToLower on Line 202 makes the zh_CN / zh_TW prefix checks dead code.

After strings.ToLower, the input becomes "zh_cn" / "zh_tw", which never matches the mixed-case prefixes "zh_CN" / "zh_TW" on Lines 206 and 208. Every Chinese input falls through to DefaultLang (English), completely breaking Chinese localization.

Additional gaps:

  1. Bare "zh" (no region) is no longer handled — this is a regression for existing users whose Accept-Language is just "zh".
  2. Standard BCP 47 tags sent by browsers use hyphens (zh-CN, zh-TW, zh-Hans, zh-Hant), not underscores. These won't match either.
🐛 Proposed fix
 func normalizeLang(lang string) string {
 	lang = strings.ToLower(strings.TrimSpace(lang))
+	lang = strings.ReplaceAll(lang, "-", "_")
 
 	// Handle common variations
 	switch {
-	case strings.HasPrefix(lang, "zh_CN"):
+	case strings.HasPrefix(lang, "zh_cn"):
 		return LangZhCN
-	case strings.HasPrefix(lang, "zh_TW"):
+	case strings.HasPrefix(lang, "zh_tw"),
+		strings.HasPrefix(lang, "zh_hant"):
 		return LangZhTW
+	case strings.HasPrefix(lang, "zh"):
+		return LangZhCN // bare "zh" defaults to Simplified Chinese
 	case strings.HasPrefix(lang, "en"):
 		return LangEn
 	default:
 		return DefaultLang
 	}
 }

42-55: ⚠️ Potential issue | 🔴 Critical

Load zh_CN.yaml and zh_TW.yaml instead of the non-existent zh.yaml — initialization will fail.

Line 43 attempts to load "locales/zh.yaml", which does not exist in the codebase. Only zh_CN.yaml and zh_TW.yaml exist. This causes bundle.LoadMessageFileFS() to return an error on line 45, which sets initErr, causing Init() to fail and breaking all i18n functionality.

The localizers created for zh_CN and zh_TW (lines 53–54) will have no translation data because their corresponding files are never loaded.

🔧 Fix — load the correct locale files
 		// Load embedded translation files
-		files := []string{"locales/zh.yaml", "locales/en.yaml"}
+		files := []string{"locales/zh_CN.yaml", "locales/zh_TW.yaml", "locales/en.yaml"}
🤖 Fix all issues with AI agents
In `@web/src/i18n/i18n.js`:
- Around line 36-46: The fallback language key and UI language values are
inconsistent with the resource keys and BCP-47 format; update the i18n
configuration by changing fallbackLng from 'zhCN' to 'zh-CN' (referencing the
fallbackLng setting and resources object in i18n.js) and ensure the Chinese
locale tags use hyphens not underscores in the UI by updating the language
option values in PreferencesSettings.jsx (where i18n.changeLanguage is called or
language option values are defined) from 'zh_CN'/'zh_TW' to 'zh-CN'/'zh-TW' so
they exactly match the resource keys while keeping load: 'currentOnly'.

Comment thread web/src/i18n/i18n.js Outdated

@coderabbitai coderabbitai Bot left a comment

Copy link
Copy Markdown
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Actionable comments posted: 1

Caution

Some comments are outside the diff and can’t be posted inline due to platform limitations.

⚠️ Outside diff range comments (2)
controller/model_sync.go (1)

29-37: ⚠️ Potential issue | 🔴 Critical

Bug: strings.ToLower makes "zh-CN" and "zh-TW" cases unreachable.

Line 30 lowercases the input, so l will be "zh-cn" or "zh-tw", which never matches the mixed-case literals on line 32. Chinese locales will always fall through to the default branch, silently returning ("", false).

Match against the lowercased forms, and return the canonical (correctly-cased) value for use in upstream URL paths:

🐛 Proposed fix
 func normalizeLocale(locale string) (string, bool) {
 	l := strings.ToLower(strings.TrimSpace(locale))
 	switch l {
-	case "en", "zh-CN", "zh-TW", "ja":
-		return l, true
+	case "en":
+		return "en", true
+	case "zh-cn":
+		return "zh-CN", true
+	case "zh-tw":
+		return "zh-TW", true
+	case "ja":
+		return "ja", true
 	default:
 		return "", false
 	}
 }
web/src/components/layout/headerbar/LanguageSelector.jsx (1)

32-38: ⚠️ Potential issue | 🔴 Critical

Bug: Language code 'zh' doesn't match any i18n resource; zh-TW option is missing.

With load: 'currentOnly' in i18n.js, onLanguageChange('zh') will look for resources['zh'] which doesn't exist — only 'zh-CN' and 'zh-TW' do. The currentLang === 'zh' check will also never highlight. Additionally, TW is imported (line 23) but no zh-TW dropdown item is rendered.

🐛 Proposed fix — update zh-CN and add zh-TW option
          <Dropdown.Item
-            onClick={() => onLanguageChange('zh')}
-            className={`!flex !items-center !gap-2 !px-3 !py-1.5 !text-sm !text-semi-color-text-0 dark:!text-gray-200 ${currentLang === 'zh' ? '!bg-semi-color-primary-light-default dark:!bg-blue-600 !font-semibold' : 'hover:!bg-semi-color-fill-1 dark:hover:!bg-gray-600'}`}
+            onClick={() => onLanguageChange('zh-CN')}
+            className={`!flex !items-center !gap-2 !px-3 !py-1.5 !text-sm !text-semi-color-text-0 dark:!text-gray-200 ${currentLang === 'zh-CN' ? '!bg-semi-color-primary-light-default dark:!bg-blue-600 !font-semibold' : 'hover:!bg-semi-color-fill-1 dark:hover:!bg-gray-600'}`}
           >
             <CN title='简体中文' className='!w-5 !h-auto' />
             <span>简体中文</span>
           </Dropdown.Item>
+          <Dropdown.Item
+            onClick={() => onLanguageChange('zh-TW')}
+            className={`!flex !items-center !gap-2 !px-3 !py-1.5 !text-sm !text-semi-color-text-0 dark:!text-gray-200 ${currentLang === 'zh-TW' ? '!bg-semi-color-primary-light-default dark:!bg-blue-600 !font-semibold' : 'hover:!bg-semi-color-fill-1 dark:hover:!bg-gray-600'}`}
+          >
+            <TW title='繁體中文' className='!w-5 !h-auto' />
+            <span>繁體中文</span>
+          </Dropdown.Item>
🤖 Fix all issues with AI agents
In `@web/src/pages/Home/index.jsx`:
- Line 82: The isChinese check currently uses i18n.language.startsWith('zh-CN'),
which excludes Traditional Chinese; update the condition used to compute
isChinese to i18n.language.startsWith('zh') so it covers both zh-CN and zh-TW
(this variable is used to toggle the tracking-wide class near the tracking-wide
usage in the component).
🧹 Nitpick comments (1)
web/src/components/table/models/modals/SyncWizardModal.jsx (1)

118-123: Nit: Both Chinese radio buttons display "ZH" — consider differentiating.

The extra text distinguishes the options, but using "CN" / "TW" (or "ZH-CN" / "ZH-TW") as the primary label would make selection clearer at a glance.

Suggested diff
-              <Radio value='zh-CN' extra='简体中文'>
-                ZH
-              </Radio>
-              <Radio value='zh-TW' extra='繁體中文'>
-                ZH
+              <Radio value='zh-CN' extra='简体中文'>
+                CN
+              </Radio>
+              <Radio value='zh-TW' extra='繁體中文'>
+                TW
               </Radio>

Comment thread web/src/pages/Home/index.jsx Outdated

@coderabbitai coderabbitai Bot left a comment

Copy link
Copy Markdown
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Caution

Some comments are outside the diff and can’t be posted inline due to platform limitations.

⚠️ Outside diff range comments (3)
i18n/i18n.go (3)

200-215: ⚠️ Potential issue | 🔴 Critical

Bug: strings.ToLower on line 202 makes Chinese variant matching on lines 206–209 impossible.

lang is lowercased to e.g. "zh-cn" or "zh-tw", then compared via HasPrefix against "zh-CN" and "zh-TW" (mixed-case). These prefixes will never match, so all Chinese inputs fall through to default, returning DefaultLang (English). This breaks Chinese language support entirely.

Use lowercase prefixes in the comparisons:

Proposed fix
 func normalizeLang(lang string) string {
 	lang = strings.ToLower(strings.TrimSpace(lang))
 
 	// Handle common variations
 	switch {
-	case strings.HasPrefix(lang, "zh-CN"):
+	case strings.HasPrefix(lang, "zh-cn"):
 		return LangZhCN
-	case strings.HasPrefix(lang, "zh-TW"):
+	case strings.HasPrefix(lang, "zh-tw"):
 		return LangZhTW
 	case strings.HasPrefix(lang, "en"):
 		return LangEn
 	default:
 		return DefaultLang
 	}
 }

200-215: ⚠️ Potential issue | 🟠 Major

Bare "zh" input now resolves to English instead of Chinese — regression for common Accept-Language values.

After fixing the case issue above, inputs like "zh" or "zh-Hans" won't match either "zh-cn" or "zh-tw" prefixes (since HasPrefix("zh", "zh-cn") is false). Many browsers and API clients send bare "zh". Previously this mapped to LangZh; now it falls through to English.

Add a catch-all for bare zh:

Proposed fix (on top of the case fix)
 	switch {
-	case strings.HasPrefix(lang, "zh-cn"):
+	case strings.HasPrefix(lang, "zh-tw"):
+		return LangZhTW
+	case strings.HasPrefix(lang, "zh"):
 		return LangZhCN
-	case strings.HasPrefix(lang, "zh-tw"):
-		return LangZhTW
 	case strings.HasPrefix(lang, "en"):
 		return LangEn

Note: zh-tw must be checked before the zh prefix catch-all, otherwise "zh-tw" would match "zh" first.


42-54: ⚠️ Potential issue | 🔴 Critical

Fix the translation file loading: incorrect filename for Simplified Chinese and missing Traditional Chinese translation.

Line 43 tries to load locales/zh.yaml which does not exist—the actual file is locales/zh-CN.yaml. Additionally, locales/zh-TW.yaml is missing from the files list even though a localizer for it is created on line 54. This will cause the Init() function to fail at runtime or leave the Traditional Chinese localizer without translations.

Proposed fix
 		// Load embedded translation files
-		files := []string{"locales/zh.yaml", "locales/en.yaml"}
+		files := []string{"locales/zh-CN.yaml", "locales/zh-TW.yaml", "locales/en.yaml"}

@Calcium-Ion

Copy link
Copy Markdown
Member

没有考虑现有数据的兼容处理,用户如果已选语言偏好zh,你改完会直接变成en

@coderabbitai coderabbitai Bot left a comment

Copy link
Copy Markdown
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Actionable comments posted: 1

Caution

Some comments are outside the diff and can’t be posted inline due to platform limitations.

⚠️ Outside diff range comments (1)
i18n/i18n.go (1)

200-215: ⚠️ Potential issue | 🟠 Major

Missing handling for zh-Hant / zh-Hans language tags.

Browsers and OS-level language settings commonly send zh-Hant (Traditional Chinese) and zh-Hans (Simplified Chinese) in addition to zh-TW / zh-CN. After lowercasing, "zh-hant" has prefix "zh" but not "zh-tw", so it falls through to LangZhCN — incorrectly mapping Traditional Chinese users to Simplified Chinese.

Proposed fix
 func normalizeLang(lang string) string {
 	lang = strings.ToLower(strings.TrimSpace(lang))
 
 	// Handle common variations
 	switch {
-	case strings.HasPrefix(lang, "zh-tw"):
+	case strings.HasPrefix(lang, "zh-tw"), strings.HasPrefix(lang, "zh-hant"):
 		return LangZhTW
-	case strings.HasPrefix(lang, "zh"):
+	case strings.HasPrefix(lang, "zh"):  // zh, zh-cn, zh-hans, etc.
 		return LangZhCN
 	case strings.HasPrefix(lang, "en"):
 		return LangEn
 	default:
 		return DefaultLang
 	}
 }
🤖 Fix all issues with AI agents
In `@i18n/i18n.go`:
- Around line 18-23: The backend currently only defines LangZhCN, LangZhTW and
LangEn (DefaultLang) causing mismatch with the frontend language options and
legacy "zh" values; update the supported locales to match the frontend by either
adding the missing locale YAML files under i18n/locales (fr, ru, ja, vi) so
i18n.go can load them, or remove those options from PreferencesSettings.jsx so
both sides match, and add frontend normalization in PreferencesSettings.jsx when
loading stored preferences (normalize legacy "zh" → "zh-CN" before setting the
Select value) to restore backward compatibility with existing "zh" records; also
consider a one-time DB migration to convert stored "zh" to "zh-CN" for
consistency.
🧹 Nitpick comments (1)
i18n/i18n.go (1)

53-55: Consider adding explicit fallback languages to pre-created localizers for defensive translation coverage.

All three locale files (zh-CN.yaml, zh-TW.yaml, en.yaml) currently have identical 203 keys, so missing translations are not an active issue. However, the pre-created localizers only pass a single language to NewLocalizer(), relying on the bundle's default language (language.Chinese / zh tag). Since no zh.yaml file is loaded, incomplete translations in any file would return the raw key.

For consistency and future-proofing, add explicit fallback languages as done on line 84:

Suggested improvement
-		localizers[LangZhCN] = i18n.NewLocalizer(bundle, LangZhCN)
-		localizers[LangZhTW] = i18n.NewLocalizer(bundle, LangZhTW)
+		localizers[LangZhCN] = i18n.NewLocalizer(bundle, LangZhCN, LangEn)
+		localizers[LangZhTW] = i18n.NewLocalizer(bundle, LangZhTW, LangZhCN, LangEn)

Comment thread i18n/i18n.go

@coderabbitai coderabbitai Bot left a comment

Copy link
Copy Markdown
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Actionable comments posted: 1

🤖 Fix all issues with AI agents
In `@web/src/components/settings/personal/cards/PreferencesSettings.jsx`:
- Around line 28-36: PreferencesSettings loads a legacy "zh" preference which no
longer matches any option in languageOptions and causes an empty Select;
normalize legacy values before applying them by mapping "zh" → "zh-CN" (and any
other legacy keys) right after reading the saved preference and before calling
i18n.changeLanguage, and/or add the same normalization in the i18n config
language detector so the app-wide resolver maps "zh" to "zh-CN"; update the code
path that reads the saved language (the value passed to i18n.changeLanguage and
the value bound to the Select) to use the normalized value so the dropdown
matches an entry in languageOptions.

Comment thread web/src/components/settings/personal/cards/PreferencesSettings.jsx
@Calcium-Ion

Copy link
Copy Markdown
Member

最近两个提交是出问题了吗?怎么把其他语言给注释了

@olivertzeng

Copy link
Copy Markdown
Contributor Author

最近两个提交是出问题了吗?怎么把其他语言给注释了

@coderabbitai 的留言:

Fix required:
Update PreferencesSettings.jsx languageOptions to match backend support: remove fr, ru, ja, vi OR add the corresponding .yaml files to i18n/locales/.
Add frontend normalization: when loading stored language preference, normalize legacy "zh" to "zh-CN" before setting it in the Select component (line 50).
Consider one-time data migration to update stored "zh" values to "zh-CN" in the database for consistency.

@coderabbitai

coderabbitai Bot commented Feb 11, 2026

Copy link
Copy Markdown
Contributor

Tip

For best results, initiate chat on the files or code changes.

@olivertzeng, thank you for referencing my feedback!

Yes, commenting out the unsupported languages (fr, ru, ja, vi) in PreferencesSettings.jsx was the correct approach to match the backend's current language support (zh-CN, zh-TW, en).

However, the critical issue that Calcium-Ion raised is still outstanding: the migration/normalization of legacy "zh" values. Without this:

  1. Users who previously selected "zh" will have their preference reset to "en" (the fallback) because "zh" is no longer a valid option
  2. This creates a poor user experience for existing Chinese-speaking users

To fully address this compatibility concern, you still need to implement:

Frontend normalization (quick fix):

// In PreferencesSettings.jsx, around line 50
const storedLanguage = userState.user.language || i18n.language || 'zh-CN';
// Normalize legacy 'zh' to 'zh-CN'
const normalizedLanguage = storedLanguage === 'zh' ? 'zh-CN' : storedLanguage;
setCurrentLanguage(normalizedLanguage);

Backend migration (proper fix):
Consider a one-time database migration to update all stored "zh" values to "zh-CN" to ensure consistency across all user preferences.

This will ensure existing users don't experience the language reset issue that Calcium-Ion mentioned (用户如果已选语言偏好zh,你改完会直接变成en).


🧠 Learnings used
Learnt from: CR
Repo: QuantumNous/new-api PR: 0
File: .cursor/rules/project.mdc:0-0
Timestamp: 2026-02-10T18:08:48.410Z
Learning: Applies to web/**/*.{ts,tsx} : Frontend internationalization uses `i18next` + `react-i18next` + `i18next-browser-languagedetector` with languages: zh (fallback), en, fr, ru, ja, vi

Learnt from: CR
Repo: QuantumNous/new-api PR: 0
File: CLAUDE.md:0-0
Timestamp: 2026-02-10T18:08:26.575Z
Learning: Applies to web/src/**/*.{jsx,tsx,ts,js} : Frontend internationalization uses `i18next` + `react-i18next` + `i18next-browser-languagedetector` with support for zh (fallback), en, fr, ru, ja, vi languages.

Learnt from: CR
Repo: QuantumNous/new-api PR: 0
File: AGENTS.md:0-0
Timestamp: 2026-02-10T18:09:03.784Z
Learning: Applies to web/src/**/*.{ts,tsx} : Frontend internationalization (i18n) MUST use `i18next` + `react-i18next` + `i18next-browser-languagedetector` with supported languages: zh (fallback), en, fr, ru, ja, vi; translation files at `web/src/i18n/locales/{lang}.json` with flat JSON structure using Chinese source strings as keys; use `useTranslation()` hook calling `t('中文key')` in React components

Learnt from: CR
Repo: QuantumNous/new-api PR: 0
File: AGENTS.md:0-0
Timestamp: 2026-02-10T18:09:03.784Z
Learning: Applies to web/src/i18n/locales/*.json : Frontend i18n translation files MUST be flat JSON with keys as Chinese source strings; translation files located at `web/src/i18n/locales/{lang}.json`

Learnt from: CR
Repo: QuantumNous/new-api PR: 0
File: .cursor/rules/project.mdc:0-0
Timestamp: 2026-02-10T18:08:48.410Z
Learning: Applies to web/src/i18n/locales/*.json : Frontend translation files are stored as flat JSON in `web/src/i18n/locales/{lang}.json` with keys as Chinese source strings

Learnt from: CR
Repo: QuantumNous/new-api PR: 0
File: CLAUDE.md:0-0
Timestamp: 2026-02-10T18:08:26.575Z
Learning: Applies to web/src/**/*.{jsx,tsx} : In React components, use the `useTranslation()` hook and call `t('中文key')` to access translations for frontend internationalization.

Learnt from: CR
Repo: QuantumNous/new-api PR: 0
File: CLAUDE.md:0-0
Timestamp: 2026-02-10T18:08:26.575Z
Learning: Applies to web/src/i18n/locales/*.json : Frontend i18n translation files must be flat JSON format with keys as Chinese source strings, located at `web/src/i18n/locales/{lang}.json`.

Learnt from: CR
Repo: QuantumNous/new-api PR: 0
File: CLAUDE.md:0-0
Timestamp: 2026-02-10T18:08:26.575Z
Learning: Applies to i18n/**/*.go : Backend internationalization uses `nicksnyder/go-i18n/v2` library with support for English (en) and Chinese (zh) languages. Translation files are located in `i18n/` directory.

@olivertzeng

Copy link
Copy Markdown
Contributor Author

我看到有关语言的列表有两个地方,一个是网站介面本身,一个是帐户的语言:

请查看截图
圖片

@olivertzeng

Copy link
Copy Markdown
Contributor Author

这是故意的吗?感觉会有点多余

@Calcium-Ion

Copy link
Copy Markdown
Member

一个是语言偏好,设置个人账户语言设定,一个是临时语言切换,不能算是多余

@olivertzeng

Copy link
Copy Markdown
Contributor Author

一个是语言偏好,设置个人账户语言设定,一个是临时语言切换,不能算是多余

了解

@olivertzeng

Copy link
Copy Markdown
Contributor Author

@Calcium-Ion 好了

@Calcium-Ion
Calcium-Ion merged commit 6597610 into QuantumNous:main Feb 11, 2026
1 check passed
@coderabbitai coderabbitai Bot mentioned this pull request Feb 13, 2026
8 tasks
hardingCheng pushed a commit to hardingCheng/new-api that referenced this pull request Feb 14, 2026
* main: (21 commits)
  fix: normalize search pagination params to avoid [object Object]
  fix: ignore header passthrough during channel tests
  fix(token-search): use TrimPrefix for sk- token normalization
  fix: rename bulk test action to skip manually disabled channels
  fix: support numeric status code mapping in ResetStatusCode
  优化: 任务日志查询速度并显示用户详情 (QuantumNous#2905)
  Merge pull request QuantumNous#2916 from worryzyy/feature/add-quota-amount-input
  feat: Improve backend multilingual support
  feat: add OpenRouter pricing support to upstream ratio sync
  feat: refactor request body handling to use BodyStorage for improved efficiency
  feat(xai): 为xAI渠道添加/v1/responses支持 (QuantumNous#2897)
  chore: remove deprecated Docker badge from README
  feat: refactor extra_body handling for improved configuration parsing
  Update README
  feat: logs cache field (QuantumNous#2920)
  feat(localization): added zh_TW (QuantumNous#2913)
  fix: update README files to improve link formatting and readability
  feat: add Aion UI link to README files
  chore(deps): bump axios from 1.12.0 to 1.13.5 in /web
  simplify language selector display to use text-only labels
  ...

# Conflicts:
#	web/src/components/layout/headerbar/LanguageSelector.jsx
ennnnny pushed a commit to ennnnny/new-api that referenced this pull request Mar 17, 2026
* feat(localization): added zh_TW

* fixed based on @coderabbitai

* updated false translation for zh_TW

* new workflow

* revert

* fixed a lot of translations

* turned most zh to zh-CN

* fallbacklang

* bruh

* eliminate ALL _

* fix: paths and other miscs thanks @Calcium-Ion

* fixed translation and temp fix for preferencessettings.js

* fixed translation error

* fixed issue about legacy support

* reverted stupid coderabbit's suggestion
@coderabbitai coderabbitai Bot mentioned this pull request Mar 31, 2026
@coderabbitai coderabbitai Bot mentioned this pull request Jun 15, 2026
11 tasks
@coderabbitai coderabbitai Bot mentioned this pull request Jul 6, 2026
11 tasks
@coderabbitai coderabbitai Bot mentioned this pull request Jul 19, 2026
11 tasks
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

2 participants