Skip to content

feat(i18n): add live launcher language switching - #43

Draft
ItzJerry317 wants to merge 2 commits into
Axolotl-Launcher:mainfrom
ItzJerry317:feat/launcher-i18n
Draft

ItzJerry317 wants to merge 2 commits into
Axolotl-Launcher:mainfrom
ItzJerry317:feat/launcher-i18n

Conversation

@ItzJerry317

@ItzJerry317 ItzJerry317 commented Nov 28, 2026 •

Copy link
Copy Markdown
Collaborator

Summary

  • Add bundled English and Simplified Chinese desktop catalogs and a language picker that updates the UI without restarting or discarding unsaved input.
  • Keep translation lookup, catalogs, and UI refresh in the frontend. Persist only the language preference in settings; Minecraft keeps its separate override and can follow the launcher language when unset.
  • Add Crowdin configuration and maintainer setup instructions. Live synchronization has not been enabled.

Verification

  • Windows desktop build, workspace Clippy, and formatting passed before push.
  • Workspace cargo test --workspace --locked: 557 passed, 7 ignored. cargo-nextest was unavailable.
  • On Windows, verified switching both ways, restoring the selected language after restart, and retaining unsaved form input during a switch.

Some lower-level diagnostics and debug text remain in English.

Sourcery 总结

在整个桌面启动器中支持实时切换英语和简体中文,同时保留独立的游戏语言偏好设置和未保存的界面状态。

新功能:

  • 添加英语和简体中文桌面语言包,并提供语言选择器,切换启动器界面时无需重启,也不会丢失未保存的输入内容。
  • 独立保存启动器语言设置,不受 Minecraft 语言设置影响;如果未配置覆盖选项,Minecraft 将使用启动器语言。

增强功能:

  • 集中处理前端翻译查询、插值、语言包验证,以及启动器面板和状态消息的实时界面刷新。

文档:

  • 记录桌面翻译规范、语言包验证方式和 Crowdin 维护者设置方法。

测试:

  • 增加对语言偏好持久化、语言包完整性、命名参数和翻译查询行为的测试覆盖。

杂项:

  • 添加 Crowdin 配置,用于管理内置英语源语言和简体中文翻译。
Original summary in English

Sourcery 摘要

支持在桌面启动器中实时切换英语和简体中文,同时保留独立的游戏语言设置和未保存的界面状态。

新功能:

  • 添加内置的英语和简体中文启动器语言目录,并提供语言选择器,可切换桌面界面,无需重启或丢失未保存的输入。
  • 将启动器语言与 Minecraft 的语言偏好设置分开保存;若未设置覆盖项,Minecraft 可跟随启动器语言。

增强:

  • 集中管理前端翻译查找、插值、语言目录验证,以及启动器面板、状态和控件的实时界面刷新。

文档:

  • 记录桌面端翻译规范、语言目录验证方式,以及 Crowdin 维护者配置步骤。

测试:

  • 增加对语言偏好持久化、语言目录一致性、命名参数和翻译查找的测试覆盖。

杂项:

  • 添加 Crowdin 配置,用于管理内置的英语源语言和简体中文翻译。
Original summary in English

Sourcery 总结

在桌面启动器中启用英语和简体中文的实时切换,同时保留独立的游戏语言设置和未保存的界面状态。

新功能:

  • 添加内置的英语和简体中文启动器语言包,并提供语言选择器,让用户无需重启即可切换桌面界面语言。

错误修复:

  • 如果没有单独配置游戏语言覆盖项,允许 Minecraft 使用所选的启动器语言。

改进:

  • 集中处理前端翻译查找、插值、语言包验证和界面实时刷新,同时保持启动器和 Minecraft 的语言偏好相互独立。

文档:

  • 记录桌面翻译规范、语言包验证方法,以及 Crowdin 维护者配置步骤。

测试:

  • 增加对语言偏好持久化、语言包完整性、命名参数和翻译查找的测试覆盖。

杂项:

  • 添加 Crowdin 配置,用于管理内置的启动器翻译。
Original summary in English

Summary by Sourcery

Enable live English and Simplified Chinese switching across the desktop launcher while preserving independent game-language settings and unsaved UI state.

New Features:

  • Add bundled English and Simplified Chinese launcher catalogs with a language picker for switching the desktop UI without restarting.

Bug Fixes:

  • Allow Minecraft to follow the selected launcher language when no separate game-language override is configured.

Enhancements:

  • Centralize frontend translation lookup, interpolation, catalog validation, and live UI refresh while keeping launcher and Minecraft language preferences independent.

Documentation:

  • Document desktop translation conventions, catalog validation, and Crowdin maintainer setup.

Tests:

  • Add coverage for language preference persistence, catalog completeness, named arguments, and translation lookup.

Chores:

  • Add Crowdin configuration for managing bundled launcher translations.

@github-actions github-actions Bot added module: domain Domain identifiers and base types module: frontend State, layout and window wiring module: repository Build, tooling and CI module: state Application state and persistence version: 0.1.0 Version a report or pull request belongs to status: unreviewed No maintainer has reviewed this yet labels Nov 28, 2026
@sourcery-ai

sourcery-ai Bot commented Nov 28, 2026 •

Copy link
Copy Markdown

审查者指南

数据结构

添加持久化的启动器语言设置,并将每种受支持的界面语言映射到对应的 Minecraft 语言代码,同时保留独立的游戏语言覆盖设置。

  • apps/core/src/desktop/launching.rs L33(已删除的行)、L68-74
  • apps/core/state/src/lib.rs L22-23
  • apps/core/state/src/settings.rs L60-62, L95-114, L139

实现

实现前端目录查找、回退和插值,并在刷新已打开窗口时更新当前组件的区域设置。

  • apps/frontend/src/i18n.rs L1-93
  • apps/ui/src/lib.rs L30

用户界面

添加语言选择器、保存所选语言、在数据目录重新加载后恢复选择器,并在不重建视图的情况下刷新依赖语言的占位文本和选择器。

  • apps/frontend/src/panel/environment.rs L43-49, L79-95, L214-224(另有 19 处小改动)
  • apps/frontend/src/panel/language.rs L1-157
  • apps/frontend/src/panel/mod.rs L17-345(另有 7 处小改动)
  • apps/frontend/src/panel/service_sources.rs L36-49, L110-115, L138-143(另有 8 处小改动)

翻译启动器的导航、账户、活动、实例、启动、设置、Java、配置文件创建、整合包、安装和下载调试界面及状态消息。

  • apps/frontend/src/installation_progress.rs L6-23
  • apps/frontend/src/installations.rs L20-21, L31-34
  • apps/frontend/src/launches.rs L9-10, L35-39
  • apps/frontend/src/lib.rs L21-24, L176-191, L197-208(另有 2 处小改动)
  • apps/frontend/src/modpacks/view.rs L211-216(另有 9 处小改动)
  • apps/frontend/src/modpacks/view/controls.rs L4-31(另有 4 处小改动)
  • apps/frontend/src/modpacks/view/manual.rs L13-135(另有 5 处小改动)
  • apps/frontend/src/modpacks/view/progress.rs L4-5, L27-42, L47-50
  • apps/frontend/src/panel/accounts/render.rs L26-37, L115-126, L345-355(另有 17 处小改动)
  • apps/frontend/src/panel/accounts/third_party.rs L287-291(另有 4 处小改动)
  • apps/frontend/src/panel/activity.rs L108-112, L117-121(另有 2 处小改动)
  • apps/frontend/src/panel/download_debug.rs L58-67(另有 7 处小改动)
  • apps/frontend/src/panel/download_debug/batch.rs L233-237(另有 3 处小改动)
  • apps/frontend/src/panel/instances.rs L234-238, L252-256, L329-336(另有 3 处小改动)
  • apps/frontend/src/panel/instances/actions.rs L280-284
  • apps/frontend/src/panel/instances/instance_row.rs L13-18, L202-216, L221-227(另有 12 处小改动)
  • apps/frontend/src/panel/instances/launch/render.rs L30-38(另有 5 处小改动)
  • apps/frontend/src/panel/java/memory.rs L97-104(另有 5 处小改动)
  • apps/frontend/src/panel/java/memory/editor.rs L144-148(另有 5 处小改动)
  • apps/frontend/src/panel/java/mod.rs L20-412(另有 6 处小改动)
  • apps/frontend/src/panel/profile_creation/view.rs L20-24, L65-83, L191-196(另有 13 处小改动)
  • apps/frontend/src/panel/shell.rs L30-35, L120-133, L157-161(另有 6 处小改动)

配置

配置 Crowdin,使其在导出捆绑的英文源目录的同时导出简体中文目录,并将这两个目录纳入 REUSE 分类。

  • REUSE.toml L71
  • crowdin.yml L1-9

文档

