콘텐츠로 건너뛰기
메뉴
커뮤니티에 참여하려면 회원 가입을 하시기 바랍니다.
신고된 질문입니다
4 답글
25035 화면

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
6504
2
7월 24
2206
3
4월 24
2117
1
2월 24
2489
2
5월 23
4821