Imported Upstream version 1.1.3 57/195157/1 upstream/1.1.3
authorDongHun Kwak <dh0128.kwak@samsung.com>
Tue, 11 Dec 2018 07:07:30 +0000 (16:07 +0900)
committerDongHun Kwak <dh0128.kwak@samsung.com>
Tue, 11 Dec 2018 07:07:30 +0000 (16:07 +0900)
Change-Id: I16a96d0e4cd3953a1ee8566cea0bd0a7693c986e
Signed-off-by: DongHun Kwak <dh0128.kwak@samsung.com>
ChangeLog
NEWS
configure
configure.ac
itstool
itstool.1
itstool.in

index f7c24f6..e033020 100644 (file)
--- a/ChangeLog
+++ b/ChangeLog
@@ -1,3 +1,49 @@
+commit 63e2b5739977a99a70898e6c78798b7eaa66293e
+Author: Shaun McCance <shaunm@gnome.org>
+Date:   Wed Apr 4 12:39:06 2012 -0400
+
+    Don't error out when invalid msgstr is non-ascii
+
+ itstool.in |    3 ++-
+ 1 files changed, 2 insertions(+), 1 deletions(-)
+
+commit 367d347cfc0d7bfcc25ab5b83c59e8824af4ae27
+Author: Shaun McCance <shaunm@gnome.org>
+Date:   Mon Apr 2 10:16:29 2012 -0400
+
+    Proper error message when source XML file can't be read
+
+ itstool.in |    6 +++++-
+ 1 files changed, 5 insertions(+), 1 deletions(-)
+
+commit 3ff47350b0386c971e4fb1955f87fefc2c5aafd1
+Author: Shaun McCance <shaunm@gnome.org>
+Date:   Mon Apr 2 09:51:30 2012 -0400
+
+    Handle UTF-8 in attribute values
+
+ itstool.in |    2 ++
+ 1 files changed, 2 insertions(+), 0 deletions(-)
+
+commit 1e0fa47194bbfcbd30e402a4897a0856a6045b73
+Author: Shaun McCance <shaunm@gnome.org>
+Date:   Fri Mar 23 10:09:55 2012 -0400
+
+    Don't output external ref messages under its:translate="no"
+
+ itstool.in |    9 +++++++++
+ 1 files changed, 9 insertions(+), 0 deletions(-)
+
+commit 80b34e2870abd08cb96f2929d8ee32acab3d89e9
+Author: Shaun McCance <shaunm@gnome.org>
+Date:   Sun Feb 5 11:53:41 2012 -0500
+
+    Version 1.1.2
+
+ NEWS         |    4 ++++
+ configure.ac |    2 +-
+ 2 files changed, 5 insertions(+), 1 deletions(-)
+
 commit ed24c8ab3b22a085daea614638cbc15796011f15
 Author: Shaun McCance <shaunm@gnome.org>
 Date:   Tue Sep 27 10:16:55 2011 -0400
diff --git a/NEWS b/NEWS
index 6ae866f..6796124 100644 (file)
--- a/NEWS
+++ b/NEWS
@@ -1,3 +1,9 @@
+1.1.3
+=====
+* Handle UTF-8 in attribute values
+* Don't output non-translatable external ref messages
+* Better error handling
+
 1.1.2
 =====
 * Better handling of XML errors in PO files
index 92c28b0..9bcc46b 100755 (executable)
--- a/configure
+++ b/configure
@@ -1,6 +1,6 @@
 #! /bin/sh
 # Guess values for system-dependent variables and create Makefiles.
-# Generated by GNU Autoconf 2.66 for itstool 1.1.2.
+# Generated by GNU Autoconf 2.66 for itstool 1.1.3.
 #
 #
 # Copyright (C) 1992, 1993, 1994, 1995, 1996, 1998, 1999, 2000, 2001,
@@ -548,8 +548,8 @@ MAKEFLAGS=
 # Identity of this package.
 PACKAGE_NAME='itstool'
 PACKAGE_TARNAME='itstool'