说明目录键和插值的约定、Crowdin 设置,以及目录验证测试命令。

  • CONTRIBUTING.md L402-420

测试

验证启动器语言设置的默认值、持久化行为(独立于 Minecraft 语言覆盖设置),以及是否按预期的区域设置代码进行序列化。

  • tests/apps/core/state/src/settings.rs L204-229

检查翻译目录键和参数的一致性、区域设置查找及插值行为。

  • tests/apps/frontend/src/i18n.rs L1-49

锁定文件和供应商代码

在工作区锁定文件中记录新增的前端 JSON 依赖项。

  • Cargo.lock L667

忽略开发工作流中新增的生成文件或本地文件。

  • .gitignore L40-42

添加加载捆绑目录所需的前端 JSON 解析依赖项。

  • apps/frontend/Cargo.toml L18

其他更改

未归入其他类别的文件。

  • apps/frontend/locales/en-US.json L1-178
  • apps/frontend/locales/zh-CN.json L1-178

提示和命令

与 Sourcery 交互

  • 触发新审查: 在拉取请求中评论 @sourcery-ai review。
  • 继续讨论: 直接回复 Sourcery 的审查评论。
  • 根据审查评论创建 GitHub issue: 回复审查评论,请 Sourcery 根据该评论创建 issue。你也可以在审查评论中回复 @sourcery-ai issue 来创建 issue。
  • 生成拉取请求标题: 在拉取请求标题的任意位置写入 @sourcery-ai,即可随时生成标题。你也可以在拉取请求中评论 @sourcery-ai title,随时生成或重新生成标题。
  • 生成拉取请求摘要: 在拉取请求正文的任意位置写入 @sourcery-ai summary,即可在指定位置随时生成 PR 摘要。你也可以在拉取请求中评论 @sourcery-ai summary,随时生成或重新生成摘要。
  • 生成审查者指南: 在拉取请求中评论 @sourcery-ai guide,即可随时生成或重新生成审查者指南。
  • 解决所有 Sourcery 评论: 在拉取请求中评论 @sourcery-ai resolve,即可解决所有 Sourcery 评论。如果你已处理完所有评论且不想再看到它们,这会很有用。
  • 忽略所有 Sourcery 审查: 在拉取请求中评论 @sourcery-ai dismiss,即可忽略所有现有的 Sourcery 审查。如果你想重新开始一次审查,这尤其有用——别忘了评论 @sourcery-ai review 来触发新审查!

自定义使用体验

访问你的控制面板,以便:

  • 启用或停用审查功能,例如 Sourcery 生成的拉取请求摘要、审查者指南等。
  • 更改审查语言。
  • 添加、移除或编辑自定义审查说明。
  • 调整其他审查设置。

获取帮助

Original review guide in English

Reviewer's Guide

Data structures

Add the persisted launcher-language setting and map each supported interface language to its Minecraft language code, while retaining the separate game-language override.

  • apps/core/src/desktop/launching.rs L33 (removed lines), L68-74
  • apps/core/state/src/lib.rs L22-23
  • apps/core/state/src/settings.rs L60-62, L95-114, L139

Implementation

Implement frontend catalog lookup, fallback and interpolation, and update the active component locale while refreshing open windows.

  • apps/frontend/src/i18n.rs L1-93
  • apps/ui/src/lib.rs L30

UI

Add the language picker, persist selections, restore the picker after data-directory reloads, and refresh language-dependent placeholders and selectors without rebuilding the view.

  • apps/frontend/src/panel/environment.rs L43-49, L79-95, L214-224 (+19 small edits)
  • apps/frontend/src/panel/language.rs L1-157
  • apps/frontend/src/panel/mod.rs L17-345 (7 small edits)
  • apps/frontend/src/panel/service_sources.rs L36-49, L110-115, L138-143 (+8 small edits)

Translate the launcher’s navigation, account, activity, instance, launch, settings, Java, profile-creation, modpack, installation, and download-debug interfaces and status messages.

  • apps/frontend/src/installation_progress.rs L6-23
  • apps/frontend/src/installations.rs L20-21, L31-34
  • apps/frontend/src/launches.rs L9-10, L35-39
  • apps/frontend/src/lib.rs L21-24, L176-191, L197-208 (+2 small edits)
  • apps/frontend/src/modpacks/view.rs L211-216 (+9 small edits)
  • apps/frontend/src/modpacks/view/controls.rs L4-31 (4 small edits)
  • apps/frontend/src/modpacks/view/manual.rs L13-135 (5 small edits)
  • apps/frontend/src/modpacks/view/progress.rs L4-5, L27-42, L47-50
  • apps/frontend/src/panel/accounts/render.rs L26-37, L115-126, L345-355 (+17 small edits)
  • apps/frontend/src/panel/accounts/third_party.rs L287-291 (+4 small edits)
  • apps/frontend/src/panel/activity.rs L108-112, L117-121 (+2 small edits)
  • apps/frontend/src/panel/download_debug.rs L58-67 (+7 small edits)
  • apps/frontend/src/panel/download_debug/batch.rs L233-237 (+3 small edits)
  • apps/frontend/src/panel/instances.rs L234-238, L252-256, L329-336 (+3 small edits)
  • apps/frontend/src/panel/instances/actions.rs L280-284
  • apps/frontend/src/panel/instances/instance_row.rs L13-18, L202-216, L221-227 (+12 small edits)
  • apps/frontend/src/panel/instances/launch/render.rs L30-38 (+5 small edits)
  • apps/frontend/src/panel/java/memory.rs L97-104 (+5 small edits)
  • apps/frontend/src/panel/java/memory/editor.rs L144-148 (+5 small edits)
  • apps/frontend/src/panel/java/mod.rs L20-412 (6 small edits)
  • apps/frontend/src/panel/profile_creation/view.rs L20-24, L65-83, L191-196 (+13 small edits)
  • apps/frontend/src/panel/shell.rs L30-35, L120-133, L157-161 (+6 small edits)

Configuration

Configure Crowdin to export Simplified Chinese alongside the bundled English source catalog, and classify both catalogs for REUSE.

  • REUSE.toml L71
  • crowdin.yml L1-9

Documentation

Document catalog key and interpolation conventions, Crowdin setup, and the catalog validation test command.

  • CONTRIBUTING.md L402-420

Tests

Verify the launcher-language setting defaults, persists independently of the Minecraft override, and serializes with the expected locale code.

  • tests/apps/core/state/src/settings.rs L204-229

Check translation catalog key and argument parity, locale lookup, and interpolation behavior.

  • tests/apps/frontend/src/i18n.rs L1-49

Lock files and vendored code

Record the new frontend JSON dependency in the workspace lockfile.

  • Cargo.lock L667

Ignore generated or local files introduced for the development workflow.

  • .gitignore L40-42

Add the frontend JSON parsing dependency needed to load the bundled catalogs.

  • apps/frontend/Cargo.toml L18

Other changes

Files not grouped.

  • apps/frontend/locales/en-US.json L1-178
  • apps/frontend/locales/zh-CN.json L1-178

Tips and commands

Interacting with Sourcery

  • Trigger a new review: Comment @sourcery-ai review on the pull request.
  • Continue discussions: Reply directly to Sourcery's review comments.
  • Generate a GitHub issue from a review comment: Ask Sourcery to create an
    issue from a review comment by replying to it. You can also reply to a
    review comment with @sourcery-ai issue to create an issue from it.
  • Generate a pull request title: Write @sourcery-ai anywhere in the pull
    request title to generate a title at any time. You can also comment
    @sourcery-ai title on the pull request to (re-)generate the title at any time.
  • Generate a pull request summary: Write @sourcery-ai summary anywhere in
    the pull request body to generate a PR summary at any time exactly where you
    want it. You can also comment @sourcery-ai summary on the pull request to
    (re-)generate the summary at any time.
  • Generate reviewer's guide: Comment @sourcery-ai guide on the pull
    request to (re-)generate the reviewer's guide at any time.
  • Resolve all Sourcery comments: Comment @sourcery-ai resolve on the
    pull request to resolve all Sourcery comments. Useful if you've already
    addressed all the comments and don't want to see them anymore.
  • Dismiss all Sourcery reviews: Comment @sourcery-ai dismiss on the pull
    request to dismiss all existing Sourcery reviews. Especially useful if you
    want to start fresh with a new review - don't forget to comment
    @sourcery-ai review to trigger a new review!

Customizing Your Experience

Access your dashboard to:

  • Enable or disable review features such as the Sourcery-generated pull request
    summary, the reviewer's guide, and others.
  • Change the review language.
  • Add, remove or edit custom review instructions.
  • Adjust other review settings.

Getting Help

