Odoo Help

Welcome!

This community is for beginners and experts willing to share their Odoo knowledge. It's not a forum to discuss ideas, but a knowledge base of questions and their answers.

0

How to override a module translation?

By
Raffaele
on 1/16/15, 8:12 AM 1,376 views

Hallo, how could I write a module whose i18n/it.po overrides some translations of the i18n/it.po of another module?

UPDATE #1

For a better dealing with my question I'm posting the module (some term are fictitious) since I'm quite unsure of the .po file structure 

my_translation_module/project.translate.py:

from openerp.osv import osv, fields

class project_inherit(osv.osv):
    
    _inherit = 'project.project'

my_translation_module/i18n/it.po

#. module: my_translation_module
#: view:project.project:project.edit_project
msgid "Close Project"
msgstr "Terminare Progetto"

#. module: base
#: model:ir.module.module,summary:base.module_project
msgid "Projects, Tasks"
msgstr "Progetti, Tasks"

2
John Baldwin
On 1/16/15, 3:14 PM

Inherit the original module and place the new file is the exact same directory/path (in the new module) that the original file is located in, in the original module. I hope that makes sense.

new Inherited module >i18n>it.po <-updated version

original module>i18n>it.po <-original. 

The inherited should override the original.

or simply modify the original translation file in POedit and install the new translation.

John Baldwin
on 1/16/15, 3:16 PM
0
Raffaele
On 1/17/15, 2:16 AM

[Mine is not an answer (the weird Odoo forum tool configuration doesn't let me comment).]

@John: thank you for replying and for pointing me in a right direction.

Actually importing is working fine, whilst the "module way" is not working (the .po is the same): am I expected to do some operation other than updating the module, restarting Odoo, restarting the OS?

To my understanding it should work. I would visit the structure of your inheritance. Make sure you have inherited the original module in a way that it will override existing fields by changing a string. If that works and the path is absolutely the same to the po file it should override as well. the last thing to do would be to re-install the translation. As I understand it translation are installed into the DB and not pulled from po files at run time.

John Baldwin
on 1/17/15, 8:54 AM

After reading your question a second time I see that you did not install (re-install) the changed translation. That would cause it not to load... Again the are loaded from the DB not the file after installation.

John Baldwin
on 1/17/15, 8:58 AM

Thank you again, I'm posting the code since reinstalling doesn't work

Raffaele
on 1/18/15, 4:14 AM

Your Answer

Please try to give a substantial answer. If you wanted to comment on the question or answer, just use the commenting tool. Please remember that you can always revise your answers - no need to answer the same question twice. Also, please don't forget to vote - it really helps to select the best questions and answers!

About This Community

This community is for professionals and enthusiasts of our products and services. Read Guidelines

Question tools

1 follower(s)

Stats

Asked: 1/16/15, 8:12 AM
Seen: 1376 times
Last updated: 3/16/15, 8:10 AM