Technical mailing list archives

[patch] ir_translation non-deterministic on duplicates

- 03/23/2015 18:11:52
Hi Odoo,

we have had quite a few problems with non-deterministic behavior of
translations. For no apparent reason and not following a sensible pattern,
every now and then a few strings would show in English instead of the
user's own language.

After some investigation I have noticed that it is possible to submit
duplicate and differing translation entries to ir_translation, for the
same field, language and source string. Also, the .pot files bring in
empty values to the ir_translation database, which are not filtered out
properly when looking up translations. Any one of these translations is
used, depending on whichever value postgres decides to throw out first.

To make ir_translation a) deterministic, b) filter away empty entries and
c) warn the developer of conflicts, I have come up with the attached patch
for odoo 8.

I would appreciate some thoughts on this patch, and possibly you might
like to adopt it upstream.

I also have a patch for odoo 7, if anyone is interested. It is quite
similar. Just ask :)

There's also a second source of .po trouble, not related to above patch.
If two .po files provide differing translations for the same
ir_translation key, whichever .po is installed last wins. Thus I have
written up a simple py script that walks all the .po files of a given
language in or below $CWD to collect translation conflicts, which is now
part of our test suite to reject new .po conflicts. Also attached.

Thanks for any feedback!


Neels Hofmeyr
Señor Developer
elego Software Solutions GmbH
Gustav-Meyer-Allee 25 / Building 12
13355 Berlin, Germany

fon: +49 30 2345 8696      mobile: +49 177 2345 866
fax: +49 30 2345 8695

Managing Directors: Olaf Wagner
Registered Office: Berlin
Register Court: Amtsgericht Charlottenburg, HRB 77719