Community mailing list archives

community@mail.odoo.com

Re: Odoo Website Language problem

by
Md. Tanzilul Hasan Khan
- 09/25/2016 22:02:47
These two parameters in the <a> tag solved the problem :

t-att-data-lang="lg[0]"
class="js_change_lang"
Thanks. 

On Mon, Sep 26, 2016 at 7:51 AM, MD Tanzilul Hasan Khan <ponkhi403@gmail.com> wrote:
Another thing I forgot to mention, if I change the default language from website admin backend - then it changes to english. But doesn't change to default language.

> First time loads with default language (example english)
> I change the language
> Then change to default language again but never changes





On Mon, Sep 26, 2016 at 7:32 AM, MD Tanzilul Hasan Khan <ponkhi403@gmail.com> wrote:
I am using following line of code, can anyone please suggest what I am doing wrong? I can't revert back the website to English after changing the language. English is set as default language - 

<a href="#" class="dropdown-toggle language" data-toggle="dropdown">
<b><i></i> Language <span class="caret"></span></b>
</a>

<ul class="dropdown-menu" id="login_dropdown">
<t t-foreach="languages" t-as="lg">
<li>
<a t-att-href="url_for(request.httprequest.path + '?' + keep_query(), lang=lg[0])"
t-att-data-default-lang="editable and 'true' if lg[0] == website.default_lang_code else None">
<t t-esc="lg[1]"></t>
</a>
</li>
</t>
</ul>
I also debugged the code in website controller, it seems that in the following line -
return WebClient().translations(mods=modules, lang=lang)
The lang=lang never gets English (except first time) when I am changing it from website dropdown. It is stuck to de_DE or to another language. If I have three or four languages, other language works fine except English.

Regards,
Tanzil








--
MD. Tanzilul Hasan Khan.



--
MD. Tanzilul Hasan Khan.