[open-ils-commits] r13751 - trunk/build/i18n/scripts (dbs)

svn at svn.open-ils.org svn at svn.open-ils.org
Tue Jul 28 02:26:29 EDT 2009


Author: dbs
Date: 2009-07-28 02:26:25 -0400 (Tue, 28 Jul 2009)
New Revision: 13751

Modified:
   trunk/build/i18n/scripts/db-seed-i18n.py
   trunk/build/i18n/scripts/dojo_resource.py
   trunk/build/i18n/scripts/fieldmapper.py
   trunk/build/i18n/scripts/ils_events.py
Log:
Make i18n scripts stricter about UTF-8 input/output handling.
Also, be strict about the JSON format of strings in Dojo resource bundles.


Modified: trunk/build/i18n/scripts/db-seed-i18n.py
===================================================================
--- trunk/build/i18n/scripts/db-seed-i18n.py	2009-07-28 05:17:59 UTC (rev 13750)
+++ trunk/build/i18n/scripts/db-seed-i18n.py	2009-07-28 06:26:25 UTC (rev 13751)
@@ -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: trunk/build/i18n/scripts/dojo_resource.py
===================================================================
--- trunk/build/i18n/scripts/dojo_resource.py	2009-07-28 05:17:59 UTC (rev 13750)
+++ trunk/build/i18n/scripts/dojo_resource.py	2009-07-28 06:26:25 UTC (rev 13751)
@@ -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: trunk/build/i18n/scripts/fieldmapper.py
===================================================================
--- trunk/build/i18n/scripts/fieldmapper.py	2009-07-28 05:17:59 UTC (rev 13750)
+++ trunk/build/i18n/scripts/fieldmapper.py	2009-07-28 06:26:25 UTC (rev 13751)
@@ -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: trunk/build/i18n/scripts/ils_events.py
===================================================================
--- trunk/build/i18n/scripts/ils_events.py	2009-07-28 05:17:59 UTC (rev 13750)
+++ trunk/build/i18n/scripts/ils_events.py	2009-07-28 06:26:25 UTC (rev 13751)
@@ -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