I have this template
<?xml version="1.0" encoding="utf-8"?>
<openerp>
<data>
<template id="web_rtl.layout" inherit_id="web.layout" name="RTL Layout">
<xpath expr="//html" position="attributes">
<t t-set="langs" t-value="env['res.lang']"/>
<t t-set="lang_dir" t-value="langs.search([('code', '=', env.lang)], limit=1).direction"/>
<attribute name="t-att-dir">lang_dir</attribute>
</xpath>
<xpath expr="//html/head/t" position="after">
<t t-set="langs" t-value="env['res.lang']"/>
<t t-set="lang_dir" t-value="langs.search([('code', '=', env.lang)], limit=1).direction"/>
<link t-if="lang_dir == 'rtl'" href="/web_rtl/static/src/css/bootstrap-rtl.css" rel="stylesheet"/>
<link t-if="lang_dir == 'rtl'" href="/web_rtl/static/src/css/rtl.css" rel="stylesheet"/>
</xpath>
</template>
</data>
</openerp>
The second xpath works fine, but the first one does not set anything to the dir attribute as if you do this
<attribute name="t-att-dir"></attribute> which results <html>
if I do this:
<attribute name="t-att-dir">1+1</attribute>
the template result <html dir=2> and if I use t-if and t-attf-dir to set the attribute does not work
<attribute t-if="lang_dir =='rtl'" name="t-attf-dir">rtl</attribute>
<attribute t-if="lang_dir =='ltr" name="t-attf-dir">ltr</attribute>
both if statements true and dir= the last if statment executed although lang_dir in the second xpath works fine.
Can some one help me on this
Best regards
Akram