[gimp-help] Fix validate_po to not show an error for <? ... ?> XML constructs
- From: Jacob Boerema <jboerema src gnome org>
- To: commits-list gnome org
- Cc:
- Subject: [gimp-help] Fix validate_po to not show an error for <? ... ?> XML constructs
- Date: Mon, 13 Jun 2022 17:42:08 +0000 (UTC)
commit 7e4646ce764702768c4166d36e96e8532ff0a1cf
Author: Jacob Boerema <jgboerema gmail com>
Date: Mon Jun 13 12:55:02 2022 -0400
Fix validate_po to not show an error for <? ... ?> XML constructs
(cherry picked from commit ae0f1f2a31ae2acd262c1744eb656dbe95cd9587)
tools/test/test.po | 7 ++++++-
tools/validate_po.py | 6 ++++++
2 files changed, 12 insertions(+), 1 deletion(-)
---
diff --git a/tools/test/test.po b/tools/test/test.po
index 89889681b..55a85c27b 100644
--- a/tools/test/test.po
+++ b/tools/test/test.po
@@ -107,7 +107,7 @@ msgstr ""
"</emphasis>"
#: src/menus/colors/desaturate/desaturate.xml:200(para)
-# ERROR: illegal vertical tab
+# ERROR: illegal vertical tab (currently a WARNING due to polib limitations)
msgid ""
"Using escaped\ttext\vnextline\n\"quote\" literal \\ etc."
msgstr ""
@@ -155,3 +155,8 @@ msgstr ""
"keycombo>). Εάν χρειάζεστε περισσότερη βοήθεια για το πώς να το κάνετε αυτό, "
"ανατρέξτε στις <link linkend=\"anchor-floating-selection\">Αιωρούμενες "
"επιλογές</link>."
+
+#: src/gimp.xml:29(year)
+#: OK: <? ... ?> defines commands in XML
+msgid "2002-<?dbtimestamp format=\"Y\"?>"
+msgstr "2002-<?dbtimestamp format=\"Y\"?>"
diff --git a/tools/validate_po.py b/tools/validate_po.py
index 8d8b48d61..e5245708f 100644
--- a/tools/validate_po.py
+++ b/tools/validate_po.py
@@ -88,6 +88,12 @@ class Validate(object):
print(f"WARNING: XML comment closing tag missing", file=self.log)
start_tag = -1
continue
+ elif end_tag > 2 and textblock[0] == '?' and textblock[end_tag-1] == '?':
+ # XML "external command"
+ # This can be improved to explicitly search for end with '?>'
+ textblock = textblock[end_tag+1:]
+ start_tag = textblock.find('<')
+ continue
if end_tag > -1:
# Found left and right brackets: grab tag
[
Date Prev][
Date Next] [
Thread Prev][
Thread Next]
[
Thread Index]
[
Date Index]
[
Author Index]