Skip to Content
Menu
This question has been flagged
3 Replies
18698 Views

Hi everybody !

I just created a new module to add fields in my invoice. I already created a .po file to translate my fields and it works perfectly inside OpenERP. But when I print my invoice, the translation doesn't works.

I think I have to create a new folder "report" in addons/mymodule and create new files inside but I really have no idea of which files I have to create and which code to put inside.

Someone could help me ?

Many thanks in advance.

JMB

Avatar
Discard
Best Answer

In order to translate you need:

  • folder called i18n
  • file module_name.pot within i18n (example: mymodule.pot)
  • file language.po (or languate_country.po) within i18n (example nl.po or nl_BE.po)

For a report, you need lines within the .pot:

#: report:sale.order:0
msgid "Offer"
msgstr ""

within the .po:

#: report:sale.order:0
msgid "Offer"
msgstr "Offerte"

The issues I have run into are:

  • updating the .pot and .po files does not always show on the reports, if these have been stored. So you need to create a new situation and print the report for the first time.
  • When you miss an entry in your .po file, there might be a default entry in the database, and that one will be used, even if you update your .po file.
  • it does matter where you place your :. A text like "the answer:" will not be translated it you store "the answer" or "the answer :" in your .pot and .po files.
Avatar
Discard
Author

It works perfectly ! Thanks :)

Best Answer

Follow below steps:

1) Go to

Settings ‣ Translations ‣ Import / Export ‣ Export Translations

leave the language to the default (new language/empty template) # DO NOT CHANGE THIS

select the PO File format

select your module

click Export and download the file

2) Add your translation terms in the downloaded file. i.e. msgstr "" section depending on your translation language

3) change the filename to language_iso_code.po

e.g. for portugese => pt.po

4) create i18n folder under your module and add po file in it.

5) restart Odoo

6) Go to:

Settings ‣ Translations ‣ Load a Translation

select translation language (in my eg. Portugese)

make sure you check this : Overwrite Existing Terms

click LOAD.

DONE

Avatar
Discard
Related Posts Replies Views Activity
0
Dec 24
470
2
Feb 24
2046
4
Nov 23
2049
1
Aug 22
2902
1
Mar 21
19021