Search code examples
pythonodooopenerp-7porml

How to translate a simple string of a RML report in OpenERP7?


I've made a module which modifies an existing RML report. It does nothing more but modifying the RML file (no Python changes).

I installed the module and after that, I was able to print my new report. However, when I wanted to export the .pot file to translate it, it was empty. I don't know why, but finally I had to do the translation file manually.

Now the terms are being translated great, except for one. The next sentence:

<para style="terp_default_8">[[ (o.comment and format(o.comment)) or "Please, indicate the invoice number on the concept of income" ]]</para>

I added it to my translation file (es.po), exactly as the other terms, which are working:

#. module: customized_reports_03
#: report:account.invoice.custom:0
msgid "Please, indicate the invoice number on the concept of income"
msgstr "Por favor, indique el número de factura en el concepto del ingreso"

I loaded the translation and updated all several times, but this sentence is not being translated.

Why? May be is because of the operator or?


Solution

  • Finally, I realized that the strings you write between [[ ]] aren't being recognized by the translation files. To manage this, you've to find the way to achieve the same behaviour through a code in which your strings are out of the double brackets.

    In my case, the problem is solved this way:

    <para style="terp_default_8">[[ (o.comment and format(o.comment)) or removeParentNode('para') ]]</para>
    <para style="terp_default_8">Please, indicate the invoice number on the concept of income[[ not o.comment and '.' or removeParentNode('para') ]]</para>