跳至內容
選單
此問題已被標幟
4 回覆
24011 瀏覽次數

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

頭像
捨棄
相關帖文 回覆 瀏覽次數 活動
4
7月 24
5929
2
7月 24
1479
3
4月 24
1489
1
2月 24
1872
2
5月 23
4287