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.

2

Unable to import translation unless the locale code matches an existing locale code

By
Ray Carnes
on 2/25/13, 1:46 PM 2,339 views

Is loading a translation for a language with a new locale code supported?

I am able to export, modify and import a new language translation (via CSV) and see a new language (res.lang) record created.

When I change the language of a user to this new language, OpenERP gives me blank pages until my session times out.

If I import using an existing locale code, it works as expected.

I also tested this on build 4532 on runbot.

2

Cyril Gaspard (GEM)

--Cyril Gaspard (GEM)--
4136
| 5 6 8
Paris, France
--Cyril Gaspard (GEM)--

Forum contributor since 2008

Cyril Gaspard (GEM)
On 3/16/13, 8:23 PM

Hi Ray,

when I see this bloglinked after, I remember your problem, hoping this will work and solve your problme :

OpenERP 7 : How to load a language from a module

Preloading a language translation in a customer module is as simple as writing a few lines of XML. The technique is to simulate the use of the language wizard below, that can be found in the settings → Translations → Load a translation menu:

Now if you want to automate this language installation during a customer module installation, you have to remember that a wizard is just an objet managed by a TransientModel, exactly like any other model. The first step is to create the object with a record:

<record model="base.language.install" id="install_tr">
 <field name="lang">tr_TR</field>
 <field name="state">done</field>
 <field name="overwrite" eval="1"/>
</record

Since OpenERP 6.1 this kind of transient objects are created in the database so that the wizard is stateless and can be handled by any OpenERP server backend (in a multi-server configuration). Then they are automatically deleted after 30 min by a scheduled action.

Creating this object is not enough to load the language, as the wizard does not do anything until you click on the "Load" button.

So the next step is to simulate the click on the "Load" button. This can easily be done by a <function> tag pointing to the wizard object :

<function
model="base.language.install"
name="lang_install"
eval="[[ref('install_tr')]]" />

It means : run the "lang_install" function of the existing "base.language.install" transient object, and pass a list of arguments to it, containing the ids of this same object.

The final result is a simple lang.xml file containing :

<?xml version='1.0' encoding='UTF-8'?>

<openerp> <data noupdate="1">

<record model="base.language.install" id="install_tr">
    <field name="lang">tr_TR</field>
    <field name="state">done</field>
    <field name="overwrite" eval="1"/>
</record>

<function
    model="base.language.install"
    name="lang_install"
     eval="[[ref('install_tr')]]"/>

</data> </openerp>

http://www.anybox.fr/blog/openerp-7-how-to-load-a-language-from-a-module

bye

0

Ray Carnes

--Ray Carnes--
15707
| 9 7 9
Greater Los Angeles, United States
--Ray Carnes--

Senior Odoo Analyst

OpenERP 6.1, 7.0 and Odoo 8.0, 9.0 (Since 2012)

Completed Functional and Technical Training.

Major Skills:

  • Needs Discovery and Requirements Analysis;

  • Function and Technical Specifications;

  • Project Planning;

  • Prototyping and Proof of concepts;

  • Data migration;

  • Configuration & Customization (UI and modules);

  • Integration - data, business logic and service levels;

  • Training and Knowledge transfer;

  • Go Live support;

  • Help desk;

  • Version Migration.

I have over 20 years of experience empowering and enabling users with enterprise information systems that make a real and measurable difference in their ability to proactively manage their businesses and organizations. 

Ray Carnes
On 3/24/13, 4:41 PM

I will try this and let you know.

0
Laura Jarvenpaa
On 7/22/13, 6:33 AM

Hmm, we had the same problem when using the stable 7.0 version. When we downloaded saas-1 version from launchpad and used that one importing csv-files with custom locale code worked fine. We didn't test method GEM suggested so don't know if that works. Just thought you could be interested to know that this blank page issue appears only when importing csv language files on stable 7 downloaded from nightly folder not in e.g saas-1 version (and I would assume that it won't appear on trunk version either) downloaded from launchpad.

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

0 follower(s)

Stats

Asked: 2/25/13, 1:46 PM
Seen: 2339 times
Last updated: 3/16/15, 8:10 AM