From d422b3af23411e57a1113f804c7ea8bfd337d131 Mon Sep 17 00:00:00 2001 From: dbs Date: Tue, 28 Jul 2009 06:26:25 +0000 Subject: [PATCH] Make i18n scripts stricter about UTF-8 input/output handling. Also, be strict about the JSON format of strings in Dojo resource bundles. git-svn-id: svn://svn.open-ils.org/ILS/trunk@13751 dcc99617-32d9-48b4-a31d-7c20da2025e4 --- build/i18n/scripts/db-seed-i18n.py | 2 +- build/i18n/scripts/dojo_resource.py | 4 ++-- build/i18n/scripts/fieldmapper.py | 4 ++-- build/i18n/scripts/ils_events.py | 4 ++-- 4 files changed, 7 insertions(+), 7 deletions(-) diff --git a/build/i18n/scripts/db-seed-i18n.py b/build/i18n/scripts/db-seed-i18n.py index 7f3419461..608fbbed3 100755 --- a/build/i18n/scripts/db-seed-i18n.py +++ b/build/i18n/scripts/db-seed-i18n.py @@ -119,7 +119,7 @@ class SQL(basel10n.BaseL10N): 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(): """ diff --git a/build/i18n/scripts/dojo_resource.py b/build/i18n/scripts/dojo_resource.py index 2320f2a56..6e069e8e2 100755 --- a/build/i18n/scripts/dojo_resource.py +++ b/build/i18n/scripts/dojo_resource.py @@ -7,8 +7,8 @@ Requires polib from http://polib.googlecode.com 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 diff --git a/build/i18n/scripts/fieldmapper.py b/build/i18n/scripts/fieldmapper.py index 385fce518..bcff5dd5c 100755 --- a/build/i18n/scripts/fieldmapper.py +++ b/build/i18n/scripts/fieldmapper.py @@ -69,9 +69,9 @@ class IDL(basel10n.BaseL10N): 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): """ diff --git a/build/i18n/scripts/ils_events.py b/build/i18n/scripts/ils_events.py index 1b8193c8d..58252005e 100755 --- a/build/i18n/scripts/ils_events.py +++ b/build/i18n/scripts/ils_events.py @@ -98,9 +98,9 @@ class ILSEvents(basel10n.BaseL10N): 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): """ -- 2.11.0