[FIX] allow selections in (old style) wizards to be translated (idea from Activity Solutions)
bzr revid: christophe@tinyerp.com-20081205134332-hkwjiy5fulyh5o2i
This commit is contained in:
parent
49916d38fd
commit
75a195153f
|
@ -360,10 +360,14 @@ def trans_generate(lang, modules, dbname=None):
|
|||
|
||||
# export fields
|
||||
for field_name, field_def in result['fields'].iteritems():
|
||||
res_name = name + ',' + field_name
|
||||
if 'string' in field_def:
|
||||
source = field_def['string']
|
||||
res_name = name + ',' + field_name
|
||||
push_translation(module, 'wizard_field', res_name, 0, source)
|
||||
push_translation(module, 'wizard_field', res_name, 0, source.encode('utf8'))
|
||||
|
||||
if 'selection' in field_def:
|
||||
for key, val in field_def['selection']:
|
||||
push_translation(module, 'selection', res_name, 0, val.encode('utf8'))
|
||||
|
||||
# export arch
|
||||
arch = result['arch']
|
||||
|
|
|
@ -116,6 +116,11 @@ class interface(netsvc.Service):
|
|||
trans = translate(cr, self.wiz_name+','+state+','+field, 'wizard_field', lang)
|
||||
if trans:
|
||||
fields[field]['string'] = trans
|
||||
|
||||
if 'selection' in fields[field]:
|
||||
trans = lambda x: translate(cr, self.wiz_name+','+state+','+field, 'selection', lang, x) or x
|
||||
for idx, (key, val) in enumerate(fields[field]['selection']):
|
||||
fields[field]['selection'][idx] = (key, trans(val))
|
||||
|
||||
# translate arch
|
||||
if not isinstance(arch, UpdateableStr):
|
||||
|
|
Loading…
Reference in New Issue