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

Snap package: language sets to english only #2388

Open
Dadu042 opened this issue Sep 13, 2024 · 8 comments
Open

Snap package: language sets to english only #2388

Dadu042 opened this issue Sep 13, 2024 · 8 comments
Assignees
Labels
bug Something isn't working tools Issues related to mp, ruledit, etc along with CI and build tools.

Comments

@Dadu042
Copy link

Dadu042 commented Sep 13, 2024

When launching the game, it does set its language to english while my OS is french.

  • OS: Ubuntu 24.04.1
  • Freeciv21 version: 3.0.4 (snap package: april 2024, stable). Same thing with v3.1 beta 2 (snap, sept 2024).

Perhaps the fix is to add to 'snapcraft.yaml' after 'plugs:' the line '- locale-control' (my ref: https://snapcraft.io/docs/locale-control-interface).

@Dadu042 Dadu042 added bug Something isn't working Untriaged This issue or PR needs triaging labels Sep 13, 2024
@lmoureaux
Copy link
Contributor

Can reproduce.

@lmoureaux lmoureaux added tools Issues related to mp, ruledit, etc along with CI and build tools. and removed Untriaged This issue or PR needs triaging labels Sep 13, 2024
@lmoureaux lmoureaux added this to the v3.1-stable milestone Sep 13, 2024
@jwrober
Copy link
Collaborator

jwrober commented Sep 13, 2024

Thanks for the report @Dadu042. What happens if you install latest/edge or latest/beta? v3.1-beta.2 is there. I'm curious if this is a snap issue or something with our package.

@jwrober
Copy link
Collaborator

jwrober commented Sep 13, 2024

Oh, I see more of the original post. I should have read the whole thing. We can post an update with that setting. Thanks

@jwrober jwrober self-assigned this Sep 13, 2024
@lmoureaux
Copy link
Contributor

Recommendation for @Dadu042: Use Flatpak for now.

After trying things for hours, here are the results of my investigation:

  • The locale data is present in the snap at /snap/freeciv21/current/usr/share/locale/
  • The snap sets LOCPATH to $HOME/.local/share/locale:/usr/lib/locale
    • kcalc and gwenview get something different: /root/snap/gwenview/126/.local/share/locale:/usr/lib/locale
  • setlocale() supposedly uses LOCPATH to set the locale search path, but I always get /usr/share/locale from it independently of LOCPATH
  • We hard-code the location of our MO file to ${CMAKE_INSTALL_FULL_LOCALEDIR} in a call to bindtextdomain()
    • Un-hard-coding it does not help
    • Hard-coding it to /snap/freeciv21/current/usr/share/locale/ appears to work, but is ugly
  • Ki18n has a much nicer API than bare gettext. In particular it supports a real search path instead of a single folder like bindtextdomain(). Should consider switching for 3.2, too late for 3.1

@jwrober
Copy link
Collaborator

jwrober commented Sep 17, 2024

How did you hard code to /snap/freeciv21/current/usr/share/locale/ in your testing? I would like to resolve this issue this week if possible, even with a hack for now.

Keep the issue open to handle the problem better w/ Ki18n post 3.1 release.

@lmoureaux
Copy link
Contributor

Hacky hack, I changed the value directly in the call to bindtextdomain, compiled, then I went inside the container with snap run --shell freeciv21.freeciv21-client, navigated to my usual fc21 folder, and started the game from there.

@jwrober
Copy link
Collaborator

jwrober commented Sep 17, 2024

List of KDE's snaps - https://invent.kde.org/neon/snap-packaging

@jwrober
Copy link
Collaborator

jwrober commented Sep 18, 2024

There is either A) a snapcraft upstream issue around this or B) something in our code that just doesn't work in a snap environment. Removing this from 3.1-stable milestone. Will move to ki18n for 3.2 series.

@jwrober jwrober removed this from the v3.1-stable milestone Sep 18, 2024
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
bug Something isn't working tools Issues related to mp, ruledit, etc along with CI and build tools.
Projects
None yet
Development

No branches or pull requests

3 participants