Skip to content

Add i18n support and Simplified Chinese translations - #339

Open
ManuZhu0728 wants to merge 2 commits into
openscopeproject:masterfrom
ManuZhu0728:feat/i18n
Open

ManuZhu0728 wants to merge 2 commits into
openscopeproject:masterfrom
ManuZhu0728:feat/i18n

Conversation

@ManuZhu0728

@ManuZhu0728 ManuZhu0728 commented Oct 17, 2026 •

Copy link
Copy Markdown
Contributor

This adds internationalization to the desktop and web interfaces, with English, Simplified Chinese, partial Russian translations, English fallback, and automatic language detection.

  • Adds English, Simplified Chinese, Russian and Auto options, storing the preference in the existing application configuration. Language changes apply and save immediately, independently of the settings dialog’s Save/Cancel actions.
  • Localizes settings, dialogs, torrent creation, torrent details, tables, context menus and application-generated errors. The native backend shares translation resources for tray menus, macOS menus and notification titles. Missing Russian translations, including native menu strings, fall back to English.
  • Groups translation helpers and resources under src/i18n/. Adding a language requires its JSON resource and one registration entry each in TypeScript and Rust; src/i18n/README.md documents the process. Rust stores the selected language as an enum.
  • Initializes translations before rendering localized content. The creation window receives the main window’s resolved language, theme and default trackers through window messages, without rereading configuration. The original createtorrentform chunk 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:

  • GitHub Actions — Lint passed for both the fork push and the upstream PR, including ESLint and Clippy.
  • Linux release build: npm run build -- --no-bundle passed locally.
  • Actual Linux desktop checks under GNOME/XWayland covered English, Simplified Chinese, Russian and Auto switching, language persistence, the creation window, native file/directory selection, torrent generation and saving, and native tray actions.
  • Web packaging was checked using the existing repository rules. Web interaction/text checks covered language switching and persistence, file/magnet addition and all six detail tabs.

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.

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.
Copilot AI balanced review requested due to automatic review settings October 17, 2026 16:24

Copilot AI left a comment

Copy link
Copy Markdown

Choose a reason for hiding this comment

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

Copilot was unable to review this pull request because the user who requested the review has reached their quota limit.

@qu1ck qu1ck left a comment

Copy link
Copy Markdown
Member

Choose a reason for hiding this comment

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

Thanks for working on this, looks promising!

I need to do some in-depth testing but a few general comments:

  1. Move all i18n related ts(x) files into src/i18n. Locales into src/i18n/locales/
  2. 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.
  3. 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.
  4. 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.
@ManuZhu0728

Copy link
Copy Markdown
Contributor Author

Thanks for the feedback. I’ve updated the PR to address all four points:

  1. File organization
    Moved the TypeScript i18n helpers into src/i18n/ and the locale resources into src/i18n/locales/, with the corresponding imports updated.

  2. Adding languages
    Adding a language now requires its JSON resource, one entry in the TypeScript language registry, and one entry in the Rust language declaration. The language selector, supported-language types, resource loading, and language matching derive from these registrations. Rust now stores the selected language as an enum.

    Added src/i18n/README.md describing registration, English fallback, interpolation placeholders, and plural forms.

  3. Creation window initialization and chunks
    Removed CreateTorrentApp and its separate configuration read. The creation entry registers its message listener before sending ready, receives the main window’s resolved language and current theme/default trackers, initializes i18n, and then renders the form.

    Restored the original createtorrentform chunk name and preserved the upstream lazy/Suspense structure. No build scripts were changed.

  4. Russian translations
    Migrated the existing Russian translations from my fork, adapting the keys, placeholders, and plural forms to this implementation. The translation remains partial; missing keys fall back to English, including the currently untranslated native menu strings.

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.

@ManuZhu0728
ManuZhu0728 requested a review from qu1ck October 18, 2026 13:27
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.

3 participants