in src/assets/js/protocol-lang-switcher.js [22:33]
LangSwitcher.switchPath = function (location, newLang) {
var parts = location.pathname.slice(1).split('/');
var currentLang = '/' + parts[0] + '/';
// check that first path is a valid lang code.
if (!/^(\/\w{2}-\w{2}\/|\/\w{2,3}\/)/.test(currentLang)) {
return false;
}
var urlpath = parts.slice(1).join('/');
return '/' + newLang + '/' + urlpath + location.search;
};