Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

App Translation file is ignored / tries to load BR - release/v2.5.x #5015

Closed
2 tasks done
Sharrnah opened this issue Jul 22, 2024 · 1 comment
Closed
2 tasks done
Labels
unverified A bug that has been reported but not verified

Comments

@Sharrnah
Copy link
Contributor

Sharrnah commented Jul 22, 2024

Checklist

  • I have searched the issue tracker for open issues that relate to the same problem, before opening a new one.
  • This issue only relates to a single bug. I will open new issues for any other problems.

Describe the bug

My Windows is set to German.
lang.SystemLocale() returns de-DE-Latn

I created a en.json and a de.json file in my translation folder.

I get the following error message when running:
Cause: message "translation-key" not found in language "br"

however, i never created a br language, and my PC was never set to br.

How to reproduce

  1. Create translations for the fyne app using the release/v2.5.x branch.
  2. create a de.json with a translation
  3. create a en.json with a translation
  4. (set windows to german?)
  5. try to run the app

Screenshots

No response

Example code

package main

import (
	"fyne.io/fyne/v2/app"
	"fyne.io/fyne/v2/widget"
	"fyne.io/fyne/v2/lang"
        "embed"
)

//go:embed translations
var Translations embed.FS

func main() {
        lang.AddTranslationsFS(Translations, "translations")

	a := app.New()
	w := a.NewWindow("Hello World")

	w.SetContent(widget.NewLabel(lang.L("MyLabel")))
	w.ShowAndRun()
}

Fyne version

bed23d9

Go compiler version

1.22.5

Operating system and version

Windows 11

Additional Information

My current guess is that the languages are worked through in order.

Since fyne includes translations for BR, EN, FR, pt_BR and SV,
it first tries BR before DE because that comes before DE in the ABC.

When i create a br.json in my application, it works but takes the translation from the br.json instead of de.json

@Sharrnah Sharrnah added the unverified A bug that has been reported but not verified label Jul 22, 2024
@andydotxyz
Copy link
Member

Fixed on the release branch, thanks so much @Sharrnah :)

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
unverified A bug that has been reported but not verified
Projects
None yet
Development

No branches or pull requests

3 participants