This question has been flagged
3 Replies
7085 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.

Avatar
Discard
Best Answer

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

Avatar
Discard
Author Best Answer

I will try this and let you know.

Avatar
Discard
Best Answer

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.

Avatar
Discard