summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorShaun McCance <shaunm@gnome.org>2012-09-21 09:39:42 -0400
committerShaun McCance <shaunm@gnome.org>2012-09-21 09:39:42 -0400
commit1440e3b495ae502658e5e5ede6c09babce4bc4f9 (patch)
treeaa6f455241af161d5f08f5fd2cb335b12ad975f9
parent2bca336117edee032ad956994d2ef3650f25e322 (diff)
downloaditstool-1440e3b495ae502658e5e5ede6c09babce4bc4f9.tar.gz
Support for local withinText
-rwxr-xr-xitstool.in12
-rw-r--r--tests/elementwithintextLocalXml.ll.po16
-rw-r--r--tests/elementwithintextLocalXml.ll.xml6
-rw-r--r--tests/elementwithintextLocalXml.pot16
-rw-r--r--tests/elementwithintextLocalXml.xml8
-rw-r--r--tests/elementwithintextlocalitsSpanXml.ll.po16
-rw-r--r--tests/elementwithintextlocalitsSpanXml.ll.xml6
-rw-r--r--tests/elementwithintextlocalitsSpanXml.pot16
-rw-r--r--tests/elementwithintextlocalitsSpanXml.xml7
-rw-r--r--tests/run_tests.py6
10 files changed, 107 insertions, 2 deletions
diff --git a/itstool.in b/itstool.in
index d00ba18..ec9cf72 100755
--- a/itstool.in
+++ b/itstool.in
@@ -1090,7 +1090,7 @@ class Document (object):
if node.hasNsProp('translate', NS_ITS):
val = node.nsProp('translate', NS_ITS)
elif xml_is_ns_name(node, NS_ITS, 'span') and node.hasNsProp('translate', None):
- val = node.nsProp('translate', None)
+ val = node.nsProp('translate', None)
elif self._its_translate_nodes.has_key(node):
val = self._its_translate_nodes[node]
if val is not None:
@@ -1102,7 +1102,15 @@ class Document (object):
return 'yes'
def get_its_within_text(self, node):
- return self._its_within_text_nodes.get(node, 'no')
+ if node.hasNsProp('withinText', NS_ITS):
+ val = node.nsProp('withinText', NS_ITS)
+ elif xml_is_ns_name(node, NS_ITS, 'span') and node.hasNsProp('withinText', None):
+ val = node.nsProp('withinText', None)
+ else:
+ return self._its_within_text_nodes.get(node, 'no')
+ if val in ('yes', 'nested'):
+ return val
+ return 'no'
def get_its_locale_filter(self, node):
if node.hasNsProp('localeFilterList', NS_ITS):
diff --git a/tests/elementwithintextLocalXml.ll.po b/tests/elementwithintextLocalXml.ll.po
new file mode 100644
index 0000000..7413773
--- /dev/null
+++ b/tests/elementwithintextLocalXml.ll.po
@@ -0,0 +1,16 @@
+msgid ""
+msgstr ""
+"Project-Id-Version: PACKAGE VERSION\n"
+"POT-Creation-Date: 2012-09-21 09:34-0400\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: body/par
+#: tests/elementwithintextLocalXml.xml:5
+msgid "Text with <bold its:withinText=\"yes\">bold</bold>."
+msgstr "Texte en <bold its:withinText=\"yes\">gras</bold>."
+
diff --git a/tests/elementwithintextLocalXml.ll.xml b/tests/elementwithintextLocalXml.ll.xml
new file mode 100644
index 0000000..fb950c0
--- /dev/null
+++ b/tests/elementwithintextLocalXml.ll.xml
@@ -0,0 +1,6 @@
+<?xml version="1.0" encoding="utf-8"?>
+<text xmlns:its="http://www.w3.org/2005/11/its" its:version="2.0">
+ <body>
+ <par>Texte en <bold its:withinText="yes">gras</bold>.</par>
+ </body>
+</text>
diff --git a/tests/elementwithintextLocalXml.pot b/tests/elementwithintextLocalXml.pot
new file mode 100644
index 0000000..2f9ff2a
--- /dev/null
+++ b/tests/elementwithintextLocalXml.pot
@@ -0,0 +1,16 @@
+msgid ""
+msgstr ""
+"Project-Id-Version: PACKAGE VERSION\n"
+"POT-Creation-Date: 2012-09-21 09:34-0400\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: body/par
+#: tests/elementwithintextLocalXml.xml:5
+msgid "Text with <bold its:withinText=\"yes\">bold</bold>."
+msgstr ""
+
diff --git a/tests/elementwithintextLocalXml.xml b/tests/elementwithintextLocalXml.xml
new file mode 100644
index 0000000..fd15d6d
--- /dev/null
+++ b/tests/elementwithintextLocalXml.xml
@@ -0,0 +1,8 @@
+<text
+ xmlns:its="http://www.w3.org/2005/11/its"
+ its:version="2.0">
+ <body>
+ <par>Text with <bold
+ its:withinText="yes">bold</bold>.</par>
+ </body>
+</text>
diff --git a/tests/elementwithintextlocalitsSpanXml.ll.po b/tests/elementwithintextlocalitsSpanXml.ll.po
new file mode 100644
index 0000000..e668a5a
--- /dev/null
+++ b/tests/elementwithintextlocalitsSpanXml.ll.po
@@ -0,0 +1,16 @@
+msgid ""
+msgstr ""
+"Project-Id-Version: PACKAGE VERSION\n"
+"POT-Creation-Date: 2012-09-20 08:51-0400\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: body/par
+#: tests/elementwithintextlocalitsSpanXml.xml:5
+msgid "Text with <its:span withinText=\"yes\">bold</its:span>."
+msgstr "Texte en <its:span withinText=\"yes\">gras</its:span>."
+
diff --git a/tests/elementwithintextlocalitsSpanXml.ll.xml b/tests/elementwithintextlocalitsSpanXml.ll.xml
new file mode 100644
index 0000000..72d0670
--- /dev/null
+++ b/tests/elementwithintextlocalitsSpanXml.ll.xml
@@ -0,0 +1,6 @@
+<?xml version="1.0" encoding="utf-8"?>
+<text xmlns:its="http://www.w3.org/2005/11/its" its:version="2.0">
+ <body>
+ <par>Texte en <its:span withinText="yes">gras</its:span>.</par>
+ </body>
+</text>
diff --git a/tests/elementwithintextlocalitsSpanXml.pot b/tests/elementwithintextlocalitsSpanXml.pot
new file mode 100644
index 0000000..6995416
--- /dev/null
+++ b/tests/elementwithintextlocalitsSpanXml.pot
@@ -0,0 +1,16 @@
+msgid ""
+msgstr ""
+"Project-Id-Version: PACKAGE VERSION\n"
+"POT-Creation-Date: 2012-09-20 08:51-0400\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: body/par
+#: tests/elementwithintextlocalitsSpanXml.xml:5
+msgid "Text with <its:span withinText=\"yes\">bold</its:span>."
+msgstr ""
+
diff --git a/tests/elementwithintextlocalitsSpanXml.xml b/tests/elementwithintextlocalitsSpanXml.xml
new file mode 100644
index 0000000..d9927ee
--- /dev/null
+++ b/tests/elementwithintextlocalitsSpanXml.xml
@@ -0,0 +1,7 @@
+<text
+ xmlns:its="http://www.w3.org/2005/11/its"
+ its:version="2.0">
+ <body>
+ <par>Text with <its:span withinText="yes">bold</its:span>.</par>
+ </body>
+</text>
diff --git a/tests/run_tests.py b/tests/run_tests.py
index 83d3d21..e32c874 100644
--- a/tests/run_tests.py
+++ b/tests/run_tests.py
@@ -254,6 +254,12 @@ class ItstoolTests(unittest.TestCase):
self._test_translation_join('LocaleFilter/Locale5Xml.xml',
('fr_FR', 'fr_CA', 'fr_CH'))
+ def test_elementwithintextlocalitsSpanXml(self):
+ self._test_translation_process('elementwithintextlocalitsSpanXml.xml')
+
+ def test_elementwithintextLocalXml(self):
+ self._test_translation_process('elementwithintextLocalXml.xml')
+
def test_WithinText1(self):
self._test_translation_process('WithinText1.xml')