Skip to content

Fix language switching, localization gaps, and auto-detect system language#370

Open
Szy-Cathay wants to merge 1 commit into
donkeyProgramming:masterfrom
Szy-Cathay:feature/localization-improvements
Open

Fix language switching, localization gaps, and auto-detect system language#370
Szy-Cathay wants to merge 1 commit into
donkeyProgramming:masterfrom
Szy-Cathay:feature/localization-improvements

Conversation

@Szy-Cathay

Copy link
Copy Markdown
Contributor

Summary

This PR addresses several localization issues and adds system language auto-detection for first-time users.

Changes

Bug Fixes:

  1. Language switching not working — The startup code was hardcoding "en" in LoadLanguage() instead of reading the user's saved language preference from ApplicationSettings.SelectedLangauge. This caused the language setting to always reset to English on restart.

  2. Reports > Bmd menu shows raw key — The XAML uses MenuBar.Reports.Bmd but both language JSONs still had the old key MenuBar.Reports.RmvToText. When LocExtension can't find a translation, it falls back to displaying the raw key string. Fixed by updating the key in both language files.

  3. Kitbash animation panel buttons show raw keysCollapsableFilterControl.xaml.cs was overriding the XAML {loc:Loc} bindings by setting BrowseButton.Content to hardcoded English strings "Browse" and "Hide" in ToggleSearchFiled() and HandleItemDoubleClicked(). Replaced with DI-based localization lookups that follow the same IAssetEditorMainLocalizationManager pattern used by LocExtension.

New Feature:

  1. Auto-detect system language on first launch — When IsFirstTimeStartingApplication is true, reads CultureInfo.CurrentUICulture.TwoLetterISOLanguageName, maps zhcn, enen, frfr (with en as fallback), and saves the detected language before the UI loads. A file-existence check ensures the corresponding Language_*.json exists before applying.

Localization Sync:

  1. Chinese language file (Language_Cn.json) brought in sync with English:

    • Replaced outdated MenuBar.File.OpenPack with MenuBar.File.OpenProjectFolder
    • Added missing keys: MenuBar.File.ImportPackAsProject, MenuBar.File.ImportReferencePack
    • Translated all 7 PackFileCache.* entries (were English-only)
    • Added Dialog.Filter.Hide key
  2. English language file (Language_En.json) updated:

    • MenuBar.Reports.RmvToTextMenuBar.Reports.Bmd
    • Added Dialog.Filter.Hide key

Files Changed

File + -
AssetEditor/App.xaml.cs +23 -1
AssetEditor/Language_Cn.json +13 -8
AssetEditor/Language_En.json +2 -1
Shared/SharedUI/Shared.Ui/BaseDialogs/FilterDialog/CollapsableFilterControl.xaml.cs +18 -4

Testing

  • Build passes with 0 errors
  • Manual testing: language switching persists across restarts
  • Manual testing: first-launch language auto-detection (Chinese Windows → cn)
  • Manual testing: Reports > Bmd menu displays correct text
  • Manual testing: Kitbash animation panel buttons display localized text

…nguage

- Fix language switching not working: replace hardcoded "en" with
  SelectedLangauge from user settings in App startup
- Auto-detect system language on first launch via CultureInfo.CurrentUICulture,
  mapping zh→cn, en→en, fr→fr, with en as fallback
- Fix Reports > Bmd menu item showing raw key due to stale RmvToText key in
  language JSONs
- Fix Kitbash animation panel CollapsableFilterControl buttons showing raw
  localization keys instead of translated text; replaced hardcoded English
  "Browse"/"Hide" with DI-based localization lookups
- Sync Language_Cn.json with Language_En.json: add missing keys
  (MenuBar.File.OpenProjectFolder, ImportPackAsProject, ImportReferencePack),
  remove outdated MenuBar.File.OpenPack, translate all PackFileCache entries,
  add Dialog.Filter.Hide key

Files changed:
  AssetEditor/App.xaml.cs
  AssetEditor/Language_Cn.json
  AssetEditor/Language_En.json
  Shared/SharedUI/Shared.Ui/BaseDialogs/FilterDialog/CollapsableFilterControl.xaml.cs
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.

1 participant