1) Create the i18n/base_lang_code.po for a module containing at least one translation.
2) Update the module (importing the translation file).
3) Modify a translation already imported in the file i18n/base_lang_code.po.
4) Update the module.
# Step 1: for sub-languages, load base language first (e.g. es_CL.po is loaded over es.po)
if base_lang_code: base_trans_file = openerp.modules.get_module_resource(module_name, 'i18n', base_lang_code + '.po')
if base_trans_file: _logger.info('module %s: loading base translation file %s for language %s', module_name, base_lang_code, lang) tools.trans_load(cr, base_trans_file, lang, verbose=False, module_name=module_name, context=context) context['overwrite'] = True # make sure the requested translation will override the base terms later
Note that context['overwrite'] is True only after the base language file (i.e. es.po) has been loaded.
# Step 2: update existing (matching) translations
if self._overwrite: cr.execute("""UPDATE ONLY %s AS irt
SET value = ti.value,
state = 'translated'
FROM %s AS ti
WHERE %s AND ti.value IS NOT NULL AND ti.value != ''
""" % (self._parent_table, self._table_name, find_expr))
Here self._overwrite should be True in order to update existing translations.
Steps to reproduce the behaviour:
1) Create the i18n/base_ lang_code. po for a module containing at least one translation. lang_code. po.
2) Update the module (importing the translation file).
3) Modify a translation already imported in the file i18n/base_
4) Update the module.
The original translation will not be updated.
server/ openerp/ addons/ base/ir/ ir_translation. py,402
# Step 1: for sub-languages, load base language first (e.g. es_CL.po is loaded over es.po)
base_trans_ file = openerp. modules. get_module_ resource( module_ name, 'i18n', base_lang_code + '.po')
_logger. info('module %s: loading base translation file %s for language %s', module_name, base_lang_code, lang)
tools. trans_load( cr, base_trans_file, lang, verbose=False, module_ name=module_ name, context=context)
context[ 'overwrite' ] = True # make sure the requested translation will override the base terms later
if base_lang_code:
if base_trans_file:
Note that context[ 'overwrite' ] is True only after the base language file (i.e. es.po) has been loaded.
server/ openerp/ addons/ base/ir/ ir_translation. py,66
self._overwrite = context. get('overwrite' , False)
server/ openerp/ addons/ base/ir/ ir_translation. py,120
# Step 2: update existing (matching) translations
cr.execute( """UPDATE ONLY %s AS irt parent_ table, self._table_name, find_expr))
if self._overwrite:
SET value = ti.value,
state = 'translated'
FROM %s AS ti
WHERE %s AND ti.value IS NOT NULL AND ti.value != ''
""" % (self._
Here self._overwrite should be True in order to update existing translations.
TEMPORARY FIX
server/ openerp/ addons/ base/ir/ ir_translation. py,66
-- self._overwrite = context. get('overwrite' , False) get('overwrite' , True)
++ self._overwrite = context.