[open-ils-commits] r13758 - branches/rel_1_6_0/build/i18n/scripts (dbs)

svn at svn.open-ils.org svn at svn.open-ils.org
Tue Jul 28 09:43:01 EDT 2009


Author: dbs
Date: 2009-07-28 09:42:59 -0400 (Tue, 28 Jul 2009)
New Revision: 13758

Modified:
   branches/rel_1_6_0/build/i18n/scripts/db-seed-i18n.py
   branches/rel_1_6_0/build/i18n/scripts/dojo_resource.py
   branches/rel_1_6_0/build/i18n/scripts/fieldmapper.py
   branches/rel_1_6_0/build/i18n/scripts/ils_events.py
Log:
Backport r13751 from trunk: Make i18n scripts stricter about UTF-8 input/output handling.

Modified: branches/rel_1_6_0/build/i18n/scripts/db-seed-i18n.py
===================================================================
--- branches/rel_1_6_0/build/i18n/scripts/db-seed-i18n.py	2009-07-28 13:42:29 UTC (rev 13757)
+++ branches/rel_1_6_0/build/i18n/scripts/db-seed-i18n.py	2009-07-28 13:42:59 UTC (rev 13758)
@@ -119,7 +119,7 @@
                 if msgstr == '':
                     # Don't generate a stmt for an untranslated string
                     break
-                self.sql.append(insert % (identifier.group('class'), occurid, locale, msgstr))
+                self.sql.append(unicode(insert % (identifier.group('class'), occurid, locale, msgstr), 'utf_8'))
 
 def main():
     """

Modified: branches/rel_1_6_0/build/i18n/scripts/dojo_resource.py
===================================================================
--- branches/rel_1_6_0/build/i18n/scripts/dojo_resource.py	2009-07-28 13:42:29 UTC (rev 13757)
+++ branches/rel_1_6_0/build/i18n/scripts/dojo_resource.py	2009-07-28 13:42:59 UTC (rev 13758)
@@ -7,8 +7,8 @@
 
 Source event definitions are structured as follows:
 {
-    MSG_ID1: "This is a message with 1 variable - ${0}.",
-    MSG_ID2: "This is a message with two variables: ${0} and ${1}."
+    "MSG_ID1": "This is a message with 1 variable - ${0}.",
+    "MSG_ID2": "This is a message with two variables: ${0} and ${1}."
 }
 
 Note that this is a deliberately limited subset of the variable substitution

Modified: branches/rel_1_6_0/build/i18n/scripts/fieldmapper.py
===================================================================
--- branches/rel_1_6_0/build/i18n/scripts/fieldmapper.py	2009-07-28 13:42:29 UTC (rev 13757)
+++ branches/rel_1_6_0/build/i18n/scripts/fieldmapper.py	2009-07-28 13:42:59 UTC (rev 13758)
@@ -69,9 +69,9 @@
             for name in entry.occurrences:
                 if entry.msgstr == '':
                     # No translation available; use the en-US definition
-                    self.definitions.append(entity % (name[0], entry.msgid))
+                    self.definitions.append(unicode(entity % (name[0], entry.msgid), 'utf_8'))
                 else:
-                    self.definitions.append(entity % (name[0], entry.msgstr))
+                    self.definitions.append(unicode(entity % (name[0], entry.msgstr), 'utf_8'))
 
 class IDLHandler(xml.sax.handler.ContentHandler):
     """

Modified: branches/rel_1_6_0/build/i18n/scripts/ils_events.py
===================================================================
--- branches/rel_1_6_0/build/i18n/scripts/ils_events.py	2009-07-28 13:42:29 UTC (rev 13757)
+++ branches/rel_1_6_0/build/i18n/scripts/ils_events.py	2009-07-28 13:42:59 UTC (rev 13758)
@@ -98,9 +98,9 @@
 
                 if entry.msgstr == '':
                     # No translation available; use the en-US definition
-                    self.definitions.append(event % (int(numcode), textcode, self.locale, entry.msgid))
+                    self.definitions.append(unicode(event % (int(numcode), textcode, self.locale, entry.msgid), 'utf_8'))
                 else:
-                    self.definitions.append(event % (int(numcode), textcode, self.locale, entry.msgstr))
+                    self.definitions.append(unicode(event % (int(numcode), textcode, self.locale, entry.msgstr), 'utf_8'))
 
 class ILSEventHandler(xml.sax.handler.ContentHandler):
     """



More information about the open-ils-commits mailing list