Assisted-by: OpenAI Codex
Signed-off-by: ItzJerry <85010676+ItzJerry317@users.noreply.github.com>
@github-actions github-actions Bot added the module: ui Palette and gpui-kit vocabulary label Nov 28, 2026
@ItzJerry317
ItzJerry317 marked this pull request as ready for review November 28, 2026 11:14
@qodo-free-for-open-source-projects

qodo-free-for-open-source-projects Bot commented Nov 28, 2026 •

Copy link
Copy Markdown

PR Summary by Qodo

Add live English and Simplified Chinese launcher switching

✨ Enhancement 🧪 Tests 📝 Documentation ⚙️ Configuration changes 🕐 40+ Minutes

Grey Divider

AI Description

• Add bundled English and Simplified Chinese catalogs with a language picker that preserves unsaved
 input.
• Persist launcher language separately; Minecraft follows it only when no game-language override is
 set.
• Document translation maintenance and add catalog, interpolation, and settings persistence tests.
Merge Risk 🟢 Low

Blast radius 🟡 Medium 💥 2 capabilities

  • 2 affected capabilities within one bounded functional scope: launcher language and game-language integration.
  • The changed catalog lookup and locale refresh feed the launcher’s existing accounts, settings, installation, modpack, Java, instance, activity, and navigation surfaces; these are presentation outcomes within one bounded launcher integration.
  • The persisted launcher preference and launch fallback form one bounded preference-to-launch behavior: settings supply a language code to launch preparation, while explicit game language remains an independent override.
Sources

apps/frontend/src/i18n.rs[12-21]

const ENGLISH: &str = include_str!("../locales/en-US.json");
const CHINESE: &str = include_str!("../locales/zh-CN.json");

type Catalog = BTreeMap<String, String>;
static EN: LazyLock<Catalog> = LazyLock::new(|| catalog(ENGLISH));
static ZH: LazyLock<Catalog> = LazyLock::new(|| catalog(CHINESE));

fn catalog(json: &str) -> Catalog {
    serde_json::from_str(json).expect("bundled desktop translation catalog must be valid JSON")
}

apps/core/src/desktop/launching.rs[65-74]

        let language = settings
            .and_then(|settings| normalize_game_language(&settings.default_game_language))
            .filter(|language| !language.is_empty())
            .unwrap_or_else(|| {
                settings
                    .map(|settings| settings.launcher_language)
                    .unwrap_or_default()
                    .minecraft_code()
                    .to_owned()
            });
Behavioral complexity 🟡 Medium 🧩 Compatibility cases, Interacting branches

  • Before, each affected surface used fixed English strings.
  • After, it selects one of two catalogs, falls back from a missing translation to English, interpolates named values, and refreshes live controls.
  • The new correctness conditions are catalog-key/argument parity, valid JSON, language-consistent dynamic placeholders, and refresh consistency across existing panels.
  • The old rendering branches are mostly extracted into translation keys rather than newly complex algorithms.
Sources

apps/frontend/src/i18n.rs[12-21]

const ENGLISH: &str = include_str!("../locales/en-US.json");
const CHINESE: &str = include_str!("../locales/zh-CN.json");

type Catalog = BTreeMap<String, String>;
static EN: LazyLock<Catalog> = LazyLock::new(|| catalog(ENGLISH));
static ZH: LazyLock<Catalog> = LazyLock::new(|| catalog(CHINESE));

fn catalog(json: &str) -> Catalog {
    serde_json::from_str(json).expect("bundled desktop translation catalog must be valid JSON")
}
Potential damage 🟢 Low 🩹 Cosmetic

  • A translation lookup, missing key, malformed catalog, or refresh mistake would primarily show incorrect, fallback, or untranslated interface text.
  • The underlying operations and stored data are unchanged.
  • Reverting the frontend/catalog changes restores the prior English copy; a user can also switch back to English if the application remains usable.
Sources

apps/frontend/src/i18n.rs[12-21]

const ENGLISH: &str = include_str!("../locales/en-US.json");
const CHINESE: &str = include_str!("../locales/zh-CN.json");

type Catalog = BTreeMap<String, String>;
static EN: LazyLock<Catalog> = LazyLock::new(|| catalog(ENGLISH));
static ZH: LazyLock<Catalog> = LazyLock::new(|| catalog(CHINESE));

fn catalog(json: &str) -> Catalog {
    serde_json::from_str(json).expect("bundled desktop translation catalog must be valid JSON")
}
Assessed commit bd74338
Diagram

graph TD
  Picker["Language picker"] --> Settings["Persisted settings"] --> Active["Active locale"] --> Catalogs["Bundled catalogs"] --> Views["Launcher views"]
  Settings --> Launch["Minecraft launch"]
  Active --> Kit["Component locale"] --> Views
Loading
High-Level Assessment

The following are alternative approaches to this PR:

1. Adopt a localization framework
  • ➕ Provides established facilities for pluralization and additional locales.
  • ➕ Could reduce custom catalog and interpolation code as translation needs grow.
  • ➖ Adds a dependency and integration work for GPUI rendering.
  • ➖ Offers limited benefit for two bundled catalogs with simple named arguments.

Recommendation: Keep the frontend-owned catalogs and render-time lookup for this two-language scope: they support live switching without recreating stateful views. Reconsider a localization framework if pluralization or substantially more locales become requirements.

Files changed (39) +1236 / -310

Enhancement (33) +1131 / -309
launching.rsUse launcher language as the game-language fallback +7/-3

Use launcher language as the game-language fallback

• Preserves an explicit Minecraft language override; otherwise derives the game language from the configured launcher language instead of a fixed English constant.

apps/core/src/desktop/launching.rs

lib.rsExport the launcher language setting type +2/-2

Export the launcher language setting type

• Re-exports LauncherLanguage for use by the frontend and launch code.

apps/core/state/src/lib.rs

settings.rsPersist an independent launcher language preference +24/-0

Persist an independent launcher language preference

• Adds an English-defaulting launcher language enum and settings field, with Minecraft language-code mappings for fallback behavior.

apps/core/state/src/settings.rs

en-US.jsonAdd the English desktop source catalog +178/-0

Add the English desktop source catalog

• Defines feature-scoped English strings for navigation, settings, accounts, installation, instances, modpacks, and debug controls.

apps/frontend/locales/en-US.json

zh-CN.jsonAdd the Simplified Chinese desktop catalog +178/-0

Add the Simplified Chinese desktop catalog

• Provides translations matching the English catalog's keys and named arguments.

apps/frontend/locales/zh-CN.json

i18n.rsCentralize frontend translation and active locale +93/-0

Centralize frontend translation and active locale

• Embeds both catalogs, provides translation lookup and named-argument interpolation, and refreshes windows when the application locale changes. Also synchronizes the built-in component locale.

apps/frontend/src/i18n.rs

installation_progress.rsTranslate game installation stages +15/-9

Translate game installation stages

• Resolves installation stage messages in the active language, including interpolated download counts.

apps/frontend/src/installation_progress.rs

installations.rsRender installation status in the active language +5/-3

Render installation status in the active language

• Looks up running and completed installation messages when requested, while retaining existing failure details.

apps/frontend/src/installations.rs

launches.rsTranslate Minecraft launch status +6/-4

Translate Minecraft launch status

• Resolves starting, running, and exited messages against the current locale instead of storing English presentation text.

apps/frontend/src/launches.rs

lib.rsInitialize locale from settings at startup +32/-20

Initialize locale from settings at startup

• Sets the active language before opening the main window. Moves settings-origin notice formatting to render time so notices can reflect a language switch.

apps/frontend/src/lib.rs

view.rsLocalize modpack import controls +18/-13

Localize modpack import controls

• Translates import actions, optional-file counts, file-picker titles, and progress labels during rendering.

apps/frontend/src/modpacks/view.rs

controls.rsLocalize modpack helper controls +6/-5

Localize modpack helper controls

• Passes the active application context to the data-pack notice and restricted-download checkbox.

apps/frontend/src/modpacks/view/controls.rs

manual.rsLocalize manual modpack download UI +7/-5

Localize manual modpack download UI

• Translates manual-file headings, links, file-selection buttons, and picker titles.

apps/frontend/src/modpacks/view/manual.rs

progress.rsTranslate modpack installation progress +20/-14

Translate modpack installation progress

• Looks up pack and game preparation states at display time and interpolates processed-file counts.

apps/frontend/src/modpacks/view/progress.rs

render.rsLocalize account controls and identity labels +57/-41

Localize account controls and identity labels

• Translates account forms, sign-in controls, provider descriptions, persistence labels, and device-code text using the current locale.

apps/frontend/src/panel/accounts/render.rs

third_party.rsTranslate third-party account sign-in controls +8/-6

Translate third-party account sign-in controls

• Uses catalog strings for third-party sign-in, profile selection, submission, and cancellation.

apps/frontend/src/panel/accounts/third_party.rs

