Odoo Help

Welcome!

This community is for beginners and experts willing to share their Odoo knowledge. It's not a forum to discuss ideas, but a knowledge base of questions and their answers.

0

How to fill a .po file properly ?

By
PY
on 1/14/14, 11:19 AM 1,542 views

Hi !

I'm trying to translate my own module. Some sentences are in the code, and aren't included in the output file while I do Settings > Import/Export > Export Translation. So I'm trying to include these sentences manually.

So far, I've just achieved including them in the database. But something is wrong, because they are not used by openERP. I mean, the sentences are not translated when I use my module, but I can see the sentences in the ir_translation table.

A sample of my i18n/fr.po file:

#. module: shipping
#: view:shipping_rule:0
msgid "Shipping rule error"
msgstr "Erreur de règle de frais de port"

I think the second line can do the trick, but I don't know the syntax. Someone know how to do that ?

Thanks !

0
Timo Talvitie
On 1/14/14, 2:10 PM

Getting the translations to update and show up seems to be a bit hit or miss, but this is how I have got everything to show up, except for new states:

  1. Save all your module's xml and py files, and remember to use from tools.translate import _ in python
  2. If you haven't already, enable the language you want to translate to from Settings -> Load a translation
  3. Restart the server with the --update=my_module_name flag
  4. Go to Settings->Export translation. Choose the language you want to translate to, select PO as the file format, and pick the module you want to translate.
  5. Save the result to my_module_name/i18n/fi.po (replace fi with your proper language code)
  6. Edit the .po file with a text editor and add the translations there, don't touch anything else than just the msgstr rows. Save the file.
  7. After you have translated everything, restart the server with --update=all flag. Sometimes doing this twice has been required.
  8. Enable the new language for your user at Settings -> Users -> (username) -> Language
  9. Switch to that user and press Ctrl+R to refresh the UI

Hopefully this works for you as well.

Hi ! thanks for your answer. 1. In fact, I use from openerp.tools.translate import _ 2. I'm setting my language at the database creation, so I think I don't need it. But perhaps I'm wrong. 3. Again, I do not use this method. Instead, I use sudo service openerp-server restart , then in the interface I just update my module with the button. 4.5. I do exactly the same. 6. Here ! The problem is here ! When I do that, all the sentences are not in the file.

PY
on 1/15/14, 9:30 AM

Your Answer

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

This community is for professionals and enthusiasts of our products and services. Read Guidelines

Question tools

1 follower(s)

Stats

Asked: 1/14/14, 11:19 AM
Seen: 1542 times
Last updated: 8/15/16, 4:49 AM