I made several reports using webkit in Odoo 7 and packaged them in a module. In these reports I inserted literal strings like this:
I now would like to translate all these strings to different languages. If I export the translation for the module using the translation export wizard under "Settings" I just get an empty file (PO or CSV). Am I missing something?
I managed to do it, although I'd be glad if somebody may shed some light on why you have to do it this way and what other possibilities there may be. Anyway, if anybody faces the same problem, here is my solution:
Assuming that your mako templates are stored in your module directory 'my_module' in the subfolder 'reports':
You can create the PO file which holds the translation strings (assuming you are on Linux and that your target language is German) using xgettext.
$ xgettext my_module/reports/*.mako -o de.po -L Python
This will create the file de.po, which you now have to edit further.
- 1. At the top of each entry generated by xgettext, add a line indicating the name of your module as shown below.
- Edit the msgstr to match your target language.
- Prepend 'addons/' to 'my_module' as shown below even if your module won't be placed in an 'addons' directory.
#. module: my_module
msgid "Shipping address"
Include all the files in "my_module/i18n" and they should be imported automatically on installation/upgrade of your module. You can also edit the translations under the 'Translated Terms' section in the web interface.
HI Robin Hafen +1 for you. I have no enoght karma to comment your answer directly. Your approach result for me. I create a new en.po file with the mako terms and then I cut and copy the terms I need to the .pot in my module.
Also, I have to say that I use an extra parameter for the xgettext command "--from-code=UTF-8".
I hope this could be helpfull.
Please try to give a substantial answer. If you wanted to comment on the question or answer, just use the commenting tool. Please remember that you can always revise your answers - no need to answer the same question twice. Also, please don't forget to vote - it really helps to select the best questions and answers!
About This Community
|Asked: 8/31/14, 4:16 PM|
|Seen: 1171 times|
|Last updated: 3/16/15, 8:10 AM|