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

Translations not loaded on Nix #2819

Closed
jtojnar opened this Issue Mar 30, 2018 · 6 comments

Comments

Projects
None yet
2 participants
@jtojnar

jtojnar commented Mar 30, 2018

Quod Libet does not pass any localedir to gettext.bindtextdomain causing an issue on Nix, which uses non-standard localedir (for example, /nix/store/pgb6i21r6zrdb9phff511jziiml2ns68-quodlibet-full-4.0.2/share/locale).

As Python documentation notes, a path should be always passed to prevent this from occurring:

The default locale directory is system dependent; for example, on RedHat Linux it is /usr/share/locale, but on Solaris it is /usr/lib/locale. The gettext module does not try to support these system dependent defaults; instead its default is sys.prefix/share/locale. For this reason, it is always best to call bindtextdomain() with an explicit absolute path at the start of your application.

@lazka

This comment has been minimized.

Member

lazka commented Mar 30, 2018

Thanks. Do you know how to figure out right path?

@jtojnar

This comment has been minimized.

jtojnar commented Mar 30, 2018

I think the only way is getting the path from package manager during build. For example, gnome-music configures the file, see https://github.com/GNOME/gnome-music/blob/3.28.0/meson.build#L76 and https://github.com/GNOME/gnome-music/blob/3.28.0/gnome-music.in#L54

@lazka

This comment has been minimized.

Member

lazka commented Mar 30, 2018

Hm, ok, would searching XDG_DATA_DIRS work?

@jtojnar

This comment has been minimized.

jtojnar commented Mar 30, 2018

That should work for us, even if it is not universal and the list is pretty large.

@lazka lazka closed this in fad00b9 May 14, 2018

@lazka lazka reopened this May 14, 2018

@lazka

This comment has been minimized.

Member

lazka commented May 14, 2018

Reopening due to fad00b9#r28965737

lazka added a commit that referenced this issue May 15, 2018

translations: try to load translations for all locale dirs before giv…
…ing up. See #2819

The current approach was to search for the first existing locale dir
and try to load translations from there, but the translations could be
in multiple dirs and the first one might be the wrong one.

Instead iterate through all of them and try to load the translations
before giving up.
@lazka

This comment has been minimized.

Member

lazka commented Sep 7, 2018

I assume this is fixed by 8bf77e9. If not please reopen!

@lazka lazka closed this Sep 7, 2018

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment