Package: itstool Version: 2.0.2-2 Severity: grave Tags: patch Justification: renders package unusable
When trying to translate strings from English to another langage, itstool fails because unicode character where used in the translation file (.mo). As mainly every langage except english uses unicode characters, the package is unusable. A fix has been published on the official Github page : https://github.com/itstool/itstool/commit/6f1761d86b4749a65607d4b4af622f6771e1f330 The issue also affects Debian Jessie and Debian Sid. -- System Information: Debian Release: stretch/sid APT prefers testing-updates APT policy: (500, 'testing-updates'), (500, 'testing') Architecture: amd64 (x86_64) Kernel: Linux 4.3.0-1-amd64 (SMP w/1 CPU core) Locale: LANG=fr_FR.UTF-8, LC_CTYPE=fr_FR.UTF-8 (charmap=UTF-8) Shell: /bin/sh linked to /bin/dash Init: systemd (via /run/systemd/system) Versions of packages itstool depends on: ii python 2.7.11-1 ii python-libxml2 2.9.3+dfsg1-1 itstool recommends no packages. itstool suggests no packages. -- no debconf information
>From d75f68cbc58075b57aee53d57b9156655a2fc99a Mon Sep 17 00:00:00 2001 From: Shaun McCance <sha...@gnome.org> Date: Mon, 17 Mar 2014 14:40:42 -0400 Subject: [PATCH] Fix UTF-8 handling for translated attributes --- itstool.in | 2 +- tests/IT-attributes-2.ll.po | 21 +++++++++++++++++++++ tests/IT-attributes-2.ll.xml | 10 ++++++++++ tests/IT-attributes-2.pot | 21 +++++++++++++++++++++ tests/IT-attributes-2.xml | 10 ++++++++++ tests/run_tests.py | 3 +++ 6 files changed, 66 insertions(+), 1 deletion(-) create mode 100644 tests/IT-attributes-2.ll.po create mode 100644 tests/IT-attributes-2.ll.xml create mode 100644 tests/IT-attributes-2.pot create mode 100644 tests/IT-attributes-2.xml diff --git a/itstool.in b/itstool.in index 96fb913..d0e76a1 100755 --- a/itstool.in +++ b/itstool.in @@ -966,7 +966,7 @@ class Document (object): for attr in trans_attrs: newcontent = translations.ugettext(attr.get_content()) if newcontent: - newnode.setProp(attr.name, translations.ugettext(attr.get_content())) + newnode.setProp(attr.name, newcontent.encode('utf-8')) def get_translated (self, node, translations, strict=False, lang=None): msg = self._msgs.get_message_by_node(node) diff --git a/tests/IT-attributes-2.ll.po b/tests/IT-attributes-2.ll.po new file mode 100644 index 0000000..fefd42d --- /dev/null +++ b/tests/IT-attributes-2.ll.po @@ -0,0 +1,21 @@ +msgid "" +msgstr "" +"Project-Id-Version: PACKAGE VERSION\n" +"POT-Creation-Date: 2012-05-04 11:46-0400\n" +"PO-Revision-Date: YEAR-MO-DA HO:MI+ZONE\n" +"Last-Translator: FULL NAME <EMAIL@ADDRESS>\n" +"Language-Team: LANGUAGE <l...@li.org>\n" +"Language: \n" +"MIME-Version: 1.0\n" +"Content-Type: text/plain; charset=UTF-8\n" +"Content-Transfer-Encoding: 8bit\n" + +#. (itstool) path: page/code@title +#: tests/IT-attributes-2.xml:9 +msgid "one" +msgstr "öñé" + +#. (itstool) path: code/span@title +#: tests/IT-attributes-2.xml:9 +msgid "two" +msgstr "ŧwô" diff --git a/tests/IT-attributes-2.ll.xml b/tests/IT-attributes-2.ll.xml new file mode 100644 index 0000000..2a1044d --- /dev/null +++ b/tests/IT-attributes-2.ll.xml @@ -0,0 +1,10 @@ +<?xml version="1.0" encoding="utf-8"?> +<page> + <info> + <its:rules xmlns:its="http://www.w3.org/2005/11/its" version="1.0"> + <its:translateRule selector="//code" translate="no"/> + <its:translateRule selector="//@title" translate="yes"/> + </its:rules> + </info> + <code title="öñé">Not translated <span title="ŧwô"/></code> +</page> diff --git a/tests/IT-attributes-2.pot b/tests/IT-attributes-2.pot new file mode 100644 index 0000000..e989b08 --- /dev/null +++ b/tests/IT-attributes-2.pot @@ -0,0 +1,21 @@ +msgid "" +msgstr "" +"Project-Id-Version: PACKAGE VERSION\n" +"POT-Creation-Date: 2012-05-04 11:46-0400\n" +"PO-Revision-Date: YEAR-MO-DA HO:MI+ZONE\n" +"Last-Translator: FULL NAME <EMAIL@ADDRESS>\n" +"Language-Team: LANGUAGE <l...@li.org>\n" +"MIME-Version: 1.0\n" +"Content-Type: text/plain; charset=UTF-8\n" +"Content-Transfer-Encoding: 8bit\n" + +#. (itstool) path: page/code@title +#: tests/IT-attributes-2.xml:9 +msgid "one" +msgstr "" + +#. (itstool) path: code/span@title +#: tests/IT-attributes-2.xml:9 +msgid "two" +msgstr "" + diff --git a/tests/IT-attributes-2.xml b/tests/IT-attributes-2.xml new file mode 100644 index 0000000..3233132 --- /dev/null +++ b/tests/IT-attributes-2.xml @@ -0,0 +1,10 @@ +<?xml version="1.0" encoding="utf-8"?> +<page> + <info> + <its:rules xmlns:its="http://www.w3.org/2005/11/its" version="1.0"> + <its:translateRule selector="//code" translate="no"/> + <its:translateRule selector="//@title" translate="yes"/> + </its:rules> + </info> + <code title="one">Not translated <span title="two"/></code> +</page> diff --git a/tests/run_tests.py b/tests/run_tests.py index 6939ff6..af62d76 100644 --- a/tests/run_tests.py +++ b/tests/run_tests.py @@ -311,6 +311,9 @@ class ItstoolTests(unittest.TestCase): def test_IT_attributes_1(self): self._test_translation_process('IT-attributes-1.xml') + def test_IT_attributes_2(self): + self._test_translation_process('IT-attributes-2.xml') + def test_IT_context_1(self): self._test_translation_process('IT-context-1.xml') -- 2.1.4