Skip to Content
Menu
This question has been flagged
4 Replies
24965 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"

Avatar
Discard
Best Answer

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.

Avatar
Discard

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

To overwrite original translation, the following values must be added to command line server

--i18n-overwrite -u new_Inherited_module

Best Answer

This works ... kind of :--i18n-overwrite -u new_Inhertied_module

> How can I do this without access to the command line? I know you can set this switch when importing a translation manually as well, but there needs to be a switch in the __manifest__ file as well. Right?

Avatar
Discard
Author Best Answer

[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?

Avatar
Discard

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.

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.

Author

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

Best Answer

To overwrite original translation, the following values must be added to command line server

--i18n-overwrite -u new_Inhertied_module

Avatar
Discard
Related Posts Replies Views Activity
4
Jul 24
6458
2
Jul 24
2148
3
Apr 24
2048
1
Feb 24
2433
2
May 23
4752