summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorShaun McCance <shaunm@gnome.org>2012-09-20 20:12:36 -0400
committerShaun McCance <shaunm@gnome.org>2012-09-20 20:12:36 -0400
commit2bca336117edee032ad956994d2ef3650f25e322 (patch)
treec30679f92fb3d50be42b9ffda6b3da00e0a9b559
parent3a56e53c4cd157da0c5f21c18806047e6b64eddb (diff)
downloaditstool-2bca336117edee032ad956994d2ef3650f25e322.tar.gz
Fix tests for namespace prefix handling
-rwxr-xr-xitstool.in8
-rw-r--r--tests/IT-prefixes-1.ll.po16
-rw-r--r--tests/IT-prefixes-1.ll.xml7
-rw-r--r--tests/IT-prefixes-1.pot16
-rw-r--r--tests/IT-prefixes-1.xml5
5 files changed, 21 insertions, 31 deletions
diff --git a/itstool.in b/itstool.in
index cb724a9..d00ba18 100755
--- a/itstool.in
+++ b/itstool.in
@@ -217,9 +217,9 @@ class Message (object):
if len(self._message) == 0 or not(isinstance(self._message[-1], basestring)):
self._message.append('')
if node.ns() is not None and node.ns().name is not None:
- self._message[-1] += ('<%s:%s' % (node.ns().name, node.name))
+ self._message[-1] += ('<%s:%s' % (unicode(node.ns().name, 'utf-8'), unicode(node.name, 'utf-8')))
else:
- self._message[-1] += ('<%s' % node.name)
+ self._message[-1] += ('<%s' % unicode(node.name, 'utf-8'))
for prop in xml_attr_iter(node):
name = prop.name
if prop.ns() is not None:
@@ -239,9 +239,9 @@ class Message (object):
if len(self._message) == 0 or not(isinstance(self._message[-1], basestring)):
self._message.append('')
if node.ns() is not None and node.ns().name is not None:
- self._message[-1] += ('</%s:%s>' % (node.ns().name, node.name))
+ self._message[-1] += ('</%s:%s>' % (unicode(node.ns().name, 'utf-8'), unicode(node.name, 'utf-8')))
else:
- self._message[-1] += ('</%s>' % node.name)
+ self._message[-1] += ('</%s>' % unicode(node.name, 'utf-8'))
def is_empty (self):
return self._empty
diff --git a/tests/IT-prefixes-1.ll.po b/tests/IT-prefixes-1.ll.po
index b73a067..fd29dc6 100644
--- a/tests/IT-prefixes-1.ll.po
+++ b/tests/IT-prefixes-1.ll.po
@@ -9,28 +9,18 @@ msgstr ""
"Content-Type: text/plain; charset=UTF-8\n"
"Content-Transfer-Encoding: 8bit\n"
-#. (itstool) path: media
-#. This is a reference to an external file such as an image or video. When
-#. the file changes, the md5 hash will change to let you know you need to
-#. update your localized copy. The msgstr is not used at all. Set it to
-#. whatever you like once you have updated your copy of the file.
-#: tests/IT-prefixes-1.xml:7
-msgctxt "_"
-msgid "external ref='movie.avi' md5='__failed__'"
-msgstr "external ref='movie.avi' md5='__failed__'"
-
#. (itstool) path: page/p
-#: tests/IT-prefixes-1.xml:6
+#: tests/IT-prefixes-1.xml:11
msgid "This is a test of namespace <its:span>prefixes</its:span>"
msgstr "Ceci est un test de <its:span>préfixes</its:span> d'espace de noms."
#. (itstool) path: div/p
-#: tests/IT-prefixes-1.xml:11
+#: tests/IT-prefixes-1.xml:16
msgid "Drag <tt:span>pieces</tt:span> from the right to the left."
msgstr "Faites glisser des <tt:span>pièces</tt:span> de la gauche vers la droite."
#. (itstool) path: div/p
-#: tests/IT-prefixes-1.xml:14
+#: tests/IT-prefixes-1.xml:19
msgid "Hold down <mal:key>Ctrl</mal:key>."
msgstr "Maintenez la touche <mal:key>Ctrl</mal:key>."
diff --git a/tests/IT-prefixes-1.ll.xml b/tests/IT-prefixes-1.ll.xml
index a7c0e3d..6dd1f30 100644
--- a/tests/IT-prefixes-1.ll.xml
+++ b/tests/IT-prefixes-1.ll.xml
@@ -1,5 +1,10 @@
<?xml version="1.0" encoding="utf-8"?>
-<page xmlns="http://projectmallard.org/1.0/" xmlns:mal="http://projectmallard.org/1.0/" xmlns:its="http://www.w3.org/2005/11/its" xmlns:tt="http://www.w3.org/ns/ttml" xml:lang="test">
+<page xmlns="http://projectmallard.org/1.0/" xmlns:mal="http://projectmallard.org/1.0/" xmlns:its="http://www.w3.org/2005/11/its" xmlns:tt="http://www.w3.org/ns/ttml">
+ <info>
+ <its:rules version="1.0">
+ <its:withinTextRule selector="//mal:p//* | //tt:p//*" withinText="yes"/>
+ </its:rules>
+ </info>
<p>Ceci est un test de <its:span>préfixes</its:span> d'espace de noms.</p>
<media type="video" src="movie.avi">
<tt:tt>
diff --git a/tests/IT-prefixes-1.pot b/tests/IT-prefixes-1.pot
index a529797..547978f 100644
--- a/tests/IT-prefixes-1.pot
+++ b/tests/IT-prefixes-1.pot
@@ -9,28 +9,18 @@ msgstr ""
"Content-Type: text/plain; charset=UTF-8\n"
"Content-Transfer-Encoding: 8bit\n"
-#. (itstool) path: media
-#. This is a reference to an external file such as an image or video. When
-#. the file changes, the md5 hash will change to let you know you need to
-#. update your localized copy. The msgstr is not used at all. Set it to
-#. whatever you like once you have updated your copy of the file.
-#: tests/IT-prefixes-1.xml:7
-msgctxt "_"
-msgid "external ref='movie.avi' md5='__failed__'"
-msgstr ""
-
#. (itstool) path: page/p
-#: tests/IT-prefixes-1.xml:6
+#: tests/IT-prefixes-1.xml:11
msgid "This is a test of namespace <its:span>prefixes</its:span>"
msgstr ""
#. (itstool) path: div/p
-#: tests/IT-prefixes-1.xml:11
+#: tests/IT-prefixes-1.xml:16
msgid "Drag <tt:span>pieces</tt:span> from the right to the left."
msgstr ""
#. (itstool) path: div/p
-#: tests/IT-prefixes-1.xml:14
+#: tests/IT-prefixes-1.xml:19
msgid "Hold down <mal:key>Ctrl</mal:key>."
msgstr ""
diff --git a/tests/IT-prefixes-1.xml b/tests/IT-prefixes-1.xml
index c0aaf80..7530ccd 100644
--- a/tests/IT-prefixes-1.xml
+++ b/tests/IT-prefixes-1.xml
@@ -3,6 +3,11 @@
xmlns:mal="http://projectmallard.org/1.0/"
xmlns:its="http://www.w3.org/2005/11/its"
xmlns:tt="http://www.w3.org/ns/ttml">
+ <info>
+ <its:rules version="1.0">
+ <its:withinTextRule selector="//mal:p//* | //tt:p//*" withinText="yes"/>
+ </its:rules>
+ </info>
<p>This is a test of namespace <its:span>prefixes</its:span></p>
<media type="video" src="movie.avi">
<tt:tt>