summaryrefslogtreecommitdiff
path: root/bin/addons/base/module/wizard/wizard_export_lang.py
diff options
context:
space:
mode:
authorChristophe Simonis <christophe@tinyerp.com>2008-07-22 09:38:43 +0200
committerChristophe Simonis <christophe@tinyerp.com>2008-07-22 09:38:43 +0200
commit63ceebdf364bc1e08a580dc994c7d18f708fc619 (patch)
tree86fad8e491d0054dd6f753fe4f8d06d0f717d0ce /bin/addons/base/module/wizard/wizard_export_lang.py
parent2ccf0092a7e78b766a03475feedc12ca6c6dc21a (diff)
i18n: allow export into a po file from command line
bzr revid: christophe@tinyerp.com-20080722073843-16r67df83yz8z0tb
Diffstat (limited to 'bin/addons/base/module/wizard/wizard_export_lang.py')
-rw-r--r--bin/addons/base/module/wizard/wizard_export_lang.py18
1 files changed, 4 insertions, 14 deletions
diff --git a/bin/addons/base/module/wizard/wizard_export_lang.py b/bin/addons/base/module/wizard/wizard_export_lang.py
index 9571f7267cd..3f7fa8f99df 100644
--- a/bin/addons/base/module/wizard/wizard_export_lang.py
+++ b/bin/addons/base/module/wizard/wizard_export_lang.py
@@ -125,25 +125,15 @@ class wizard_export_lang(osv.osv_memory):
this = self.browse(cr, uid, ids)[0]
mods = map(lambda m: m.name, this.modules)
mods.sort()
- file=tools.trans_generate(this.lang, mods, dbname=cr.dbname)
buf=StringIO.StringIO()
-
+
+ tools.trans_export(this.lang, mods, buf, this.format, dbname=cr.dbname)
+
if this.format == 'csv':
this.advice = _("Save this document to a .CSV file and open it with your favourite spreadsheet software. The file encoding is UTF-8. You have to translate the latest column before reimporting it.")
- writer=csv.writer(buf, 'UNIX')
- for row in file:
- writer.writerow(row)
elif this.format == 'po':
this.advice = _("Save this document to a .po file and edit it with a specific software or a text editor. The file encoding is UTF-8.")
- file.pop(0)
- writer = tools.TinyPoFile(buf)
- writer.write_infos(mods)
- for module, type, name, res_id, src, trad in file:
- writer.write(module, type, name, res_id, src, trad)
- else:
- raise osv_except(_('Bad file format'))
-
- del file
+
out=base64.encodestring(buf.getvalue())
buf.close()
return self.write(cr, uid, ids, {'state':'get', 'data':out, 'advice':this.advice}, context=context)