[open-ils-commits] r13552 - branches/rel_1_6/build/i18n/scripts (dbs)
svn at svn.open-ils.org
svn at svn.open-ils.org
Wed Jul 8 23:23:03 EDT 2009
Author: dbs
Date: 2009-07-08 23:23:01 -0400 (Wed, 08 Jul 2009)
New Revision: 13552
Modified:
branches/rel_1_6/build/i18n/scripts/db-seed-i18n.py
branches/rel_1_6/build/i18n/scripts/dojo_resource.py
branches/rel_1_6/build/i18n/scripts/fieldmapper.py
branches/rel_1_6/build/i18n/scripts/ils_events.py
branches/rel_1_6/build/i18n/scripts/marc_tooltip_maker.py
Log:
Merge r13549, r13550, r13551 for a perfect set of i18n scripts
Modified: branches/rel_1_6/build/i18n/scripts/db-seed-i18n.py
===================================================================
--- branches/rel_1_6/build/i18n/scripts/db-seed-i18n.py 2009-07-09 03:19:31 UTC (rev 13551)
+++ branches/rel_1_6/build/i18n/scripts/db-seed-i18n.py 2009-07-09 03:23:01 UTC (rev 13552)
@@ -152,7 +152,7 @@
if not options.outfile:
outfile = sys.stdout
else:
- outfile = open(options.outfile, 'w')
+ outfile = codecs.open(options.outfile, encoding='utf-8', mode='w')
for insert in pot.sql:
outfile.write(insert + "\n")
else:
Modified: branches/rel_1_6/build/i18n/scripts/dojo_resource.py
===================================================================
--- branches/rel_1_6/build/i18n/scripts/dojo_resource.py 2009-07-09 03:19:31 UTC (rev 13551)
+++ branches/rel_1_6/build/i18n/scripts/dojo_resource.py 2009-07-09 03:23:01 UTC (rev 13552)
@@ -28,6 +28,7 @@
# GNU General Public License for more details.
import basel10n
+import codecs
import optparse
import polib
import re
@@ -57,7 +58,7 @@
# Avoid generating duplicate entries by keeping track of msgids
msgids = dict()
- bundle = simplejson.load(open(source, 'r'))
+ bundle = simplejson.load(codecs.open(source, encoding='utf-8', mode='r'))
for key, value in bundle.iteritems():
if value in msgids:
@@ -115,7 +116,7 @@
pot.loadpo(options.create)
pot.create_bundle()
if options.outfile:
- outfile = open(options.outfile, 'w')
+ outfile = codecs.open(options.outfile, encoding='utf-8', mode='w')
simplejson.dump(pot.msgs, outfile, indent=4)
else:
print(simplejson.dumps(pot.msgs, indent=4))
Modified: branches/rel_1_6/build/i18n/scripts/fieldmapper.py
===================================================================
--- branches/rel_1_6/build/i18n/scripts/fieldmapper.py 2009-07-09 03:19:31 UTC (rev 13551)
+++ branches/rel_1_6/build/i18n/scripts/fieldmapper.py 2009-07-09 03:23:01 UTC (rev 13552)
@@ -18,6 +18,7 @@
# GNU General Public License for more details.
import basel10n
+import codecs
import optparse
import polib
import sys
@@ -182,7 +183,7 @@
pot.loadpo(options.entity)
pot.create_entity()
if options.outfile:
- outfile = open(options.outfile, 'w')
+ outfile = codecs.open(options.outfile, encoding='utf-8', mode='w')
for entity in pot.definitions:
outfile.write(entity + "\n")
else:
@@ -192,7 +193,7 @@
elif options.convert:
pot.get_strings(options.convert)
if options.outfile:
- outfile = open(options.outfile, 'w')
+ outfile = codecs.open(options.outfile, encoding='utf-8', mode='w')
outfile.write(pot.idl)
else:
sys.stdout.write(pot.idl)
Modified: branches/rel_1_6/build/i18n/scripts/ils_events.py
===================================================================
--- branches/rel_1_6/build/i18n/scripts/ils_events.py 2009-07-09 03:19:31 UTC (rev 13551)
+++ branches/rel_1_6/build/i18n/scripts/ils_events.py 2009-07-09 03:23:01 UTC (rev 13552)
@@ -33,6 +33,7 @@
# GNU General Public License for more details.
import basel10n
+import codecs
import optparse
import polib
import re
@@ -204,7 +205,7 @@
pot.loadpo(options.create)
pot.create_events()
if options.outfile:
- outfile = open(options.outfile, 'w')
+ outfile = codecs.open(options.outfile, encoding='utf-8', mode='w')
outfile.write(head)
for event in pot.definitions:
outfile.write(event + "\n")
Modified: branches/rel_1_6/build/i18n/scripts/marc_tooltip_maker.py
===================================================================
--- branches/rel_1_6/build/i18n/scripts/marc_tooltip_maker.py 2009-07-09 03:19:31 UTC (rev 13551)
+++ branches/rel_1_6/build/i18n/scripts/marc_tooltip_maker.py 2009-07-09 03:23:01 UTC (rev 13552)
@@ -279,6 +279,7 @@
return field
if __name__ == '__main__':
+ import codecs
import copy
import os
import re
@@ -292,7 +293,7 @@
if (not re.compile(r'^040010-1\d\d\d-f.html').search(filename)):
continue
print filename
- devnull = open('/dev/null', 'w')
+ devnull = codecs.open('/dev/null', encoding='utf-8', mode='w')
file = subprocess.Popen(
('tidy', '-asxml', '-n', '-q', '-utf8', filename),
stdout=subprocess.PIPE, stderr=devnull).communicate()[0]
@@ -310,6 +311,6 @@
if (field):
ALL_MY_FIELDS.add_field(field)
- MARCOUT = open('marcedit-tooltips-fr.xml', 'w')
+ MARCOUT = codecs.open('marcedit-tooltips-fr.xml', encoding='utf-8', mode='w')
MARCOUT.write(ALL_MY_FIELDS.to_xml().encode('UTF-8'))
MARCOUT.close()
More information about the open-ils-commits
mailing list