Repository navigation
Add i18n support and Simplified Chinese translations - #339
ManuZhu0728 wants to merge 2 commits into
Conversation
Add English and Simplified Chinese resources and a persisted language selector with automatic locale detection. Initialize localization in the lazy-loaded main and create-torrent views, and localize dialogs, torrent details, tables, native menus, notifications, and client-side errors.
qu1ck
left a comment
There was a problem hiding this comment.
Thanks for working on this, looks promising!
I need to do some in-depth testing but a few general comments:
- Move all i18n related ts(x) files into
src/i18n. Locales intosrc/i18n/locales/ - Adding a language involves changing ~20 places across like ~7 files. Can it be simplified? Ideally it should be 1-2 lines in 1-2 files (js and rust each). Use enums where possible, especially in rust. Also add a readme in i18n folder describing how to add a new language support.
- I don't understand the purpose of
createtorrentapp. You dont need to load config there, you already get the language alongside the theme from main window through window messaging mechanism. In fact loading config from file is not reliable as config is not always immediately saved when changed. Don't worry about lazyloading it either, it doesnt matter if it's entrypoint is large because it only appears in app. Also changing the webchunk name breaks my build scripts. - No russian strings? I seem to recall your fork had russian too. It's ok if they are incomplete, I can provide missing russian translations later.
Group i18n helpers and locale resources under src/i18n. Derive language support from one TypeScript registry and one Rust enum declaration, and document how to add a language. Initialize the creation window from the main window message, remove its separate configuration read, and restore the createtorrentform chunk name. Migrate the fork's partial Russian translations with English fallback. Refresh the localized generic window title when no active server tab exists.
|
Thanks for the feedback. I’ve updated the PR to address all four points:
The Linux release build, TypeScript checks, ESLint, and 26 local regression tests pass. I also checked the existing web packaging rules and exercised the actual Linux application under GNOME/XWayland: language switching and persistence, the creation window, native file/directory selection, torrent generation and saving, and tray actions. During these checks, I found and fixed a small i18n issue where the main window title retained the previous language when no server was configured. Windows/macOS and the native Wayland backend remain unverified. |
This adds internationalization to the desktop and web interfaces, with English, Simplified Chinese, partial Russian translations, English fallback, and automatic language detection.
src/i18n/. Adding a language requires its JSON resource and one registration entry each in TypeScript and Rust;src/i18n/README.mddocuments the process. Rust stores the selected language as an enum.createtorrentformchunk name is preserved. Resources use i18next JSON v4 plural forms.Chinese wording and the partial Russian translations follow the existing translations in my fork. Existing option values, RPC operations, user-provided text and daemon diagnostics are preserved.
Validation for
87f58f0:npm run build -- --no-bundlepassed locally.Validation coverage was limited to Linux under XWayland and one web browser. Web language preferences were emulated, and test torrents were added paused. Windows/macOS UI, native Wayland clients, other browser engines, successful transfers, completion notifications and daemon persistence remain unverified. The Web checks do not establish pixel-level layout or piece-canvas rendering. Russian translations remain partial and have not had native-speaker proofreading.
Already-open torrent-creation windows retain their language until reopened. Native file-picker controls follow the system locale.
AI assistance
This contribution was developed using OpenAI Codex with the GPT-6.1 Sol model throughout the process, including implementation, translation drafting, code review, execution of build and regression checks, and preparation of this PR description. Chinese wording was checked against the existing translations in my fork. The validation scope and remaining limitations are documented above.