summaryrefslogtreecommitdiff
path: root/addons/website/static/src/js
diff options
context:
space:
mode:
authorJeremy Kersten <jke@odoo.com>2015-03-26 10:24:56 +0100
committerJeremy Kersten <jke@odoo.com>2015-04-08 15:39:57 +0200
commita696913364ffc4d5f1ce0675bc9be82f84f3ff93 (patch)
tree44580622891e0462cd1c9fda2f7af8d659026ddb /addons/website/static/src/js
parentb10180887e7bdcada1c30dd2892ef1cb28886bc2 (diff)
[FIX] website: ir_http - no redirect for bot and save lang in cookie
Detect most of bots/crawlers to avoid auto redirect. Most bots fetch with lang en_US, so even if default website lang was not in en_US, googlebot was redirected to en_US page. Now we keep also the language selected by user into a cookie. If cookie exists but lang not in url, we redirect the user into his preferred language. Manage special case to allow to change the lang in url to set the default lang at fly in url and set the cookie... Many routes are not specified as multilang=False but should be. With the auto redirection, we need to update these routes to avoid useless redirects !
Diffstat (limited to 'addons/website/static/src/js')
-rw-r--r--addons/website/static/src/js/website.js13
1 files changed, 13 insertions, 0 deletions
diff --git a/addons/website/static/src/js/website.js b/addons/website/static/src/js/website.js
index e464a4e7697..6364550778a 100644
--- a/addons/website/static/src/js/website.js
+++ b/addons/website/static/src/js/website.js
@@ -350,6 +350,19 @@
});
});
+ $(document).on('click', '.js_change_lang', function(e) {
+ e.preventDefault();
+
+ var self = $(this);
+ // retrieve the hash before the redirect
+ var redirect = {
+ lang: self.data('lang'),
+ url: self.attr('href'),
+ hash: location.hash
+ };
+ location.href = _.str.sprintf("/website/lang/%(lang)s?r=%(url)s%(hash)s", redirect);
+ })
+
/* ----- KANBAN WEBSITE ---- */
$('.js_kanban').each(function () {
website.init_kanban(this);