Conversation
- Add src/locales/zh-Hans/translation.json covering the full en key set (terminology aligned with the LibreChat main zh-Hans translation) - Register zh-Hans in i18n init with LibreChat-style locale normalization and detection (stored choice > navigator, alias mapping zh/zh-CN/zh-SG), replacing the browser-languagedetector whose nonExplicitSupportedLngs handling rejected zh-Hans - Render the SSR loading shell in the default locale deterministically and suppress the expected hydration text mismatch - Guard en/zh key-set and placeholder parity plus language switching in locales.test.ts
- Add a language row with a Select dropdown (English / 中文(简体)) below the theme row, reusing the existing click-ui Select component - Persist the choice via i18nextLng (the detection cache key) and keep document.documentElement.lang in sync
- CreateUserDialog role select rendered raw SystemRoles values (USER/ADMIN); use localized labels instead - Audit log target-type filter rendered raw PrincipalType enum values; map them to localized labels
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Add this suggestion to a batch that can be applied as a single commit.This suggestion is invalid because no changes were made to the code.Suggestions cannot be applied while the pull request is closed.Suggestions cannot be applied while viewing a subset of changes.Only one suggestion per line can be applied in a batch.Add this suggestion to a batch that can be applied as a single commit.Applying suggestions on deleted lines is not supported.You must change the existing code in this line in order to create a valid suggestion.Outdated suggestions cannot be applied.This suggestion has been applied or marked resolved.Suggestions cannot be applied from pending reviews.Suggestions cannot be applied on multi-line comments.Suggestions cannot be applied while the pull request is queued to merge.Suggestion cannot be applied right now. Please check back later.
Summary
with terminology aligned to the LibreChat main zh-Hans translation (shared
com_*strings reuse the official wording so the panel and chat UI read consistently)
Selectdropdown (English /中文(简体)) below the theme row, persisting the choice via the
i18nextLngcache key and keeping
document.documentElement.langin syncshowed
USER/ADMIN; audit-log target-type filter showed raw principal types)Locale detection
Detection is adapted from the LibreChat client implementation
(
client/src/locales/i18n.ts): explicit stored choice wins, then navigator language,normalized through an alias table (
zh,zh-CN,zh-SG→zh-Hans). This replacesi18next-browser-languagedetector, whosenonExplicitSupportedLngshandling stripszh-Hanstozhbefore the whitelist check — meaning a registeredzh-Hanslocalecould never actually be resolved.
SSR renders the pre-hydration loading shell in the default locale deterministically,
and the shell text suppresses the expected hydration mismatch (
<html lang>alreadyhad
suppressHydrationWarning).Tests
src/locales/locales.test.tsguards en/zh key-set parity, interpolationplaceholder parity, language switching (incl.
zh-CN/zhresolution), andlocale normalization
bun run test, 831 tests)Notes for reviewers
Three commits, intentionally split for reviewability:
🌐 feat: Add Simplified Chinese (zh-Hans) locale🌐 feat: Add language setting to settings dialog🐛 fix: Localize role and target type dropdown optionsHappy to adjust the translation wording or split/merge commits as preferred.