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

translate=no rules are ignored when creating the translated .xml #37

Closed
tsdgeos opened this issue Mar 7, 2019 · 4 comments
Closed

translate=no rules are ignored when creating the translated .xml #37

tsdgeos opened this issue Mar 7, 2019 · 4 comments

Comments

@tsdgeos
Copy link

tsdgeos commented Mar 7, 2019

In the attached file there is a small xml file that say

<?xml version="1.0" encoding="utf-8"?>
<component type="desktop">
  <name>kmag</name>
  <not_name>kmag</not_name>
</component>

and an its file that says we only translate the name tag

<its:rules xmlns:its="http://www.w3.org/2005/11/its" version="1.0">
  <its:translateRule translate="no" selector="/component"/>
  <its:translateRule translate="yes" selector="/component/name"/>
</its:rules>

the generated .pot file looks good

  msgid ""
  msgstr ""
  "Project-Id-Version: PACKAGE VERSION\n"
  "POT-Creation-Date: 2019-03-08 00:17+0100\n"
  "PO-Revision-Date: YEAR-MO-DA HO:MI+ZONE\n"
  "Last-Translator: FULL NAME <EMAIL@ADDRESS>\n"
  "Language-Team: LANGUAGE <LL@li.org>\n"
  "MIME-Version: 1.0\n"
  "Content-Type: text/plain; charset=UTF-8\n"
  "Content-Transfer-Encoding: 8bit\n"
  
  #. (itstool) path: component/name
  #: test.xml:3
  msgid "kmag"
  msgstr ""

And i've created a fake translation into ca.po that translate to cakmag

then when merging it with
itstool -i test.its -j test.xml -o test.xml.translated ca.mo
the generated translated with translates component/name and component/not_name too


<?xml version="1.0" encoding="utf-8"?>
<component type="desktop">
  <name>kmag</name>
  <name xml:lang="ca">cakmag</name>
  <not_name>kmag</not_name>
  <not_name xml:lang="ca">cakmag</not_name>
</component>

Seems to me as the rules in test.its are being ignored when they should not.

itstool_bug.zip

kdesysadmin pushed a commit to KDE/kmag that referenced this issue Mar 8, 2019
Scripty kept adding them due to a bug in a tool it used:
itstool/itstool#37

With <name> now fixed to "KMag" and thus != "kmag", that should no
longer happen.
@shaunix
Copy link
Contributor

shaunix commented Mar 8, 2019

Oh, interesting. I'll check on this over the weekend. Thanks.

@tsdgeos
Copy link
Author

tsdgeos commented Apr 2, 2019

Did you have any luck reproducing/fixing it?

@shaunix
Copy link
Contributor

shaunix commented Apr 6, 2019

Oh, can't believe I didn't recognize this. This is issue #34, which I fixed in November, but failed to roll a release with the fix. I'll do a release today.

@shaunix
Copy link
Contributor

shaunix commented Apr 6, 2019

Version 2.0.6 released with the fix. Tarballs on itstool.org, also as an sdist on pypi.
http://itstool.org/download

@shaunix shaunix closed this as completed Apr 6, 2019
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

No branches or pull requests

2 participants