Skip to Content
Menu
Musisz się zarejestrować, aby móc wchodzić w interakcje z tą społecznością.
To pytanie dostało ostrzeżenie
4 Odpowiedzi
25231 Widoki

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"

Awatar
Odrzuć
Najlepsza odpowiedź

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.

Awatar
Odrzuć

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

Najlepsza odpowiedź

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?

Awatar
Odrzuć
Autor Najlepsza odpowiedź

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

Awatar
Odrzuć

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.

Autor

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

Najlepsza odpowiedź

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

--i18n-overwrite -u new_Inhertied_module

Awatar
Odrzuć
Powiązane posty Odpowiedzi Widoki Czynność
4
lip 24
6636
2
lip 24
2528
3
kwi 24
2257
1
lut 24
2641
2
maj 23
4899