[open-ils-commits] r16668 - branches/rel_1_6/build/i18n/scripts (dbs)
svn at svn.open-ils.org
svn at svn.open-ils.org
Thu Jun 10 23:32:25 EDT 2010
Author: dbs
Date: 2010-06-10 23:32:22 -0400 (Thu, 10 Jun 2010)
New Revision: 16668
Modified:
branches/rel_1_6/build/i18n/scripts/dojo_resource.py
Log:
Merge r16605 and r16607 from trunk for Dojo i18n enhancements:
* Create output directories if they do no exist (r16605)
* Identify problem file when generating POT from Dojo resource files (r16607)
Modified: branches/rel_1_6/build/i18n/scripts/dojo_resource.py
===================================================================
--- branches/rel_1_6/build/i18n/scripts/dojo_resource.py 2010-06-11 03:27:47 UTC (rev 16667)
+++ branches/rel_1_6/build/i18n/scripts/dojo_resource.py 2010-06-11 03:32:22 UTC (rev 16668)
@@ -35,6 +35,7 @@
import sys
import simplejson
import os.path
+import os
class DojoResource (basel10n.BaseL10N):
"""
@@ -58,7 +59,11 @@
# Avoid generating duplicate entries by keeping track of msgids
msgids = dict()
- bundle = simplejson.load(codecs.open(source, encoding='utf-8', mode='r'))
+ try:
+ bundle = simplejson.load(codecs.open(source, encoding='utf-8', mode='r'))
+ except ValueError:
+ print("Reading Dojo resource file %s" % (source))
+ raise
for key, value in bundle.iteritems():
if value in msgids:
@@ -110,6 +115,8 @@
if options.pot:
pot.get_strings(options.pot)
if options.outfile:
+ if not os.path.exists(options.outfile):
+ os.makedirs(os.path.dirname(options.outfile))
pot.savepot(options.outfile)
else:
sys.stdout.write(pot.pot.__str__())
@@ -119,6 +126,8 @@
pot.loadpo(options.create)
pot.create_bundle()
if options.outfile:
+ if not os.path.exists(options.outfile):
+ os.makedirs(os.path.dirname(options.outfile))
outfile = codecs.open(options.outfile, encoding='utf-8', mode='w')
simplejson.dump(pot.msgs, outfile, indent=4)
else:
More information about the open-ils-commits
mailing list