Community mailing list archives

community@mail.odoo.com

Re: Make the translation file (.po) to be imported automatically when installing module

by
Hieu Nguyen
- 10/15/2015 21:52:39
Thank you, Oliver for your very detailed answer.

On 15/10/2015 16:12, Olivier Dony wrote:
<blockquote cite="mid:561F63F5.1030009@openerp.com" type="cite">
On 10/15/2015 10:12 AM, Hieu Nguyen wrote:
> Thank Levent for your response.
>
> I have en_AU installed. I believe my translation was imported automatically
> like you said.
> However, my translated terms don't seem to override the already translated
> terms in en_AU language.

PO files are normally supposed to only contain translations for the module they 
belong too. It's technically possible to mix translations for different modules 
but you might get unexpected results, depending on your module dependencies:

  - If your module's en_AU.po contains translations for website_sale, they 
won't be loaded automatically if you install `website_sale` *after* your 
module. You need to make your module depend on `website_sale`.
  - The automatic PO loading system imports translation in 'normal' mode, so it 
won't override translations that already exist (even in other modules). This is 
done for 2 reasons:
     1. When installing a module, no translations are supposed to exist for it 
yet (which is why 1 PO = 1 module only, normally)
     2. PO files are re-imported at module update, and we can't overwrite 
translations that the users may have edited.

If you want to forcefully overwrite existing translations you need the 
"Overwrite existing terms" option, available either in the "Import Translation" 
wizard (for a specific PO file), or when you use the "Load translation" wizard 
for a language. You need a user with technical features enabled for both cases.
You can "Load a translation" for the same language multiple times, but it will 
overwrite translations for *all modules* at once.

Watch out, "Load a translation" will load translations in the natural order of 
the modules, not in the dependency order, so your translations for 
`website_sale` are likely to be overwritten by those of `website_sale` itself.
In that case just increase the 'sequence' in your module's manifest to a value 
that is greater than that of website_sale's (55).
You can watch the logs to see in which order the PO files are loaded.

Olivier

_______________________________________________
Mailing-List: https://www.odoo.com/groups/community-59
Post to: mailto:community@mail.odoo.com
Unsubscribe: https://www.odoo.com/groups?unsubscribe