Skip to content

fix(desktop): use DesktopLanguage for i18n slash command descriptions#3876

Merged
esengine merged 4 commits into
esengine:main-v2from
Bernardxu123:fix/desktop-i18n-slash-commands
Jun 11, 2026
Merged

fix(desktop): use DesktopLanguage for i18n slash command descriptions#3876
esengine merged 4 commits into
esengine:main-v2from
Bernardxu123:fix/desktop-i18n-slash-commands

Conversation

@Bernardxu123

Copy link
Copy Markdown
Collaborator

Summary

Fixes #3875

When the user selects a language in desktop settings, the / command descriptions in chat still show English because the i18n system only reads from cfg.Language (CLI setting), not cfg.DesktopLanguage() (desktop setting).

Changes

desktop/app.go

  • When initializing i18n, fall back to cfg.DesktopLanguage() when cfg.Language is empty
  • This ensures the desktop language preference is respected for slash command descriptions
// Before
if cfg, err := config.Load(); err == nil {
    i18n.DetectLanguage(cfg.Language)
}

// After
if cfg, err := config.Load(); err == nil {
    lang := cfg.Language
    if lang == "" {
        lang = cfg.DesktopLanguage()
    }
    i18n.DetectLanguage(lang)
}

Testing

go build ./...

Build succeeds ✅

Backward Compatibility

  • Fully backward compatible
  • Does not affect CLI users (they set language via reasonix.toml or env vars)
  • Only affects desktop app users who set language in settings

Signed-off-by: Bernardxu123 bernardxu123@users.noreply.github.com

When the user selects a language in desktop settings, it saves to
DesktopLanguage field. However, the i18n system for slash command
descriptions only reads from cfg.Language (CLI setting), causing
the / commands to show English descriptions even when Chinese is
selected in desktop settings.

Fix: Fall back to cfg.DesktopLanguage() when cfg.Language is empty,
so the desktop language preference is respected.

Fixes esengine#3850 (upstream)

Signed-off-by: Bernardxu123 <bernardxu123@users.noreply.github.com>
@github-actions github-actions Bot added v2 Go rewrite (1.x) — main-v2 branch, active development desktop Wails desktop app (desktop/**) labels Jun 10, 2026
When the user selects a language in desktop settings, it saves to
DesktopLanguage field. However, the i18n system for slash command
descriptions only reads from cfg.Language (CLI setting), causing
the / commands to show English descriptions even when Chinese is
selected in desktop settings.

Fix: Fall back to cfg.DesktopLanguage() when cfg.Language is empty,
so the desktop language preference is respected.

Fixes esengine#3875 (upstream)

Signed-off-by: Bernardxu123 <bernardxu123@users.noreply.github.com>

@esengine esengine left a comment

Copy link
Copy Markdown
Owner

Choose a reason for hiding this comment

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

Good catch on the root cause — desktop i18n init only ever read cfg.Language, so the desktop language picker never reached the slash descriptions. Right place to fix it, too.

One substantive point before merging: the comment and the code disagree, and I think the comment has it right. The comment says "Prefer DesktopLanguage (desktop UI setting) over Language (CLI setting)", but the code makes cfg.Language win and only falls back to DesktopLanguage() when it's empty. For a user with language = "en" in their toml who then picks 中文 in desktop Settings, the frontend UI switches to Chinese but slash descriptions stay English — which is exactly the mixed-language state #3875 complains about.

In the desktop app the desktop-specific setting is the user's most direct intent (it's also what the rest of the desktop UI follows), so the precedence should be:

lang := cfg.DesktopLanguage()
if lang == "" {
    lang = cfg.Language
}
i18n.DetectLanguage(lang)

That matches your comment as written, keeps CLI users unaffected (they have no desktop.language), and fully fixes the issue for users with both set. Happy to merge right after that flip.

@Bernardxu123

Copy link
Copy Markdown
Collaborator Author

Fixed! Thanks for the clear explanation.

Changed the precedence to:

lang := cfg.DesktopLanguage()
if lang == "" {
    lang = cfg.Language
}
i18n.DetectLanguage(lang)

Now DesktopLanguage takes priority, matching the comment and the rest of the desktop UI behavior. CLI users are unaffected since they have no desktop.language set.

Per maintainer feedback: in the desktop app, the desktop-specific
setting is the user's most direct intent (it's also what the rest
of the desktop UI follows), so the precedence should be:

  lang := cfg.DesktopLanguage()
  if lang ==  {
      lang = cfg.Language
  }

This matches the comment and fully fixes the issue for users with
both settings configured.

Signed-off-by: Bernardxu123 <bernardxu123@users.noreply.github.com>

@esengine esengine left a comment

Copy link
Copy Markdown
Owner

Choose a reason for hiding this comment

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

That's exactly the flip — DesktopLanguage() first, CLI language as fallback, matching the comment and the rest of the desktop UI. CLI users are untouched (no desktop.language), and the mixed-language state from #3875 is gone for users with both set. Merging, thanks for the quick turnaround.

@esengine esengine merged commit d4ef0b6 into esengine:main-v2 Jun 11, 2026
13 checks passed
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

desktop Wails desktop app (desktop/**) v2 Go rewrite (1.x) — main-v2 branch, active development

Projects

None yet

Development

Successfully merging this pull request may close these issues.

[Bug]: Desktop slash command descriptions not localized when language set in desktop settings

2 participants