summaryrefslogtreecommitdiff
path: root/bin/addons/base/module
diff options
context:
space:
mode:
authorChristophe Simonis <chs@tinyerp.com>2008-07-08 08:13:12 +0000
committerChristophe Simonis <chs@tinyerp.com>2008-07-08 08:13:12 +0000
commit0b1dfd702fd5b087f0e1be81ccf3ed77f0dcf3da (patch)
tree59dfe23edf8dd0833fc73f051bfa7edf16ff5728 /bin/addons/base/module
parentf8262137d224a9390d757c6ee3a75d52ef7c0868 (diff)
* translation of nearly all exceptions
* the export of translations per module take only the files of these modules bzr revid: chs@tinyerp.com-52cb3686b17250df7bc23bf90d18397c7888e6f2
Diffstat (limited to 'bin/addons/base/module')
-rw-r--r--bin/addons/base/module/module.py18
-rw-r--r--bin/addons/base/module/wizard/wizard_export_lang.py4
-rw-r--r--bin/addons/base/module/wizard/wizard_import_lang.py8
-rw-r--r--bin/addons/base/module/wizard/wizard_module_import.py2
4 files changed, 17 insertions, 15 deletions
diff --git a/bin/addons/base/module/module.py b/bin/addons/base/module/module.py
index d124fbc4cdd..8442628a2e3 100644
--- a/bin/addons/base/module/module.py
+++ b/bin/addons/base/module/module.py
@@ -264,13 +264,13 @@ class module(osv.osv):
ids = [ids]
for mod in self.read(cr, uid, ids, ['state'], context):
if mod['state'] in ('installed', 'to upgrade', 'to remove', 'to install'):
- raise orm.except_orm('Error',
- 'You try to remove a module that is installed or will be installed')
+ raise orm.except_orm(_('Error'),
+ _('You try to remove a module that is installed or will be installed'))
return super(module, self).unlink(cr, uid, ids, context=context)
def state_change(self, cr, uid, ids, newstate, context={}, level=50):
if level<1:
- raise Exception, 'Recursion error in modules dependencies !'
+ raise Exception, _('Recursion error in modules dependencies !')
demo = True
for module in self.browse(cr, uid, ids):
mdemo = True
@@ -288,7 +288,7 @@ class module(osv.osv):
def state_upgrade(self, cr, uid, ids, newstate, context=None, level=50):
dep_obj = self.pool.get('ir.module.module.dependency')
if level<1:
- raise Exception, 'Recursion error in modules dependencies !'
+ raise Exception, _('Recursion error in modules dependencies !')
for module in self.browse(cr, uid, ids):
dep_ids = dep_obj.search(cr, uid, [('name', '=', module.name)])
if dep_ids:
@@ -320,7 +320,7 @@ class module(osv.osv):
m.state not in ('uninstalled','uninstallable','to remove')''', (module.name,))
res = cr.fetchall()
if res:
- raise orm.except_orm('Error', 'The module you are trying to remove depends on installed modules :\n' + '\n'.join(map(lambda x: '\t%s: %s' % (x[0], x[1]), res)))
+ raise orm.except_orm(_('Error'), _('The module you are trying to remove depends on installed modules :\n %s') % '\n'.join(map(lambda x: '\t%s: %s' % (x[0], x[1]), res)))
self.write(cr, uid, ids, {'state': 'to remove'})
return True
@@ -420,9 +420,8 @@ class module(osv.osv):
index_page = urllib.urlopen(repository.url).read()
except IOError, e:
if e.errno == 21:
- raise orm.except_orm('Error',
- 'This url \'%s\' must provide an html file '
- 'with links to zip modules' % (repository.url))
+ raise orm.except_orm(_('Error'),
+ _("This url '%s' must provide an html file with links to zip modules") % (repository.url))
else:
raise
modules = re.findall(repository.filter, index_page, re.I+re.M)
@@ -493,8 +492,7 @@ class module(osv.osv):
fp.write(zipfile)
fp.close()
except IOError, e:
- raise orm.except_orm('Error', 'Can not create the module file:\n %s'
- % (fname,))
+ raise orm.except_orm(_('Error'), _('Can not create the module file:\n %s') % (fname,))
terp = self.get_module_info(mod.name)
self.write(cr, uid, mod.id, {
'description': terp.get('description', ''),
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="""<?xml version="1.0"?>
<form string="Import language">
@@ -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}