-
Bug
-
Resolution: Fixed
-
Normal
-
2.0.4
-
None
-
Ubuntu 18.04.1
Snap install
System Language: German (Switzerland)
- After Snap Install
- Change language to German
- Close Picard
- Restart Picard
- User Interface is still English
[PICARD-1398] Snap package is missing locale files
@Marc Thanks a lot for this. I just tested the candidate channel and can confirm the locales now works as expected!
OK, I think I finally found a workaround. Could you test the version in the candidate channel? Should be ready in no time.
For me the different languages are working (except for catalan, but I'm not really sure if it's related...)
What I finally did is:
1. Create a so called layout in the snapcraft.yaml like this:
layout: /usr/share/locale: bind: $SNAP/share/locale
2. Modify the patch that Philipp sent so now it looks like this:
diff --git a/scripts/picard.in b/scripts/picard.in index 7580da67..e959fb81 100644 --- a/scripts/picard.in +++ b/scripts/picard.in @@ -1,3 +1,3 @@ #!/usr/bin/env python3 -from picard.tagger import main; main('%(localedir)s', %(autoupdate)s) +from picard.tagger import main; main('/usr/share/locale', %(autoupdate)s)
Because before I was getting it set to something like this:
from picard.tagger import main; main('/root/parts/picard/install/share/locale', True)
Sorry, just saw in the logs that it actually installs gettext 0.19.8, so this should be fine. What is missing is the package "appstream" which provides the /usr/share/gettext/its/appdata.its file. Try adding appstream to the stage-packages, it should fix the error.
No, that error is related to the new AppData file shiped with Picard. To translate this gettext >= 0.19.7 (released 2015) is required. Don't understand why Snap would use such outdated build tools, but I've ranted about Snap's developer experience already enough elsewhere.
You have two options I think: a) find out how to use newer gettext or b) patch setup.py to not run "build_appdata", see https://github.com/metabrainz/picard/blob/master/setup.py#L226
Also a side note: You will still need to patch scripts/picard.in to make use of the $SNAP variable as described above.
First of all sorry for the delay answering this, I've been quite busy the last month.
Regarding this: I've tried to compile the snap for Picard 2.1, to see if the situation improvised in any way but now I'm getting this error when building it:
... Building wheels for collected packages: picard, mutagen Running setup.py bdist_wheel for picard: started Running setup.py bdist_wheel for picard: finished with status 'error' Complete output from command /build/picard/parts/picard/install/usr/bin/python3 -u -c "import setuptools, tokenize;__file__='/tmp/pip-req-build-cx15w8qb/setup.py';f=getattr(tokenize, 'open', open)(__file__);code=f.read().replace('\r\n', '\n');f.close();exec(compile(code, __file__, 'exec'))" bdist_wheel -d /tmp/pip-wheel-rmpim0po: running bdist_wheel running build generating scripts/picard from scripts/picard.in running build_appdata msgfmt --xml --template=org.musicbrainz.Picard.appdata.xml.in -d po/appstream -o org.musicbrainz.Picard.appdata.xml msgfmt: cannot locate ITS rules for org.musicbrainz.Picard.appdata.xml.in error: command 'msgfmt' failed with exit status 1
Full log here: https://launchpadlibrarian.net/405390890/buildlog_snap_ubuntu_bionic_amd64_picard-2.0-snap_BUILDING.txt.gz
And this is the current version of the snapcraft.yaml file: https://github.com/pachulo/musicbrainz-picard-snap/blob/541fc69849412dc5c35e43f08e7866475d8b86b3/snap/snapcraft.yaml
@Philipp do you think this error is related to the change introduced?
That variable is not used, also I don't think this variable is really meant to control applications, rather it is used as a fallback for the gettext commands themselves.
I would suggest patching the scripts/picard.in file as I wrote above. Try the patch in the attached picard.in.patch, I guess this should work. If this does work as expected we could think about upstreaming something like this.
I've tried to use the TEXTDOMAINDIR variable (https://github.com/pachulo/musicbrainz-picard-snap/commit/e866fe95957e8c04a3d454a7aea0b2e9588aff44). And it seems that it went OK:
$ snap run --shell picard $ env | grep locale TEXTDOMAINDIR=/snap/picard/9/share/locale
But I still cannot change the language...which variable should I set?
I tried the snap. The locales are placed correctly, but setup.py sets the locale path to "/usr/share/locale". As I understand it the Snap path can be dynamic, so it could be e.g. "/snap/picard/8/share/locale".
Have a look at "/snap/picard/current/bin/picard", that script actually gets generated by setup.py (from scripts/picard.in) and contains the locale path. It looks like this:
#!/usr/bin/env python3
from picard.tagger import main; main('/usr/share/locale', True)
Maybe the best approach would be to patch this and do something like:
#!/usr/bin/env python3import os
from picard.tagger import main; main(os.path.join(os.environ.get('SNAP', ''), '/usr/share/locale/'), True)
Not sure if $SNAP is the correct variable, but you probably now better
This is now in stable!
Thanks to you for all the hints @Phillip! And sorry for the delay fixing this!