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

Correct way to add translations to Odoo through .po files?

By
Yenthe
on 1/2/15, 10:03 AM 3,798 views

Hi everybody

I've been trying and failing at translations for hours now. 
Could anybody tell me the correct way to add translations to Odoo through the .po files?
So far I've tried adding them to an existing .po file, made a new .po file, loaded translations again, removed the language again, hard refresh, ...

Under addons/l10n_be there is a file named fiscal_templates.xml and I'm trying to translate these records in Dutch:

    <record id="fiscal_position_template_1" model="account.fiscal.position.template">
            <field name="name">Régime National</field>
            <field name="chart_template_id" ref="l10nbe_chart_template"/>
    </record>
    <record id="fiscal_position_template_2" model="account.fiscal.position.template">
            <field name="name">Régime Extra-Communautaire</field>
            <field name="chart_template_id" ref="l10nbe_chart_template"/>
    </record>

    <record id="fiscal_position_template_3" model="account.fiscal.position.template">
            <field name="name">Régime Intra-Communautaire</field>
            <field name="chart_template_id" ref="l10nbe_chart_template"/>
    </record>

When the user his language is in Dutch I want them to be translated to Dutch too so I've added translations under l10n_be/i18n_extra/nl_BE.po and added a custom .po file (nl.po). Both files contain the same custom translation values:

# Translation of OpenERP Server.
# This file contains the translation of the following modules:
# * l10n_be
# Yenthe, 2015.
msgid ""
msgstr ""
"Project-Id-Version: OpenERP Server 7.0\n"
"Report-Msgid-Bugs-To: \n"
"POT-Creation-Date: 2013-02-14 13:31+0000\n"
"PO-Revision-Date: 2013-03-14 16:41+0100\n"
"Last-Translator: Yenthe \n"
"Language-Team: \n"
"Language: nl\n"
"MIME-Version: 1.0\n"
"Content-Type: text/plain; charset=UTF-8\n"
"Content-Transfer-Encoding: 8bit\n"
"Plural-Forms: nplurals=2; plural=(n != 1);\n"
"X-Generator: Poedit 1.5.4\n"

#. module: l10n_be
#: model:account.fiscal.position,name:l10n_be.fiscal_position_template_1
msgid "Régime National"
msgstr "Nationaal regime"

#. module: l10n_be
#: model:account.fiscal.position,name:l10n_be.fiscal_position_template_4
msgid "Régime National - Cocontractant"
msgstr "Nationaal regime - Medecontractant"

#. module: l10n_be
#: model:account.fiscal.position,name:l10n_be.fiscal_position_template_2
msgid "Régime Extra-Communautaire"
msgstr "Extra-communautair regime"

#. module: l10n_be
#: model:account.fiscal.position,name:l10n_be.fiscal_position_template_3
msgid "Régime Intra-Communautaire"
msgstr "Intra-Communautair regime"

#. module: l10n_be
#: model:account.fiscal.position.template,name:l10n_be.fiscal_position_template_1
msgid "Régime National"
msgstr "Nationaal regime"

#. module: l10n_be
#: model:account.fiscal.position.template,name:l10n_be.fiscal_position_template_4
msgid "Régime National - Cocontractant"
msgstr "Nationaal regime - Medecontractant"

#. module: l10n_be
#: model:account.fiscal.position.template,name:l10n_be.fiscal_position_template_2
msgid "Régime Extra-Communautaire"
msgstr "Extra-communautair regime"

#. module: l10n_be
#: model:account.fiscal.position.template,name:l10n_be.fiscal_position_template_3
msgid "Régime Intra-Communautaire"
msgstr "Intra-Communautair regime"

However when I look at the fiscal positions they are still in French and I cannot find my translations anywhere in Odoo.
I've tried -u and -i to update the module, I've tried adding a sequence to the __openerp__.py etcetc but nothing seems to load in the new translations

So, what am I missing / doing wrong and how do I get my custom translations in Odoo through the .po files?

With kind regards
Yenthe

hi Yenthe. I want to add a translation to another l10n module but this does not even have template .po files. Do you happen to know how you can generate those (looks to me as this might be an automated process). https://www.odoo.com/forum/help-1/question/v8-how-can-i-generate-translation-po-files-for-a-module-72608

gunnar
on 1/8/15, 7:08 AM
1
akram
On 7/25/15, 8:10 AM

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

--update=all helped me. updating or restarting the server did not work for me. But still this is very helpful. Thanks Akram.

Chintan Modi-BrowseInfo
on 4/7/16, 8:32 AM
0
Kalpana Hemnani
On 1/3/15, 2:19 AM

Hello Yenthe,

No need to update module, you just need to load translation. go to Settings/ Translations / Load a Translation.

By clicking on that wizard select Language to translate and check Overwrite Existing Terms.

EDIT: You have to made field Translatable. add an attribute in fields translate=True.

Hope this helps.

Thanks for the answer Kalpana. I've tried this method but it doesn't work either, translations don't get updated and are not showing up anywhere in Odoo.

Yenthe
on 1/3/15, 4:34 AM

The Translatable you're talking about won't have any effect by the way? My records are defined in XML.

Yenthe
on 1/5/15, 2:11 AM

When we click on « Load a translation », it means that Odoo checks in all the addon files to search .po files of the chosen language and overwrite the existing terms in place for this language? Is it possible to load only ONE .po file at a time instead of ALL the .po files at a time???

Pascal Tremblay
on 7/2/15, 3:28 PM
0
Alp ŞEBER
On 1/10/15, 1:18 AM

I was trying same during entire day and it was not showing all terms in translated language although everything were translated in PO file.

This morning, i went to settings, translations and translated terms and searched for an item (from old source, advanced) which had translation but not showing. 

I changed the translation, made the type view from object, saved and stop/start the server.

somehow, i guess this triggered the system to load the translation again since everything became translated. After i reverted back the field i broke with type to object.

it is weird but worked for me. 

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

4 follower(s)

Stats

Asked: 1/2/15, 10:03 AM
Seen: 3798 times
Last updated: 7/25/15, 8:10 AM