Skip to Content
Menu
This question has been flagged
1 Reply
15082 Views

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> 

 
Avatar
Discard
Best Answer
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

Avatar
Discard
Author

@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 Replies Views Activity
4
Nov 20
6544
3
Aug 19
9071
1
Jan 24
4981
4
Jul 24
6618