feat(i18n): implement dynamic locale loading, local JSON imports, and customized window title#1043
Open
Thanhdv2007 wants to merge 1 commit into
Open
Conversation
…dd language feature
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.
Description
This Pull Request implements a comprehensive, dynamic internationalization (i18n) management system for Codex++ Manager. Instead of compile-time static translations, this system enables runtime loading, hot-swapping, and user-importing of translation resource files (
.json) directly from the disk.Key Changes
1. Backend (Rust / Tauri)
load_custom_localescommand): Scans thelocales/directory located adjacent to the executable binary. Any valid.jsonlocale files found are loaded into the frontend dynamically at startup.import_custom_localecommand): Exposes a secure Tauri API triggering a native OS file dialog. Users can select any local translation JSON file, which is then parsed, validated, and copied into the application'slocales/directory for persistence.src-tauri/src/lib.rs.2. Frontend (React / i18next)
ZH,EN,VI).position: "relative"andz-index: 50on the topbar header to prevent the dropdown from being clipped or covered by the layout view below.i18nInstance.addResourceBundle, and switches the active language immediately without requiring a restart.useEffectthat listens for language changes and updates the Tauri window title dynamically.tauri.conf.jsonasCodex++ Manager(neutral start), updating to"Codex++ 管理工具"for Chinese (ZH) and"Codex++ Manager"for English (EN), Vietnamese (VI) or any other imported language.3. Preset & Provider Localization
ProviderPresetSelector.tsxto read translation keys dynamically.presets.ts.Verification & Build Status
npm run check(TypeScript verification) - PASSEDnpm run vite:build(Vite production bundle build) - PASSEDcargo check(Rust compilation verification) - PASSED