Skip to Content
เมนู
คุณต้องลงทะเบียนเพื่อโต้ตอบกับคอมมูนิตี้
คำถามนี้ถูกตั้งค่าสถานะ
4 ตอบกลับ
23989 มุมมอง

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"

อวตาร
ละทิ้ง
คำตอบที่ดีที่สุด

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.

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

--i18n-overwrite -u new_Inherited_module

คำตอบที่ดีที่สุด

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?

อวตาร
ละทิ้ง
ผู้เขียน คำตอบที่ดีที่สุด

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

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.

ผู้เขียน

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

คำตอบที่ดีที่สุด

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

--i18n-overwrite -u new_Inhertied_module

อวตาร
ละทิ้ง
Related Posts ตอบกลับ มุมมอง กิจกรรม
4
ก.ค. 24
5916
2
ก.ค. 24
1467
3
เม.ย. 24
1475
1
ก.พ. 24
1870
2
พ.ค. 23
4284