feat(i18n): add i18n infrastructure and zh-CN localization with in-app language switching#6
Open
haomingbai wants to merge 1 commit intoAryagm:mainfrom
Open
feat(i18n): add i18n infrastructure and zh-CN localization with in-app language switching#6haomingbai wants to merge 1 commit intoAryagm:mainfrom
haomingbai wants to merge 1 commit intoAryagm:mainfrom
Conversation
…tcher - add i18n infrastructure (provider, locale registry, matcher, message catalogs) - add full zh-CN translations and catalog sync/generation workflow - add in-app language switcher with persisted locale selection - localize main UI components, layer cards/editor, welcome modal, and tooltips - localize runtime validation/errors and generated code comments in CodeViewer - default startup locale to English (saved preference still respected) - split locale config and matching logic into `locales.ts` / `locale-matcher.ts` - document how to add new translations in `README.md`
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
This PR adds a full i18n foundation to BlockDL and ships the first non-English translation (
zh-CN), including an in-app language switcher.It also refactors locale configuration/matching for easier future translation contributions and documents the translation workflow in the README.
What’s Included
zh-CNtranslation catalogsrc/i18n/locales.ts(translation-facing config)src/i18n/locale-matcher.ts(matching logic)src/i18n/i18n.tskept as a stable façadeWhy
Previously, locale switching was not practical:
This PR fixes that and makes future translations easier to add with mostly config/catalog changes.
Locale Matching Design
REGISTERED_LOCALES)Accept-Languagestyle input withq=weights is supportedValidation
npm run build✅Notes / Follow-ups
t()helpers and semantic key helpers.Checklist