-PACKAGE_VERSION='1.1.2'
-PACKAGE_STRING='itstool 1.1.2'
+PACKAGE_VERSION='1.1.3'
+PACKAGE_STRING='itstool 1.1.3'
 PACKAGE_BUGREPORT=''
 PACKAGE_URL=''
 
@@ -1165,7 +1165,7 @@ if test "$ac_init_help" = "long"; then
   # Omit some internal or obsolete options to make the list less imposing.
   # This message is too long to be a string in the A/UX 3.1 sh.
   cat <<_ACEOF
-\`configure' configures itstool 1.1.2 to adapt to many kinds of systems.
+\`configure' configures itstool 1.1.3 to adapt to many kinds of systems.
 
 Usage: $0 [OPTION]... [VAR=VALUE]...
 
@@ -1231,7 +1231,7 @@ fi
 
 if test -n "$ac_init_help"; then
   case $ac_init_help in
-     short | recursive ) echo "Configuration of itstool 1.1.2:";;
+     short | recursive ) echo "Configuration of itstool 1.1.3:";;
    esac
   cat <<\_ACEOF
 
@@ -1298,7 +1298,7 @@ fi
 test -n "$ac_init_help" && exit $ac_status
 if $ac_init_version; then
   cat <<\_ACEOF
-itstool configure 1.1.2
+itstool configure 1.1.3
 generated by GNU Autoconf 2.66
 
 Copyright (C) 2010 Free Software Foundation, Inc.
@@ -1315,7 +1315,7 @@ cat >config.log <<_ACEOF
 This file contains any messages produced by compilers while
 running configure, to aid debugging if configure makes a mistake.
 
-It was created by itstool $as_me 1.1.2, which was
+It was created by itstool $as_me 1.1.3, which was
 generated by GNU Autoconf 2.66.  Invocation command line was
 
   $ $0 $@
@@ -2130,7 +2130,7 @@ fi
 
 # Define the identity of the package.
  PACKAGE='itstool'
- VERSION='1.1.2'
+ VERSION='1.1.3'
 
 
 cat >>confdefs.h <<_ACEOF
@@ -2726,7 +2726,7 @@ cat >>$CONFIG_STATUS <<\_ACEOF || ac_write_fail=1
 # report actual input values of CONFIG_FILES etc. instead of their
 # values after options handling.
 ac_log="
-This file was extended by itstool $as_me 1.1.2, which was
+This file was extended by itstool $as_me 1.1.3, which was
 generated by GNU Autoconf 2.66.  Invocation command line was
 
   CONFIG_FILES    = $CONFIG_FILES
@@ -2779,7 +2779,7 @@ _ACEOF
 cat >>$CONFIG_STATUS <<_ACEOF || ac_write_fail=1
 ac_cs_config="`$as_echo "$ac_configure_args" | sed 's/^ //; s/[\\""\`\$]/\\\\&/g'`"
 ac_cs_version="\\
-itstool config.status 1.1.2
+itstool config.status 1.1.3
 configured by $0, generated by GNU Autoconf 2.66,
   with options \\"\$ac_cs_config\\"
 
index d377b5f..2dc4e6f 100644 (file)
@@ -1,4 +1,4 @@
-AC_INIT([itstool], [1.1.2], [])
+AC_INIT([itstool], [1.1.3], [])
 AM_INIT_AUTOMAKE([1.9 no-dist-gzip dist-bzip2])
 
 DATADIR=`(
diff --git a/itstool b/itstool
index 7d35cfd..03b8598 100644 (file)
--- a/itstool
+++ b/itstool
@@ -17,7 +17,7 @@
 # Place, Suite 330, Boston, MA  0211-1307  USA.
 #
 
-VERSION="1.1.2"
+VERSION="1.1.3"
 DATADIR="/usr/local/share"
 
 import gettext
@@ -169,6 +169,8 @@ class Message (object):
                     if prop.ns() is not None:
                         name = prop.ns().name + ':' + name
                     atval = prop.content
+                    if not isinstance(atval, unicode):
+                        atval = unicode(atval, 'utf-8')
                     atval = atval.replace('&', '&amp;').replace('<', '&lt;').replace('>', '&gt;').replace('"', '&quot;')
                     self._message += " %s=\"%s\"" % (name, atval)
         if node.children is not None:
@@ -295,7 +297,11 @@ class Document (object):
     def __init__ (self, filename, messages):
         self._xml_err = ''
         libxml2.registerErrorHandler(xml_error_catcher, self)
-        ctxt = libxml2.createFileParserCtxt(filename)
+        try:
+            ctxt = libxml2.createFileParserCtxt(filename)
+        except:
+            sys.stderr.write('Error: cannot open XML file %s\n' % filename)
+            sys.exit(1)
         ctxt.lineNumbers(1)
         ctxt.replaceEntities(1)
         ctxt.parseDocument()
@@ -707,7 +713,8 @@ class Document (object):
             if strict:
                 raise
             else:
-                sys.stderr.write('Warning: Could not merge translation for msgid:\n%s\n' % msgstr)
+                sys.stderr.write('Warning: Could not merge translation for msgid:\n%s\n' %
+                                 msgstr.encode('utf-8'))
                 self._xml_err = ''
                 return node
         def scan_node(node):
@@ -734,6 +741,15 @@ class Document (object):
         if self._itst_credits is not None:
             self._msgs.add_credits()
         for ext in self._itst_externals:
+            translate = None
+            node = ext[0]
+            while node != None:
+                translate = self.get_its_translate(node)
+                if translate is not None:
+                    break
+                node = node.parent
+            if translate == 'no':
+                continue
             msg = Message()
             try:
                 fullfile = os.path.join(os.path.dirname(self._filename), ext[1])
index 788a9a2..bcc8531 100644 (file)
--- a/itstool.1
+++ b/itstool.1
@@ -1,4 +1,4 @@
-.TH ITSTOOL "1" "May 2011" "itstool 1.1.2"
+.TH ITSTOOL "1" "May 2011" "itstool 1.1.3"
 .SH NAME
 itstool \- convert between XML and PO using ITS
 
index 4c731f5..f6c1ca7 100755 (executable)
@@ -169,6 +169,8 @@ class Message (object):
                     if prop.ns() is not None:
                         name = prop.ns().name + ':' + name
                     atval = prop.content
+                    if not isinstance(atval, unicode):
+                        atval = unicode(atval, 'utf-8')
                     atval = atval.replace('&', '&amp;').replace('<', '&lt;').replace('>', '&gt;').replace('"', '&quot;')
                     self._message += " %s=\"%s\"" % (name, atval)
         if node.children is not None:
@@ -295,7 +297,11 @@ class Document (object):
     def __init__ (self, filename, messages):
         self._xml_err = ''
         libxml2.registerErrorHandler(xml_error_catcher, self)
-        ctxt = libxml2.createFileParserCtxt(filename)
+        try:
+            ctxt = libxml2.createFileParserCtxt(filename)
+        except:
+            sys.stderr.write('Error: cannot open XML file %s\n' % filename)
+            sys.exit(1)
         ctxt.lineNumbers(1)
         ctxt.replaceEntities(1)
         ctxt.parseDocument()
@@ -707,7 +713,8 @@ class Document (object):
             if strict:
                 raise
             else:
-                sys.stderr.write('Warning: Could not merge translation for msgid:\n%s\n' % msgstr)
+                sys.stderr.write('Warning: Could not merge translation for msgid:\n%s\n' %
+                                 msgstr.encode('utf-8'))
                 self._xml_err = ''
                 return node
         def scan_node(node):
@@ -734,6 +741,15 @@ class Document (object):
         if self._itst_credits is not None:
             self._msgs.add_credits()
         for ext in self._itst_externals:
+            translate = None
+            node = ext[0]
+            while node != None:
+                translate = self.get_its_translate(node)
+                if translate is not None:
+                    break
+                node = node.parent
+            if translate == 'no':
+                continue
             msg = Message()
             try:
                 fullfile = os.path.join(os.path.dirname(self._filename), ext[1])