ungleich cms template: add/change language menu item

This commit is contained in:
PCoder 2019-03-09 08:48:13 +01:00
parent 46c3bb1ce4
commit b33392defa

View file

@ -59,6 +59,19 @@
if ($(".has-error").length != 0) {
window.location = window.location.pathname + "#contact"
}
// set the correct page language for the language menu option
// Assumption that we have a #page_lang `a` element in the menu
var href = $(location).attr('href');
var page_lang = $("#page_lang");
if($(location).attr('href').indexOf('/en-us/') > 0) {
href = href.replace("/en-us/", "/de/");
page_lang.attr('href', href);
page_lang.text('Deutsch');
} else {
href = href.replace("/de/", "/en-us/");
page_lang.attr('href', href);
page_lang.text('Englisch');
}
});
</script>