To enable translations for a report, translation
functions need to be called from a template, using a <t t-call>
element with the t-lang
attribute.
The t-lang
attribute should evaluate to a language code, such as es
or en_US
. It needs the name of the field where the language to use can be found.
One way to do this is by using the current user's language. For this, we define an outer translation report that calls a report to translate, setting the source for the language in the t-lang
attribute:
<report id="action_library_book_report_translated"
string="Translated Library Books"
model="library.book"
report_type="qweb-pdf"
name="library_app.report_library_book_translated"
paperformat="paperformat_euro_landscape"
/>
<template id="report_library_book_translated">
<t t-call="library_app.report_library_book_template"
t-lang="user.lang" />
</template>
In this case, each book...