fix(i18n): register Chinese translations under correct Fyne bundle tag#965
Open
tofuliang wants to merge 1 commit into
Open
fix(i18n): register Chinese translations under correct Fyne bundle tag#965tofuliang wants to merge 1 commit into
tofuliang wants to merge 1 commit into
Conversation
dweymouth
requested changes
Jun 26, 2026
6859b0a to
8b5b27e
Compare
Fix test file names to match actual files on disk (zhHans.json not zh-Hans.json). Register translations under BOTH the system locale (original trick to ensure configured language always takes effect) AND the BCP47 locale (so go-i18n's matcher correctly resolves queries like 'zh' → 'zh-Hans' for Chinese). Add BCP47Locale field to TranslationInfo struct for explicit locale mapping (zhHans→zh-Hans, zhHant→zh-Hant, pt_BR→pt-BR, etc.). Co-authored-by: Sisyphus <clio-agent@sisyphuslabs.ai>
8b5b27e to
0cc354b
Compare
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Add this suggestion to a batch that can be applied as a single commit.This suggestion is invalid because no changes were made to the code.Suggestions cannot be applied while the pull request is closed.Suggestions cannot be applied while viewing a subset of changes.Only one suggestion per line can be applied in a batch.Add this suggestion to a batch that can be applied as a single commit.Applying suggestions on deleted lines is not supported.You must change the existing code in this line in order to create a valid suggestion.Outdated suggestions cannot be applied.This suggestion has been applied or marked resolved.Suggestions cannot be applied from pending reviews.Suggestions cannot be applied on multi-line comments.Suggestions cannot be applied while the pull request is queued to merge.Suggestion cannot be applied right now. Please check back later.
Description
Fix Chinese (zh-Hans/zh-Hant) translations not being found by Fyne's i18n matcher.
Problem
The previous translation registration code used
lang.AddTranslations()with the system locale name, which didn't match Fyne's built-in bundle tag format. When the localizer queries for 'zh', go-i18n's matcher couldn't find the registered messages.Fix
AddTranslationsForLocaleChanges
main.go: Update translation registration logic to use correct BCP47 locale tagsres/translations_test.go: Add tests for translation file existence and registrationTesting