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

Menu Quit appears twice when using Region#English on Window OS #5158

Closed
2 tasks done
prifre opened this issue Sep 23, 2024 · 5 comments
Closed
2 tasks done

Menu Quit appears twice when using Region#English on Window OS #5158

prifre opened this issue Sep 23, 2024 · 5 comments

Comments

@prifre
Copy link
Contributor

prifre commented Sep 23, 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

If I WANT english language and I do have an OS (Windows in my case) set to REGION="Sweden" I end up with TWO Quit menus...
One Quit in an English OS and two Quit -> English "Quit" (mine) and a Swedish "Avsluta" on an non-English (Region #English) OS...
The temporary solution is to remove the file https://github.com/fyne-io/fyne/tree/master/lang/translations/base.sv.json from fyne. Or set "Region" to English/UK, etc.

A suggested permanent solution would be to add a function to the lang package to be able to control what language the application is supposed to be using!!! Then I could even have a multilanguage-controlling menu! :-)
Suggestion:
lang.SetLanguage("en") or lang.SetLanguage("sv") etc...

How to reproduce

  1. Go to (on Windows 11) Start->Settings->Time & language and set "Region" ->"Swedish"
  2. add code that adds an "Quit" (english) menu.
  3. You end up with 2 Quit...

Screenshots

No response

Example code

func BuildFileMenu(window fyne.Window) *fyne.Menu {
// a quit item will be appended to our first menu
mFile := fyne.NewMenu("File",
fyne.NewMenuItem("Quit", func() {
window.Close()
os.Exit(1)
}))

Fyne version

[email protected]

Go compiler version

go1.22.1 windows/amd64

Operating system and version

Windows 11 Home with REGION set to "Sweden"

Additional Information

No response

@prifre prifre added the unverified A bug that has been reported but not verified label Sep 23, 2024
@andydotxyz
Copy link
Member

And what if you Localise that properly with fyne.NewMenuItem(lang.L("Quit"), ...)?

@Klaus-Tockloth
Copy link

@prifre : I have an "english-only" application with similar problems (unwanted translations). What exactly does your workaround look like?

@andydotxyz
Copy link
Member

As noted in the attached issue this happens because the Quit is localised but your code is adding another English quit item. To have them match change the line to:

fileQuit := fyne.NewMenuItem(land.L("Quit"),

@Klaus-Tockloth
Copy link

It is possible that the problem has not yet become clear. No translation is required for an ‘english-only’ version. This is not achieved by the above proposal. I will create a separate issue for this topic.

@andydotxyz
Copy link
Member

Because of that new issue for disabling translation then the only other part of this issue (duplicate when adding English items in menu) is now resolved as noted in #5242.

@andydotxyz andydotxyz removed the unverified A bug that has been reported but not verified label Nov 16, 2024
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

No branches or pull requests

3 participants