Consider the following languages: cs, de Consider the following piece of XML: <summary>The Programmers Solid 3D CAD Modeller</summary> Consider the string used in the summary is only translated in cs and remains untranslated in de. The following command: itstool -j file.xml.in -o file.xml locale/cs/LC_MESSAGES/openscad.mo locale/de/LC_MESSAGES/openscad.mo Results in the same file as file.xml.in (no translations). But when the following order is used instead: itstool -j file.xml.in -o file.xml locale/de/LC_MESSAGES/openscad.mo locale/cs/LC_MESSAGES/openscad.mo It provides the following output: <summary>The Programmers Solid 3D CAD Modeller</summary> <summary xml:lang="openscad">Programátorův modelář pro 3D objekty</summary> I would like to use this command: itstool -j file.xml.in -o file.xml locale/*/LC_MESSAGES/openscad.mo But the language is always recognized as "openscad", because all the files are named openscad.mo. I also cannot use the -l option, because I'm using the asterisk symbol and I want all the languages to be there. As a workaround, I can do this: for LANGCODE in ...; do mv locale/$LANGCODE/LC_MESSAGES/{openscad,$LANGCODE}.mo done itstool -j file.xml.in -o file.xml ./locale/*/LC_MESSAGES/*.mo for LANGCODE in ...; do mv locale/$LANGCODE/LC_MESSAGES/{$LANGCODE,openscad}.mo done But I don't like it very much. Is there another solution? Should itstool somehow recognize the languge by the path of this kind? Maybe by giving it a clue with some switch?
Created attachment 116534 [details] [review] Try to get language code from PO header I think the attached patch fixes this problem. Instead of relying only on the file name, it tries to get the language code from the Language field in the PO header. I'll merge this to master shortly if there are no problems. I want to make sure it doesn't break anybody's build system. Please test if you're able.
Use of freedesktop.org services, including Bugzilla, is subject to our Code of Conduct. How we collect and use information is described in our Privacy Policy.