activity.rsTranslate activity panel controls +13/-3

Translate activity panel controls

• Localizes the activity heading, empty state, and clear action.

apps/frontend/src/panel/activity.rs

download_debug.rsLocalize download probe controls and status +16/-11

Localize download probe controls and status

• Translates probe labels, actions, validation feedback, and status messages at display time.

apps/frontend/src/panel/download_debug.rs

batch.rsTranslate batch download probe controls +6/-4

Translate batch download probe controls

• Localizes the batch URL field, accessibility hint, and start and cancel actions.

apps/frontend/src/panel/download_debug/batch.rs

environment.rsAdd language picker and localize environment settings +51/-34

Add language picker and localize environment settings

• Places the launcher language control in settings and translates environment labels, origin descriptions, and feedback. Refreshes the game-language placeholder without replacing its input state.

apps/frontend/src/panel/environment.rs

instances.rsLocalize instance panel headings and inputs +17/-8

Localize instance panel headings and inputs

• Translates the instance list's heading and empty state plus offline-player input labels.

apps/frontend/src/panel/instances.rs

actions.rsPass locale to launch activity messages +5/-1

Pass locale to launch activity messages

• Formats launch activity entries using the locale-aware launch status message.

apps/frontend/src/panel/instances/actions.rs

instance_row.rsLocalize instance row actions and statuses +38/-29

Localize instance row actions and statuses

• Translates selection, installation, launch, and missing-version text, resolving status messages during rendering.

apps/frontend/src/panel/instances/instance_row.rs

render.rsTranslate launch diagnostics controls +13/-7

Translate launch diagnostics controls

• Localizes the diagnostics heading, inspection actions, loading state, and no-selection guidance.

apps/frontend/src/panel/instances/launch/render.rs

memory.rsLocalize global Minecraft memory settings +14/-11

Localize global Minecraft memory settings

• Translates memory labels, allocation summaries, and the title and automatic option passed to the editor.

apps/frontend/src/panel/java/memory.rs

editor.rsTranslate memory editor controls +12/-6

Translate memory editor controls

• Uses catalog strings for the maximum-heap label, guidance, and dialog actions.

apps/frontend/src/panel/java/memory/editor.rs

mod.rsTranslate Java management actions +8/-6

Translate Java management actions

• Localizes the Java section and its add, discovery, preference, and removal controls.

apps/frontend/src/panel/java/mod.rs

language.rsAdd persistent live language picker +157/-0

Add persistent live language picker

• Adds a native-language picker that saves the preference before changing the active locale. On a successful switch it refreshes windows, placeholders, and source options without recreating input state; on save failure it restores the selection.

apps/frontend/src/panel/language.rs

mod.rsWire language selection into the root view +9/-1

Wire language selection into the root view

• Creates the picker with the root view and reapplies the loaded language when the data root is reloaded.

apps/frontend/src/panel/mod.rs

view.rsLocalize instance creation form +47/-32

Localize instance creation form

• Translates form fields, version-selection placeholders, search hints, retry controls, and empty states.

apps/frontend/src/panel/profile_creation/view.rs

service_sources.rsRefresh translated source options on language changes +35/-11

Refresh translated source options on language changes

• Builds source-picker options from the active catalog and replaces their displayed items after a switch while retaining the selected preference. Also translates source settings labels.

apps/frontend/src/panel/service_sources.rs

shell.rsLocalize navigation and visible progress +33/-20

Localize navigation and visible progress

• Translates navigation, section titles, reload controls, and progress rows. Derives settings-origin notices during rendering so they follow the active language.

apps/frontend/src/panel/shell.rs

lib.rsExpose built-in component locale setter +1/-0

Expose built-in component locale setter

• Re-exports the UI kit's locale setter for the frontend language coordinator.

apps/ui/src/lib.rs

Tests (2) +75 / -0
settings.rsTest launcher language persistence and independence +26/-0

Test launcher language persistence and independence

• Checks the English default, serialized Chinese preference, Minecraft language-code mapping, and preservation of an explicit game-language override.

tests/apps/core/state/src/settings.rs

i18n.rsTest catalog parity and translation helpers +49/-0

Test catalog parity and translation helpers

• Checks nonempty matching keys and named arguments across catalogs, language-specific lookup, and safe interpolation of reordered arguments.

tests/apps/frontend/src/i18n.rs

Documentation (1) +19 / -0
CONTRIBUTING.mdDocument desktop translation maintenance +19/-0

Document desktop translation maintenance

• Explains catalog keys, named arguments, validation, and the maintainer steps for connecting Crowdin. Clarifies that synchronization is not enabled by this change.

CONTRIBUTING.md

Other (3) +11 / -1
REUSE.tomlCover locale JSON files in license annotations +1/-1

Cover locale JSON files in license annotations

• Adds bundled locale catalogs to the existing JSON copyright and license annotation.

REUSE.toml

Cargo.tomlAdd JSON support for bundled catalogs +1/-0

Add JSON support for bundled catalogs

• Adds serde_json as a frontend dependency for parsing embedded translation catalogs.

apps/frontend/Cargo.toml

crowdin.ymlConfigure file-based Crowdin catalog paths +9/-0

Configure file-based Crowdin catalog paths

• Declares the bundled English catalog as the source and Simplified Chinese as the export language; it does not enable synchronization.

crowdin.yml

@qodo-free-for-open-source-projects

Copy link
Copy Markdown

Code Review by Qodo

🐞 Bugs (4) 📘 Rule violations (1) 📜 Skill insights (0)

Grey Divider


Remediation recommended

1. Language saves bypass core services 📘 Rule violation ⚙ Maintainability
Description
save_launcher_language in apps/frontend/src/panel/language.rs calls update_settings directly,
so the UI layer writes launcher_language to the settings file, following the existing persistence
pattern in environment.rs. Every confirmation in the language picker runs this write path, so any
later change to how settings are persisted must also be applied in the frontend rather than in one
core service.
Code

apps/frontend/src/panel/language.rs[R104-106]

