Odoo Help


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.


Why some sentences are not exported ? (I'm trying to translate a custom module).

on 12/20/13, 11:48 AM 1,955 views

Hi !

What's the right way ?

from tools.translate import _


from openerp.tools.translate import _


Here's three samples of python code. Am I using '_' correctly ?

return _("This is an empty purchase order. Please add some lines.")

raise osv.except_osv(_('Shipping rule error'), message)

condition_string = _(' if %s %s %s %s') % (field_string, sign, str(value), symbol_string)

No matter what I do, I can't translate the hard coded strings. They don't even appear in my po file !


Okay, now I try to add manually the sentences to both my french po file and my pot file. After openerp restart, I can see the sentences in the ir.translation table (via pgadmin3), but they are not used in the web client. I'm still with the english sentences. Here's a sample of what I've add :

#. module: shipping
#: view:shipping_rule:0
msgid "Shipping rule error"
msgstr "Erreur de règle de frais de port"

I think my mistake is in the second line, but I don't know what to put in place of that. Do someone knows how to fill this line properly ?

Thanks !

Hi Yann. Install the module in some database and export the translation of this module in po format.

on 12/20/13, 3:03 PM

I know that, I've done that, but, in the po file, the hard coded sentences I want to translate with "_" are missing... Why ? That is my question.

on 12/23/13, 9:08 AM

The truth is that I've to add all my hardcoded sentences to my po file. System is not doing that, Well in my case, it could be great if this could work.

GH Mediacloud, Grover Menacho
on 1/8/14, 11:59 AM

:O Ok, thanks Grover, I'll try this...

on 1/8/14, 12:05 PM

Ok, I've had some lines to my po file. Checked ir.translation with pgAdmin, all fine. But the sentences are still not translated in the web client....

on 1/8/14, 12:36 PM

Did you get any solution?

Jairo Llopis
on 3/4/14, 8:37 AM

Alas no :/

on 3/6/14, 4:37 AM

Check for duplicate translations in the table ir.translation. I hade the same problem, and it turned out that there were 2 translation for the same resource, and one of them was actually a non-translation (the translated term was equal to the original one) and that was the one used by the client. I deleted that record and it worked.

Leonardo Donelli
on 7/8/14, 12:21 PM

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

2 follower(s)


Asked: 12/20/13, 11:48 AM
Seen: 1955 times
Last updated: 3/16/15, 8:10 AM