Skip to Content
Meniu
Trebuie să fiți înregistrat pentru a interacționa cu comunitatea.
Această întrebare a fost marcată
1 Răspunde
15099 Vizualizări

I have define translation terms and its loaded properly in qweb template. I checked from setting->report->qweb views and translation but when I print report it's not print translation values .

<template id="report_test_translation">
<t t-call="report.html_container">
<t t-call="my_module.report_my_test_report" t-lang="it_IT"/>
</t>

</template> 

 
Imagine profil
Abandonează
Cel mai bun răspuns
Simply do this for everything you want to translate, for every language, and then update your module.

Hi Ajeet,

So if I understand correctly you want to make translations and change the report language as which language is set?
Every default report has two QWeb views. One with the actual report (named report_xxxx_document) and one record with the translation logic (report_xxxx)
In this second record, the report_xxx is where the languages will be fetched:

<?xml version="1.0"?>
   <t t-name="account.report_invoice">
       <t t-call="report.html_container">
          <t t-foreach="doc_ids" t-as="doc_id">
          <t t-raw="translate_doc(doc_id, doc_model, 'partner_id.lang', 'account.report_invoice_document')"/> </t>         </t>
</t>

As you can see this second record checks the language from the user with partner_id.lang and then loads the correct translation.
So, how do you get the correct languages?
You'll need to create a new folder named i18n and place a .po file in this for every language you want to translate.
The file should have the ISO language codes. For example for the Dutch language this would be nl.po.
In this file you should add the modulename, location of the value you want to translate, the source and the translation. For example:


#. module: sale
#: view:sale.order.line:sale.view_order_line_tree
msgid "Qty"
msgstr "Hvhd"


Note: You can see examples in any module under the folder i18n. You have to do the same for your module but with other values and module names.

Best of luck

Imagine profil
Abandonează
Autor

@Manish.. Thanks for your reply. I see sample in odoo 10 like below-

<template id="report_saleorder">

<t t-call="report.html_container">

<t t-foreach="docs" t-as="doc">

<t t-call="sale.report_saleorder_document" t-lang="doc.partner_id.lang"/>

</t>

</t>

</template>

I already define .po file and it's load translation in qweb view. I check from report menu. But when I print report its not reflecting report in tranlated term

Related Posts Răspunsuri Vizualizări Activitate
4
nov. 20
6578
3
aug. 19
9104
1
ian. 24
5033
4
iul. 24
6656