+        match update_settings(paths.path(DataPath::Root), |data| {
+            data.launcher_language = selected
+        }) {
Evidence
The frontend calls `update_settings(paths.path(DataPath::Root), |data| data.launcher_language =
selected)` directly, so the persistence logic sits in the UI layer. This is the write path for the
new language preference, which the rule says should be owned by core services.

AGENTS.md: Route Desktop Operations Through Typed Core Services
apps/frontend/src/panel/language.rs[104-106]

Agent prompt
The issue below was found during a code review. Follow the provided context and guidance below and implement a solution

## Issue description
The desktop language picker persists `launcher_language` by calling `update_settings` directly from `apps/frontend/src/panel/language.rs`. Compliance rule 5 requires the frontend to handle UI tasks without persisting launcher data, so this write should go through a typed core service.

## Fix Focus Areas
- apps/frontend/src/panel/language.rs[101-120]
- apps/frontend/src/panel/environment.rs[296-340]

## Recommended Fix
Add a core function, for example `set_launcher_language(root: &Path, language: LauncherLanguage) -> Result<SettingsData, SettingsError>`, in `apps/core/state/src/settings.rs` or the desktop service layer. It should wrap `update_settings`. Change `save_launcher_language` to call that function and keep only the UI refresh and error display in the frontend. If the existing `environment.rs` persistence is also in scope, route it through the same service.

ⓘ Copy this prompt and use it to remediate the issue with your preferred AI generation tools


2. Language switching clears source selections 🐞 Bug ≡ Correctness
Description
refresh_source_options replaces each source selector's items without restoring its selected value.
When the launcher language changes, all three selectors are refreshed, so their displayed choices
become empty even though their saved preferences have not changed.
Code

apps/frontend/src/panel/service_sources.rs[140]

+        state.set_items(source_options(cx), window, cx)
Evidence
The language-change path refreshes every source selector. The new refresh function calls only
set_items; the existing picker-update path explicitly follows that call with set_selected_value,
and source selection restoration is otherwise a separate operation.

apps/frontend/src/panel/language.rs[130-140]
apps/frontend/src/panel/service_sources.rs[110-114]
apps/frontend/src/panel/service_sources.rs[138-151]
apps/frontend/src/panel/profile_creation.rs[388-397]

Agent prompt
The issue below was found during a code review. Follow the provided context and guidance below and implement a solution

## Issue description
Changing language replaces the service-source option lists without restoring their selected values.

## Fix Focus Areas
- apps/frontend/src/panel/service_sources.rs[138-142]

## Recommended Fix
Capture each selector's selected preference before calling `set_items`, then restore it with `set_selected_value` after replacing the options. Check that all three selectors retain their displayed choices across a language change.

ⓘ Copy this prompt and use it to remediate the issue with your preferred AI generation tools


3. A language change hides a recovery warning 🐞 Bug ☼ Reliability
Description
load_at no longer retains the quarantine warning in Loaded.notice, while
save_launcher_language changes the origin to Stored after saving. If the launcher recovered an
unreadable settings file, choosing a language therefore removes the warning about where that file
was moved before the user has dismissed it.
Code

apps/frontend/src/lib.rs[153]

+        Ok(loaded) => (Some(loaded.data), Some(loaded.origin), None),
Evidence
A quarantined load creates valid replacement settings, so the language save can succeed. The shell
now derives the warning from origin because Loaded.notice is empty; the new save path then
replaces that origin with Stored, for which settings_notice returns no warning.

apps/core/state/src/settings.rs[255-286]
apps/frontend/src/lib.rs[151-155]
apps/frontend/src/lib.rs[175-194]
apps/frontend/src/panel/shell.rs[120-125]
apps/frontend/src/panel/language.rs[104-112]

Agent prompt
The issue below was found during a code review. Follow the provided context and guidance below and implement a solution

## Issue description
A successful language-preference save changes the settings origin and erases the only remaining source of the unreadable-settings recovery warning.

## Fix Focus Areas
- apps/frontend/src/lib.rs[151-155]
- apps/frontend/src/panel/shell.rs[120-125]
- apps/frontend/src/panel/language.rs[104-112]

## Recommended Fix
Keep the recovery event separately from the current settings origin, and render its message using the active language. Clear or replace that event only when loading another settings document, not when saving a preference.

ⓘ Copy this prompt and use it to remediate the issue with your preferred AI generation tools


View review recommended (1)
4. Unknown language value wipes all settings 🐞 Bug ☼ Reliability
Description
launcher_language is a strict serde enum that only accepts "en-US" and "zh-CN", so any other
string makes the whole SettingsDocument fail to deserialize, and load_settings then quarantines
the file and rewrites it with defaults. A settings.json written by a later build that adds a third
language, or a hand-edited typo, still carries the same schema version, and loading it resets
memory, sources, theme, game language and the proxy settings, not just the language.
Code

apps/core/state/src/settings.rs[R96-102]

+#[derive(Debug, Default, Clone, Copy, PartialEq, Eq, Serialize, Deserialize)]
+pub enum LauncherLanguage {
+    #[default]
+    #[serde(rename = "en-US")]
+    English,
+    #[serde(rename = "zh-CN")]
+    SimplifiedChinese,
Evidence
load_settings returns quarantine(...) on any serde_json::from_slice::<SettingsDocument> error,
and quarantine renames the file and writes SettingsData::default(). The new field adds
#[serde(default)], but that only covers a missing key. An unrecognised variant is still a hard
error. SETTINGS_SCHEMA_VERSION is not bumped, so the read-only other-schema path does not protect
the file either.

apps/core/state/src/settings.rs[251-254]
apps/core/state/src/settings.rs[272-284]

Agent prompt
The issue below was found during a code review. Follow the provided context and guidance below and implement a solution

## Issue description
`LauncherLanguage` deserializes strictly. If settings.json holds an unrecognised value, the whole document fails to parse and gets quarantined, and every setting resets to its default.

## Fix Focus Areas
- apps/core/state/src/settings.rs[60-62]
- apps/core/state/src/settings.rs[95-113]

## Recommended Fix
Make an unknown value fall back to the default instead of failing. One option is a `deserialize_with` on `launcher_language` that reads a `String` and maps it (unknown -> `LauncherLanguage::English`). Another is a `#[serde(other)]` fallback through an intermediate enum. Add a test that loads a settings.json with `"launcher_language": "ja-JP"` and checks that origin is `Stored` and the other fields are kept.

ⓘ Copy this prompt and use it to remediate the issue with your preferred AI generation tools



Informational

5. Account button labels mix two languages 🐞 Bug ≡ Correctness
Description
account_kind now returns the translated kind, but the accessibility labels in account_rows are
still built with hard-coded English templates such as "Use {} {} account" and `"Remove {} {}
account"`. In Simplified Chinese, screen readers announce mixed strings like "Use Steve 离线 account".
The "{label} · Selected" detail and the re-authenticate label are also left untranslated.
Code

apps/frontend/src/panel/accounts/render.rs[R236-239]

                                "Use {} {} account",
                                account.name(),
-                                account_kind(id)
+                                account_kind(id, cx)
                            ))
Evidence
The diff changes only the account_kind(id, cx) argument inside format!("Use {} {} account", ...)
and format!("Remove {} {} account", ...). The surrounding template stays English while the
inserted word comes from the active catalog.

apps/frontend/src/panel/accounts/render.rs[226-256]

Agent prompt
The issue below was found during a code review. Follow the provided context and guidance below and implement a solution

## Issue description
Accessibility labels for the account buttons mix English templates with translated account kinds.

## Fix Focus Areas
- apps/frontend/src/panel/accounts/render.rs[207-270]
- apps/frontend/locales/en-US.json[1-31]
- apps/frontend/locales/zh-CN.json[1-31]

## Recommended Fix
Add catalog keys such as `accounts.use.accessibility` ("Use {name} {kind} account"), `accounts.remove.accessibility`, `accounts.reauthenticate.accessibility` and `accounts.selected` to both catalogs. Build the labels with `interpolate(tr(cx, ...), ...)`.

ⓘ Copy this prompt and use it to remediate the issue with your preferred AI generation tools


Grey Divider

Context sources
Review mode: Auto: 🧠 Deep: Broad live UI, persistence, localization, and launch behavior create many independent defect paths.

Grey Divider

Tip of the day
💡 Did you know, you can turn these tips off under Display > Comment parts

More tips ↗ | Customize Qodo ↗ | Qodo docs ↗

Grey Divider

Qodo Logo

@sourcery-ai sourcery-ai Bot 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.

嘿——我发现了 7 个问题

Prompt for AI Agents
Please address the comments from this code review:

## Individual Comments

### Comment 1
<location path="apps/core/state/src/settings.rs" line_range="62" />
<code_context>
     pub theme: ThemeChoice,
+    /// The language of the launcher interface.
+    #[serde(default)]
+    pub launcher_language: LauncherLanguage,
     /// The initial Minecraft language, with an empty value following the launcher.
     #[serde(default)]
</code_context>
<issue_to_address>
**Unsupported language resets settings**

When the settings file contains an unsupported `launcher_language` value, such as after a newer build adds a locale or the value is edited manually, `serde(default)` handles a missing field, not an unrecognized enum value, so deserializing `SettingsData` fails and the settings loader quarantines the entire file and uses defaults. The user loses the other settings until they restore the quarantined file.

Deserialize unknown language values to the default while keeping the rest of the settings document readable.
</issue_to_address>

