[FIX] Issue #105 switch the user to non language

This commit is contained in:
Chintan Ambaliya 2018-08-30 16:06:31 +05:30
parent 9fc7c5a96b
commit 325caf822e

View File

@ -161,30 +161,32 @@ var UserProfile = Widget.extend({
method: 'search_read',
args: [[["code", "=", session.user_context.lang]], ['name', 'direction']],
}).then(function(lang_data){
var img_src = session.url('/web/image', {
model:'res.lang',
field: 'image',
id: lang_data[0].id,
});
$lang_logo.attr('title', lang_data[0].name).attr('src', img_src).attr('data-lang-dir', lang_data[0].direction);
if (lang_data.length) {
var img_src = session.url('/web/image', {
model: 'res.lang',
field: 'image',
id: lang_data[0].id,
});
$lang_logo.attr('title', lang_data[0].name).attr('src', img_src).attr('data-lang-dir', lang_data[0].direction);
// Web RTL(Right to Left) Snippet
if (lang_data[0].direction == 'rtl') {
var head = document.getElementsByTagName('head')[0];
// Web RTL(Right to Left) Snippet
if (lang_data[0].direction == 'rtl') {
var head = document.getElementsByTagName('head')[0];
// BootStrap RTL CSS
var link = document.createElement('link');
link.rel = 'stylesheet';
link.type = 'text/css';
link.href = '/web/static/lib/rtl/bootstrap-rtl.min.css';
head.appendChild(link);
// BootStrap RTL CSS
var link = document.createElement('link');
link.rel = 'stylesheet';
link.type = 'text/css';
link.href = '/web/static/lib/rtl/bootstrap-rtl.min.css';
head.appendChild(link);
// Flectra RTL Custom CSS
var link1 = document.createElement('link');
link1.rel = 'stylesheet';
link1.type = 'text/css';
link1.href = '/web/static/lib/rtl/flectra-rtl-custom.css';
head.appendChild(link1);
// Flectra RTL Custom CSS
var link1 = document.createElement('link');
link1.rel = 'stylesheet';
link1.type = 'text/css';
link1.href = '/web/static/lib/rtl/flectra-rtl-custom.css';
head.appendChild(link1);
}
}
});
$avatar.attr('src', avatar_src);