Skip to content

Fix i18n: invalid default, English fallback, absolute config path#455

Open
minh-vt wants to merge 4 commits into
YaoFANGUK:mainfrom
minh-vt:fix/i18n-fallback-and-paths
Open

Fix i18n: invalid default, English fallback, absolute config path#455
minh-vt wants to merge 4 commits into
YaoFANGUK:mainfrom
minh-vt:fix/i18n-fallback-and-paths

Conversation

@minh-vt

@minh-vt minh-vt commented Jul 6, 2026

Copy link
Copy Markdown

Problem

The app has a complete i18n system (8 languages, full en.ini), but three bugs make it fragile:

  1. P0 — Fresh install crash: Config.interface defaulted to "ChineseSimplified", which isn't in the validator's option set ['ch', 'chinese_cht', 'en', ...]. On first launch with no config.json, ComboBoxSettingCard throws KeyError.

  2. P1 — Missing translation keys crash non-English users: Every UI string uses tr['Section']['Key'] — direct dict access. If any non-English .ini is missing a key, it's an unhandled KeyError for all users of that language.

  3. P2 — Config path is CWD-dependent: qconfig.load('config/config.json', config) resolves relative to the current working directory. Run from anywhere except the project root and settings silently fail to load.

Changes in backend/config.py

Before After Fix
interface = OptionsConfigItem(..., "ChineseSimplified", ...) interface = OptionsConfigItem(..., "ch", ...) Default valid from first boot
tr.read(f"{user}.ini") — single file Load en.ini as base, overlay user language Missing keys fall back to English
CONFIG_FILE = "config/config.json" Absolute path via os.path.abspath(__file__) Works from any CWD
f"en.ini" "en.ini" Remove unnecessary f-string

Files changed: 1

@minh-vt minh-vt force-pushed the fix/i18n-fallback-and-paths branch from 04d67be to 9019e22 Compare July 6, 2026 20:52
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