From 0b1dfd702fd5b087f0e1be81ccf3ed77f0dcf3da Mon Sep 17 00:00:00 2001 From: Christophe Simonis Date: Tue, 8 Jul 2008 08:13:12 +0000 Subject: * translation of nearly all exceptions * the export of translations per module take only the files of these modules bzr revid: chs@tinyerp.com-52cb3686b17250df7bc23bf90d18397c7888e6f2 --- bin/addons/base/module/wizard/wizard_export_lang.py | 4 ++-- bin/addons/base/module/wizard/wizard_import_lang.py | 8 ++++++-- bin/addons/base/module/wizard/wizard_module_import.py | 2 +- 3 files changed, 9 insertions(+), 5 deletions(-) (limited to 'bin/addons/base/module/wizard') diff --git a/bin/addons/base/module/wizard/wizard_export_lang.py b/bin/addons/base/module/wizard/wizard_export_lang.py index a42e3ec430e..a855ad503c8 100644 --- a/bin/addons/base/module/wizard/wizard_export_lang.py +++ b/bin/addons/base/module/wizard/wizard_export_lang.py @@ -60,12 +60,12 @@ class wizard_export_lang(wizard.interface): lang_obj=pooler.get_pool(cr.dbname).get('res.lang') ids=lang_obj.search(cr, uid, [('active', '=', True),]) langs=lang_obj.browse(cr, uid, ids) - return [(lang.code, lang.translatable and lang.name or 'New language') for lang in langs] + return [(lang.code, lang.translatable and lang.name or _('New language')) for lang in langs] def _get_file(self, cr, uid, data, context): file=tools.trans_generate(data['form']['lang'], 'all', dbname=cr.dbname) buf=StringIO.StringIO() - writer=csv.writer(buf, 'TINY') + writer=csv.writer(buf, 'UNIX') for row in file: writer.writerow(row) del file diff --git a/bin/addons/base/module/wizard/wizard_import_lang.py b/bin/addons/base/module/wizard/wizard_import_lang.py index d9543b7f851..a6516bb24df 100644 --- a/bin/addons/base/module/wizard/wizard_import_lang.py +++ b/bin/addons/base/module/wizard/wizard_import_lang.py @@ -32,6 +32,7 @@ import wizard import tools import base64 import pooler +from tempfile import TemporaryFile view_form="""
@@ -56,8 +57,11 @@ class wizard_import_lang(wizard.interface): def _import_lang(self, cr, uid, data, context): form=data['form'] - buf=base64.decodestring(data['form']['data']).split('\n') - tools.trans_load_data(cr.dbname, buf, form['code'], lang_name=form['name']) + #buf=base64.decodestring(form['data']).split('\n') + fileobj = TemporaryFile('w+') + fileobj.write( base64.decodestring(form['data']) ) + tools.trans_load_data(cr.dbname, fileobj, form['code'], lang_name=form['name']) + fileobj.close() return {} states={ diff --git a/bin/addons/base/module/wizard/wizard_module_import.py b/bin/addons/base/module/wizard/wizard_module_import.py index acaf7e3a7cf..d59c635cd30 100644 --- a/bin/addons/base/module/wizard/wizard_module_import.py +++ b/bin/addons/base/module/wizard/wizard_module_import.py @@ -75,7 +75,7 @@ class move_module_wizard(wizard.interface): fp.write(val) fp.close() except IOError, e: - raise wizard.except_wizard('Error !', 'Can not create the module file:\n'+' '+fname+'!') + raise wizard.except_wizard(_('Error !'), _('Can not create the module file: %s !') % (fname,) ) pooler.get_pool(cr.dbname).get('ir.module.module').update_list(cr, uid) return {'module_name': module_name} -- cgit v1.2.3