### Comment 2
<location path="apps/frontend/src/panel/language.rs" line_range="108" />
<code_context>
+            data.launcher_language = selected
+        }) {
+            Ok(_) => {
+                settings.launcher_language = selected;
+                self.origin = Some(SettingsOrigin::Stored);
+                self.environment.clear_feedback();
</code_context>
<issue_to_address>
**Concurrent settings remain stale in memory**

When another launcher process changes a setting such as `default_game_language` after this window loads settings but before it changes the launcher language, `update_settings` returns the complete settings document read under the lock, but this branch discards it and updates only `launcher_language` in the window’s cached settings. A different launcher process’s concurrent game-language change therefore remains on disk but is absent from this window’s launch settings, so launching can use the wrong Minecraft language until reload.

Use the `SettingsData` returned by `update_settings` to refresh the cached settings and any dependent UI state after the write.
</issue_to_address>

### Comment 3
<location path="apps/core/state/src/settings.rs" line_range="61-62" />
<code_context>
     memory: MemoryAllocation,
     #[serde(default)]
     pub theme: ThemeChoice,
+    /// The language of the launcher interface.
+    #[serde(default)]
+    pub launcher_language: LauncherLanguage,
     /// The initial Minecraft language, with an empty value following the launcher.
     #[serde(default)]
</code_context>
<issue_to_address>
**Older settings silently remain accepted**

When a saved settings document lacks `launcher_language`, `SettingsData` deserialization supplies `English` when an existing settings document lacks `launcher_language`, so the older document is still accepted as schema version 1 instead of being rejected as incompatible.

Do not use a serde default to accept documents that lack the new field; reject them according to the repository's schema policy.
</issue_to_address>

### Comment 4
<location path="apps/frontend/src/panel/accounts/third_party.rs" line_range="141" />
<code_context>
                 v_flex()
                     .gap_2()
-                    .child(Label::new("Choose a Minecraft profile"))
+                    .child(Label::new(tr(cx, "accounts.third-party.choose-profile")))
                     .child(h_flex().gap_2().flex_wrap().children(buttons))
                     .into_any_element()
</code_context>
<issue_to_address>
**Chinese UI retains English controls**

When the launcher is set to Simplified Chinese and a user opens third-party sign-in, an account list, or instance memory controls, the catalog-backed labels switch, but `Form::render` still displays English sign-in statuses and field labels, while the account list and instance-memory controls also retain English text. Users who switch to Chinese see a mixed-language interface in these workflows.

Move the remaining user-visible strings and accessibility labels in these workflows into both catalogs and render them through the translation lookup.

Also at `apps/frontend/src/panel/accounts/render.rs:248`, `apps/frontend/src/panel/instances/instance_row.rs:240`.
</issue_to_address>

### Comment 5
<location path="apps/frontend/src/panel/instances/actions.rs" line_range="283" />
<code_context>
+        let message = format!(
+            "{} ({version}): {}",
+            directory.display(),
+            launch.message(cx)
+        );
         match launch {
</code_context>
<issue_to_address>
**Recorded launch text stays stale**

When a launch entry is recorded before the user switches languages, `launch.message(cx)` is formatted into a `String` and retained by `ActivityLog`, so existing rows keep the old language while the rest of the panel updates.

Store launch activity in a form that can be translated again when each row is rendered.

Also at `apps/frontend/src/panel/instances/actions.rs:284`.
</issue_to_address>

### Comment 6
<location path="apps/frontend/src/panel/java/memory.rs" line_range="58-59" />
<code_context>
         let view = cx.weak_entity();
         let saved = settings.memory().manual_heap();
         open_editor(
-            "Minecraft memory".into(),
-            "Automatic",
+            tr(cx, "settings.memory.title").into(),
+            tr(cx, "settings.memory.automatic"),
</code_context>
<issue_to_address>
**Open memory dialog keeps old language**

When the launcher language is switched while the global memory editor dialog is open, `open_editor` captures the localized title and inherited-mode label when the dialog opens, so switching languages while it is open rerenders the dialog with those strings frozen in the previous language while other labels update.

Store translation keys in the dialog/editor and resolve them during each render, including the dialog title.
</issue_to_address>

### Comment 7
<location path="apps/frontend/src/panel/accounts/render.rs" line_range="236-238" />
<code_context>
-                            .label("Use account")
+                            .label(tr(cx, "accounts.use"))
                             .accessibility_label(format!(
                                 "Use {} {} account",
                                 account.name(),
-                                account_kind(id)
+                                account_kind(id, cx)
                             ))
                             .disabled(disabled || selected)
</code_context>
<issue_to_address>
**Account actions remain English**

When the launcher is set to Simplified Chinese and an account row is available, the accessibility-label templates stay hardcoded in English while only the interpolated account kind is translated, so screen-reader users hear mixed-language account actions after switching the launcher to Chinese.

Add localized accessibility-label templates to both catalogs and interpolate the account name and kind into them.

Also at `apps/frontend/src/panel/accounts/render.rs:250-253`.
</issue_to_address>

Sourcery 评估

需要人工审查。 有 6 项发现需要先处理;所选的启动器语言会保存到设置中,并且在未明确配置游戏语言时,也会决定启动 Minecraft 时使用的语言。还原代码不会移除已保存的偏好设置,也不会撤销 Minecraft 已保存的任何游戏语言设置,不过影响范围有限,可以通过更改语言设置来修正。

阻塞性发现:apps/core/state/src/settings.rs:62、apps/frontend/src/panel/language.rs:108、apps/frontend/src/panel/accounts/third_party.rs:141、apps/frontend/src/panel/instances/actions.rs:283、apps/frontend/src/panel/java/memory.rs:59,以及另外 1 项


Sourcery 对开源项目免费——如果你喜欢我们的评审,欢迎分享 ✨
Original comment in English

Hey - I've found 7 issues

Prompt for AI Agents
Please address the comments from this code review:

## Individual Comments

### Comment 1
<location path="apps/core/state/src/settings.rs" line_range="62" />
<code_context>
     pub theme: ThemeChoice,
+    /// The language of the launcher interface.
+    #[serde(default)]
+    pub launcher_language: LauncherLanguage,
     /// The initial Minecraft language, with an empty value following the launcher.
     #[serde(default)]
</code_context>
<issue_to_address>
**Unsupported language resets settings**

When the settings file contains an unsupported `launcher_language` value, such as after a newer build adds a locale or the value is edited manually, `serde(default)` handles a missing field, not an unrecognized enum value, so deserializing `SettingsData` fails and the settings loader quarantines the entire file and uses defaults. The user loses the other settings until they restore the quarantined file.

Deserialize unknown language values to the default while keeping the rest of the settings document readable.
</issue_to_address>

### Comment 2
<location path="apps/frontend/src/panel/language.rs" line_range="108" />
<code_context>
+            data.launcher_language = selected
+        }) {
+            Ok(_) => {
+                settings.launcher_language = selected;
+                self.origin = Some(SettingsOrigin::Stored);
+                self.environment.clear_feedback();
</code_context>
<issue_to_address>
**Concurrent settings remain stale in memory**

When another launcher process changes a setting such as `default_game_language` after this window loads settings but before it changes the launcher language, `update_settings` returns the complete settings document read under the lock, but this branch discards it and updates only `launcher_language` in the window’s cached settings. A different launcher process’s concurrent game-language change therefore remains on disk but is absent from this window’s launch settings, so launching can use the wrong Minecraft language until reload.

Use the `SettingsData` returned by `update_settings` to refresh the cached settings and any dependent UI state after the write.
</issue_to_address>

### Comment 3
<location path="apps/core/state/src/settings.rs" line_range="61-62" />
<code_context>
     memory: MemoryAllocation,
     #[serde(default)]
     pub theme: ThemeChoice,
+    /// The language of the launcher interface.
+    #[serde(default)]
+    pub launcher_language: LauncherLanguage,
     /// The initial Minecraft language, with an empty value following the launcher.
     #[serde(default)]
</code_context>
<issue_to_address>
**Older settings silently remain accepted**

When a saved settings document lacks `launcher_language`, `SettingsData` deserialization supplies `English` when an existing settings document lacks `launcher_language`, so the older document is still accepted as schema version 1 instead of being rejected as incompatible.

Do not use a serde default to accept documents that lack the new field; reject them according to the repository's schema policy.
</issue_to_address>

### Comment 4
<location path="apps/frontend/src/panel/accounts/third_party.rs" line_range="141" />
<code_context>
                 v_flex()
                     .gap_2()
-                    .child(Label::new("Choose a Minecraft profile"))
+                    .child(Label::new(tr(cx, "accounts.third-party.choose-profile")))
                     .child(h_flex().gap_2().flex_wrap().children(buttons))
                     .into_any_element()
</code_context>
<issue_to_address>
**Chinese UI retains English controls**

When the launcher is set to Simplified Chinese and a user opens third-party sign-in, an account list, or instance memory controls, the catalog-backed labels switch, but `Form::render` still displays English sign-in statuses and field labels, while the account list and instance-memory controls also retain English text. Users who switch to Chinese see a mixed-language interface in these workflows.

Move the remaining user-visible strings and accessibility labels in these workflows into both catalogs and render them through the translation lookup.

Also at `apps/frontend/src/panel/accounts/render.rs:248`, `apps/frontend/src/panel/instances/instance_row.rs:240`.
</issue_to_address>

### Comment 5
<location path="apps/frontend/src/panel/instances/actions.rs" line_range="283" />
<code_context>
+        let message = format!(
+            "{} ({version}): {}",
+            directory.display(),
+            launch.message(cx)
+        );
         match launch {
</code_context>
<issue_to_address>
**Recorded launch text stays stale**

When a launch entry is recorded before the user switches languages, `launch.message(cx)` is formatted into a `String` and retained by `ActivityLog`, so existing rows keep the old language while the rest of the panel updates.

Store launch activity in a form that can be translated again when each row is rendered.

Also at `apps/frontend/src/panel/instances/actions.rs:284`.
</issue_to_address>

### Comment 6
<location path="apps/frontend/src/panel/java/memory.rs" line_range="58-59" />
<code_context>
         let view = cx.weak_entity();
         let saved = settings.memory().manual_heap();
         open_editor(
-            "Minecraft memory".into(),
-            "Automatic",
+            tr(cx, "settings.memory.title").into(),
+            tr(cx, "settings.memory.automatic"),
</code_context>
<issue_to_address>
**Open memory dialog keeps old language**

When the launcher language is switched while the global memory editor dialog is open, `open_editor` captures the localized title and inherited-mode label when the dialog opens, so switching languages while it is open rerenders the dialog with those strings frozen in the previous language while other labels update.

Store translation keys in the dialog/editor and resolve them during each render, including the dialog title.
</issue_to_address>

### Comment 7
<location path="apps/frontend/src/panel/accounts/render.rs" line_range="236-238" />
<code_context>
-                            .label("Use account")
+                            .label(tr(cx, "accounts.use"))
                             .accessibility_label(format!(
                                 "Use {} {} account",
                                 account.name(),
-                                account_kind(id)
+                                account_kind(id, cx)
                             ))
                             .disabled(disabled || selected)
</code_context>
<issue_to_address>
**Account actions remain English**

When the launcher is set to Simplified Chinese and an account row is available, the accessibility-label templates stay hardcoded in English while only the interpolated account kind is translated, so screen-reader users hear mixed-language account actions after switching the launcher to Chinese.

Add localized accessibility-label templates to both catalogs and interpolate the account name and kind into them.

Also at `apps/frontend/src/panel/accounts/render.rs:250-253`.
</issue_to_address>

Sourcery assessment

Needs a human reviewer. 6 findings to address first, and the chosen launcher language is saved in settings and, when no game language is explicitly configured, also determines the language used for Minecraft launches. Reverting the code would not remove the saved preference or undo any game-language setting Minecraft has already stored, but the effect is bounded and can be corrected by changing the language settings.

Blocking findings: apps/core/state/src/settings.rs:62, apps/frontend/src/panel/language.rs:108, apps/frontend/src/panel/accounts/third_party.rs:141, apps/frontend/src/panel/instances/actions.rs:283, apps/frontend/src/panel/java/memory.rs:59, and 1 more


Sourcery is free for open source - if you like our reviews please consider sharing them ✨

pub theme: ThemeChoice,
/// The language of the launcher interface.
#[serde(default)]
pub launcher_language: LauncherLanguage,

Copy link
Copy Markdown

Choose a reason for hiding this comment

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

🟡 中 · 不支持的语言会重置设置

当设置文件包含不受支持的 launcher_language 值时(例如新版添加了某种语言,或该值被手动编辑),serde(default) 只会处理字段缺失的情况,不会处理无法识别的枚举值,因此反序列化 SettingsData 会失败,设置加载器会隔离整个文件并使用默认设置。用户会丢失其他设置,直到恢复被隔离的文件。

将未知语言值反序列化为默认值,同时确保设置文档的其余部分仍可读取。

面向 AI 代理的提示
在 `apps/core/state/src/settings.rs` 第 62 行:

**不支持的语言会重置设置**

当设置文件包含不受支持的 `launcher_language` 值时(例如新版添加了某种语言,或该值被手动编辑),`serde(default)` 只会处理字段缺失的情况,不会处理无法识别的枚举值,因此反序列化 `SettingsData` 会失败,设置加载器会隔离整个文件并使用默认设置。用户会丢失其他设置,直到恢复被隔离的文件。

将未知语言值反序列化为默认值,同时确保设置文档的其余部分仍可读取。
Original comment in English

🟡 Medium · Unsupported language resets settings

When the settings file contains an unsupported launcher_language value, such as after a newer build adds a locale or the value is edited manually, serde(default) handles a missing field, not an unrecognized enum value, so deserializing SettingsData fails and the settings loader quarantines the entire file and uses defaults. The user loses the other settings until they restore the quarantined file.

Deserialize unknown language values to the default while keeping the rest of the settings document readable.

Prompt for AI agents
In `apps/core/state/src/settings.rs` at line 62:

**Unsupported language resets settings**

When the settings file contains an unsupported `launcher_language` value, such as after a newer build adds a locale or the value is edited manually, `serde(default)` handles a missing field, not an unrecognized enum value, so deserializing `SettingsData` fails and the settings loader quarantines the entire file and uses defaults. The user loses the other settings until they restore the quarantined file.

Deserialize unknown language values to the default while keeping the rest of the settings document readable.

data.launcher_language = selected
}) {
Ok(_) => {
settings.launcher_language = selected;

Copy link
Copy Markdown

Choose a reason for hiding this comment

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

🟡 中 · 并发修改的设置在内存中仍是旧值

当另一个启动器进程在此窗口加载设置之后、但在此窗口更改启动器语言之前,修改了诸如 default_game_language 这样的设置时,update_settings 会返回在锁内读取的完整设置文档,但此分支丢弃了该文档,只更新此窗口缓存设置中的 launcher_language。因此,另一个启动器进程并发修改的游戏语言虽然已写入磁盘,却没有反映在此窗口的启动设置中;在重新加载之前,启动时可能会使用错误的 Minecraft 语言。

使用 update_settings 返回的 SettingsData 刷新缓存的设置,并在写入后更新所有依赖的 UI 状态。

面向 AI 代理的提示
在 `apps/frontend/src/panel/language.rs` 第 108 行:

**并发修改的设置在内存中仍是旧值**

当另一个启动器进程在此窗口加载设置之后、但在此窗口更改启动器语言之前,修改了诸如 `default_game_language` 这样的设置时,`update_settings` 会返回在锁内读取的完整设置文档,但此分支丢弃了该文档,只更新此窗口缓存设置中的 `launcher_language`。因此,另一个启动器进程并发修改的游戏语言虽然已写入磁盘,却没有反映在此窗口的启动设置中;在重新加载之前,启动时可能会使用错误的 Minecraft 语言。

使用 `update_settings` 返回的 `SettingsData` 刷新缓存的设置,并在写入后更新所有依赖的 UI 状态。
Original comment in English

🟡 Medium · Concurrent settings remain stale in memory

When another launcher process changes a setting such as default_game_language after this window loads settings but before it changes the launcher language, update_settings returns the complete settings document read under the lock, but this branch discards it and updates only launcher_language in the window’s cached settings. A different launcher process’s concurrent game-language change therefore remains on disk but is absent from this window’s launch settings, so launching can use the wrong Minecraft language until reload.

Use the SettingsData returned by update_settings to refresh the cached settings and any dependent UI state after the write.

Prompt for AI agents
In `apps/frontend/src/panel/language.rs` at line 108:

**Concurrent settings remain stale in memory**

When another launcher process changes a setting such as `default_game_language` after this window loads settings but before it changes the launcher language, `update_settings` returns the complete settings document read under the lock, but this branch discards it and updates only `launcher_language` in the window’s cached settings. A different launcher process’s concurrent game-language change therefore remains on disk but is absent from this window’s launch settings, so launching can use the wrong Minecraft language until reload.

Use the `SettingsData` returned by `update_settings` to refresh the cached settings and any dependent UI state after the write.

Comment on lines +61 to +62
#[serde(default)]
pub launcher_language: LauncherLanguage,

Copy link
Copy Markdown

Choose a reason for hiding this comment

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

⚪ 低 · 旧版设置仍会被静默接受

当已保存的设置文档缺少 launcher_language 时,若现有设置文档没有该字段,SettingsData 反序列化会将其设为 English,因此旧版文档仍会被当作架构版本 1 接受,而不是被判定为不兼容并拒绝。

不要使用 serde 默认值来接受缺少新字段的文档;应根据仓库的架构策略拒绝这些文档。

面向 AI 代理的提示
在 `apps/core/state/src/settings.rs` 第 61-62 行:

**旧版设置仍会被静默接受**

当已保存的设置文档缺少 `launcher_language` 时,若现有设置文档没有该字段,`SettingsData` 反序列化会将其设为 `English`,因此旧版文档仍会被当作架构版本 1 接受,而不是被判定为不兼容并拒绝。

不要使用 serde 默认值来接受缺少新字段的文档;应根据仓库的架构策略拒绝这些文档。

摘自 AGENTS.md L65-66:

1. **No backward compatibility.** Delete what is obsolete. Do not add a
   compatibility layer, a migration script or a fallback path.
Original comment in English

⚪ Low · Older settings silently remain accepted

When a saved settings document lacks launcher_language, SettingsData deserialization supplies English when an existing settings document lacks launcher_language, so the older document is still accepted as schema version 1 instead of being rejected as incompatible.

Do not use a serde default to accept documents that lack the new field; reject them according to the repository's schema policy.

Prompt for AI agents
In `apps/core/state/src/settings.rs` at lines 61-62:

**Older settings silently remain accepted**

When a saved settings document lacks `launcher_language`, `SettingsData` deserialization supplies `English` when an existing settings document lacks `launcher_language`, so the older document is still accepted as schema version 1 instead of being rejected as incompatible.

Do not use a serde default to accept documents that lack the new field; reject them according to the repository's schema policy.

From AGENTS.md L65-66:

1. **No backward compatibility.** Delete what is obsolete. Do not add a
   compatibility layer, a migration script or a fallback path.

v_flex()
.gap_2()
.child(Label::new("Choose a Minecraft profile"))
.child(Label::new(tr(cx, "accounts.third-party.choose-profile")))

Copy link
Copy Markdown

Choose a reason for hiding this comment

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

🟡 中 · 中文界面仍有英文控件

当启动器设置为简体中文,用户打开第三方登录、账户列表或实例内存控件时,来自翻译目录的标签会切换语言,但 Form::render 仍显示英文的登录状态和字段标签,账户列表和实例内存控件也仍保留英文。切换到中文的用户在这些操作流程中会看到中英文混杂的界面。

将这些操作流程中剩余的用户可见字符串和无障碍标签加入两个翻译目录,并通过翻译查询来呈现。

另见 apps/frontend/src/panel/accounts/render.rs:248、apps/frontend/src/panel/instances/instance_row.rs:240。

面向 AI 代理的提示
在 `apps/frontend/src/panel/accounts/third_party.rs` 第 141 行:

**中文界面仍有英文控件**

当启动器设置为简体中文,用户打开第三方登录、账户列表或实例内存控件时,来自翻译目录的标签会切换语言,但 `Form::render` 仍显示英文的登录状态和字段标签,账户列表和实例内存控件也仍保留英文。切换到中文的用户在这些操作流程中会看到中英文混杂的界面。

将这些操作流程中剩余的用户可见字符串和无障碍标签加入两个翻译目录,并通过翻译查询来呈现。

另见 `apps/frontend/src/panel/accounts/render.rs:248`、`apps/frontend/src/panel/instances/instance_row.rs:240`。
Original comment in English

🟡 Medium · Chinese UI retains English controls

When the launcher is set to Simplified Chinese and a user opens third-party sign-in, an account list, or instance memory controls, the catalog-backed labels switch, but Form::render still displays English sign-in statuses and field labels, while the account list and instance-memory controls also retain English text. Users who switch to Chinese see a mixed-language interface in these workflows.

Move the remaining user-visible strings and accessibility labels in these workflows into both catalogs and render them through the translation lookup.

Also at apps/frontend/src/panel/accounts/render.rs:248, apps/frontend/src/panel/instances/instance_row.rs:240.

Prompt for AI agents
In `apps/frontend/src/panel/accounts/third_party.rs` at line 141:

**Chinese UI retains English controls**

When the launcher is set to Simplified Chinese and a user opens third-party sign-in, an account list, or instance memory controls, the catalog-backed labels switch, but `Form::render` still displays English sign-in statuses and field labels, while the account list and instance-memory controls also retain English text. Users who switch to Chinese see a mixed-language interface in these workflows.

Move the remaining user-visible strings and accessibility labels in these workflows into both catalogs and render them through the translation lookup.

Also at `apps/frontend/src/panel/accounts/render.rs:248`, `apps/frontend/src/panel/instances/instance_row.rs:240`.

let message = format!(
"{} ({version}): {}",
directory.display(),
launch.message(cx)

Copy link
Copy Markdown

Choose a reason for hiding this comment

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

🟡 中 · 已记录的启动文本仍显示旧语言

当用户切换语言之前记录了一条启动记录时,launch.message(cx) 会被格式化为 String 并由 ActivityLog 保留,因此其余面板更新后,已有条目仍会显示旧语言。

以可在每行渲染时重新翻译的形式存储启动活动记录。

另见 apps/frontend/src/panel/instances/actions.rs:284。

面向 AI 代理的提示
在 `apps/frontend/src/panel/instances/actions.rs` 第 283 行:

**已记录的启动文本仍显示旧语言**

当用户切换语言之前记录了一条启动记录时,`launch.message(cx)` 会被格式化为 `String` 并由 `ActivityLog` 保留,因此其余面板更新后,已有条目仍会显示旧语言。

以可在每行渲染时重新翻译的形式存储启动活动记录。

另见 `apps/frontend/src/panel/instances/actions.rs:284`。
Original comment in English

🟡 Medium · Recorded launch text stays stale

When a launch entry is recorded before the user switches languages, launch.message(cx) is formatted into a String and retained by ActivityLog, so existing rows keep the old language while the rest of the panel updates.

Store launch activity in a form that can be translated again when each row is rendered.

Also at apps/frontend/src/panel/instances/actions.rs:284.

Prompt for AI agents
In `apps/frontend/src/panel/instances/actions.rs` at line 283:

**Recorded launch text stays stale**

When a launch entry is recorded before the user switches languages, `launch.message(cx)` is formatted into a `String` and retained by `ActivityLog`, so existing rows keep the old language while the rest of the panel updates.

Store launch activity in a form that can be translated again when each row is rendered.

Also at `apps/frontend/src/panel/instances/actions.rs:284`.

Comment on lines -58 to -59
"Minecraft memory".into(),
"Automatic",

Copy link
Copy Markdown

Choose a reason for hiding this comment

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

🟡 中 · 已打开的内存对话框仍使用旧语言

当全局内存编辑器对话框打开时切换启动器语言,open_editor 会在对话框打开时捕获本地化标题和继承模式标签。因此,在对话框打开期间切换语言会重新渲染对话框,但这些字符串仍固定为先前的语言,而其他标签则会更新。

在对话框/编辑器中存储翻译键,并在每次渲染时解析,包括对话框标题。

面向 AI 代理的提示
在 `apps/frontend/src/panel/java/memory.rs` 第 58-59 行:

**已打开的内存对话框仍使用旧语言**

当全局内存编辑器对话框打开时切换启动器语言,`open_editor` 会在对话框打开时捕获本地化标题和继承模式标签。因此,在对话框打开期间切换语言会重新渲染对话框,但这些字符串仍固定为先前的语言,而其他标签则会更新。

在对话框/编辑器中存储翻译键,并在每次渲染时解析,包括对话框标题。
Original comment in English

🟡 Medium · Open memory dialog keeps old language

When the launcher language is switched while the global memory editor dialog is open, open_editor captures the localized title and inherited-mode label when the dialog opens, so switching languages while it is open rerenders the dialog with those strings frozen in the previous language while other labels update.

Store translation keys in the dialog/editor and resolve them during each render, including the dialog title.

Prompt for AI agents
In `apps/frontend/src/panel/java/memory.rs` at lines 58-59:

**Open memory dialog keeps old language**

When the launcher language is switched while the global memory editor dialog is open, `open_editor` captures the localized title and inherited-mode label when the dialog opens, so switching languages while it is open rerenders the dialog with those strings frozen in the previous language while other labels update.

Store translation keys in the dialog/editor and resolve them during each render, including the dialog title.

Comment on lines 236 to +238
"Use {} {} account",
account.name(),
account_kind(id)
account_kind(id, cx)

Copy link
Copy Markdown

Choose a reason for hiding this comment

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

🟡 中 · 账户操作仍为英文

当启动器设置为简体中文且账户行可用时,无障碍标签模板仍硬编码为英文,只有插入的账户类型经过了翻译。因此,启动器切换为中文后,屏幕阅读器用户听到的账户操作描述会中英文混杂。

在两个翻译目录中添加本地化的无障碍标签模板,并将账户名称和类型插入其中。

另见 apps/frontend/src/panel/accounts/render.rs:250-253。

面向 AI 代理的提示
在 `apps/frontend/src/panel/accounts/render.rs` 第 236-238 行:

**账户操作仍为英文**

当启动器设置为简体中文且账户行可用时,无障碍标签模板仍硬编码为英文,只有插入的账户类型经过了翻译。因此,启动器切换为中文后,屏幕阅读器用户听到的账户操作描述会中英文混杂。

在两个翻译目录中添加本地化的无障碍标签模板,并将账户名称和类型插入其中。

另见 `apps/frontend/src/panel/accounts/render.rs:250-253`。
Original comment in English

🟡 Medium · Account actions remain English

When the launcher is set to Simplified Chinese and an account row is available, the accessibility-label templates stay hardcoded in English while only the interpolated account kind is translated, so screen-reader users hear mixed-language account actions after switching the launcher to Chinese.

Add localized accessibility-label templates to both catalogs and interpolate the account name and kind into them.

Also at apps/frontend/src/panel/accounts/render.rs:250-253.

Prompt for AI agents
In `apps/frontend/src/panel/accounts/render.rs` at lines 236-238:

**Account actions remain English**

When the launcher is set to Simplified Chinese and an account row is available, the accessibility-label templates stay hardcoded in English while only the interpolated account kind is translated, so screen-reader users hear mixed-language account actions after switching the launcher to Chinese.

Add localized accessibility-label templates to both catalogs and interpolate the account name and kind into them.

Also at `apps/frontend/src/panel/accounts/render.rs:250-253`.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

module: domain Domain identifiers and base types module: frontend State, layout and window wiring module: repository Build, tooling and CI module: state Application state and persistence module: ui Palette and gpui-kit vocabulary status: unreviewed No maintainer has reviewed this yet version: 0.1.0 Version a report or pull request belongs to

Projects

None yet

Development

Successfully merging this pull request may close these issues.

1 participant