Přejít na obsah
Menu
You need to be registered to interact with the community.
This question has been flagged
3 Odpovědi
18882 Zobrazení

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
Zrušit
Nejlepší odpověď

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
Zrušit
Autor

It works perfectly ! Thanks :)

Nejlepší odpověď

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
Zrušit
Related Posts Odpovědi Zobrazení Aktivita
0
pro 24
749
2
úno 24
2324
4
lis 23
2454
1
srp 22
3152
1
bře 21
19654