Modified translations in a base_lang_code.po file are not updated

Bug #1166776 reported by Enrico Ganzaroli on 2013-04-09
This bug affects 10 people
Affects Status Importance Assigned to Milestone
OpenERP Publisher's Warranty Team

Bug Description

Steps to reproduce the behaviour:

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.

The original translation will not be updated.


    # 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:
  '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.


    self._overwrite = context.get('overwrite', False)


    # 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.



-- self._overwrite = context.get('overwrite', False)
++ self._overwrite = context.get('overwrite', True)

Thanks for the temporary fix.

This should probably be fixed by creating a context in the code that loads the modules, I'm guessing at the following line in
            # Update translations for all installed languages
            modobj.update_translations(cr, SUPERUSER_ID, [module_id], None) <-- add context={'overwrite': True} here

Changed in openobject-server:
assignee: nobody → OpenERP Publisher's Warranty Team (openerp-opw)
tags: added: maintenance
Numérigraphe (numerigraphe) wrote :

Not sure that would be a good idea, since we allow users to change translations from the GUI.
Lionel Sausin.

Harri Luuppala (harri-luuppala) wrote :

Could it be a parameter in the 'opener-server.conf' file.

# LP = use translation fro LP or User = user defined translations

description: updated
Yann Papouin (yann-papouin) wrote :

For the record:
The correct way is to pass "--i18n-overwrite" on the server command line and apply the "should it be" fix

To post a comment you must log in.
This report contains Public information  Edit
Everyone can see this information.

Other bug subscribers

Related questions