is it intentional that rosetta changes the filenames for uploaded translation files?

Asked by Dominic Evans

When enabling launchpad translations for our project, I uploaded a tar containing our .pot file and a couple of already translated languages.

i.e.,
gwibber.pot
it.po
es.po

These have now been imported and translation is possible through the launchpad web UI.

As an experiment I performed the en_GB translation, and then downloaded all translations from rosetta.

This downloaded package has the following structure and filenames:
.
./gwibber
./gwibber/gwibber-it.po
./gwibber/gwibber.pot
./gwibber/gwibber-es.po
./gwibber-en_GB.po

It seems rosetta has prepended gwibber- to all the translations, and is storing the imported files in a gwibber subdirectory, whilst those created entirely through launchpad are place in the root folder.

Firstly, is it intentional that rosetta prepends the .pot template name to all translated files? (it doesn't seem to mention this in the documentation). Secondly, why are imported files in a different subdirectory to rosetta-created ones? Is this second thing a bug?

Many thanks.

Question information

Language:
English Edit question
Status:
Solved
For:
Launchpad itself Edit question
Assignee:
Henning Eggers Edit question
Solved by:
Dominic Evans
Solved:
Last query:
Last reply:
Revision history for this message
Henning Eggers (henninge) said :
#1

It is intentional that pofiles named only like the language code are renamed to contain the translation domain, too.
It is also intentional to place files that where uploaded without a directory into one (named like the translation domain) when exporting them in a tarball.

It is a bug that names of pofiles created in Launchpad are prepended with a / if the potemplate (as in your case) did not have a directory. Because of that it is not included in the directory.
https://bugs.edge.launchpad.net/rosetta/+bug/321459

You can fix this the following way: Put the files in a tarball with the following structure:
gwibber/gwibber.pot
gwibber/it.po
gwibber/en_GB.po
gwibber/es.po

and upload it. The path names for the files will be updated. When you now create new pofiles in the UI they will go in the same directory as the template. Upon download you will get a tarball of the same structure you got now (po files renamed to <domain>-<langcode>.po) but all files included in the directory.

I have yet to determine if the renaming of files in a directory is there for a good reason or if that is a bug, too.

Henning

Revision history for this message
Dominic Evans (oldmanuk) said :
#2

Thanks for the explanation. I have queued up an import with all files under gwibber/ as you suggested and will let you know if this solves the problem once it has completed.

Revision history for this message
Celso Providelo (cprov) said :
#3

Henning,

Thanks for helping Dominic, I'm assigning it to you and marking it as answered.

Revision history for this message
Dominic Evans (oldmanuk) said :
#4

Some further discussion for this question.

Firstly, the renaming of po files to <domain>-<langcode>.po makes rosetta exports incompatible by default with python distutils_extra.command.build_i18n which expects all files to be <langcode>.po and knows the domain already from the .pot template filename. If fed rosetta .po files directly it will try and install locales in /usr/share/locale/<domain>-<langcode>/LC_MESSAGES/<domain>.mo instead of /usr/share/locale/<langcode>/LC_MESSAGES/<domain>.mo

Obviously its not too difficult to do a quick sed -e 's/<domain>-//' on the filenames but is this problem then a bug with the distutils_extra package or rosetta?

Secondly, despite a re-upload of all languages and template with a gwibber subdirectory, I'm still seeing the same problem that exports of newly created (in rosetta) languages are left in a root folder below the gwibber subdir. Shall I raise this as a separate bug?

$ wget http://launchpadlibrarian.net/21717871/launchpad-export.tar.gz
$ aunpack launchpad-export.tar.gz
gwibber/
gwibber/gwibber.pot
gwibber/gwibber-en_GB.po
gwibber/gwibber-it.po
gwibber/gwibber-fi.po
./
tar: Removing leading `/' from member names
/gwibber-de.po
./
/gwibber-pt_BR.po
gwibber/gwibber-es.po
./
/gwibber-fr.po
./
/gwibber-ar.po
./
/gwibber-id.po
gwibber/gwibber-sv.po
./
/gwibber-lo.po
./
/gwibber-ca.po
./
/gwibber-pl.po
./
/gwibber-nl.po

Revision history for this message
Henning Eggers (henninge) said :
#5

We discussed the naming of exported po files and figured the reason this is done is to avoid file name clashes if there are multiple templates in the same directory. So, for this reason, it is a feature but we are aware that it plays poorly with gettext tools. I just found a bug concerning this:
https://bugs.edge.launchpad.net/rosetta/+bug/148276

As I said, the placing of new files outside the directory is bug 321459 which I just submitted a fix for. Unfortunately it is too late for this fix to be included in this month's release (2.2.1) which is due today. You will have it on edge.launchpad.net sometime next week.

As you can see, gwibber-en_GB.po is now in the directory, after you re-uploaded it. This is the best Launchpad can do at the moment, I am afraid.

Revision history for this message
Dominic Evans (oldmanuk) said :
#6

Ah, excellent.

Thanks for the clarification! :-)