Skip to content

Instantly share code, notes, and snippets.

@hellraiser75
Created July 17, 2013 08:30
Show Gist options
  • Select an option

  • Save hellraiser75/6018815 to your computer and use it in GitHub Desktop.

Select an option

Save hellraiser75/6018815 to your computer and use it in GitHub Desktop.
Change default language in cookie
var mySiteNamespace = {}
mySiteNamespace.switchLanguage = function (lang) {
$.cookie('language', lang);
window.location.reload();
}
$(document).ready(function () {
// attach mySiteNamespace.switchLanguage to click events based on css classes
$('.lang-english').click(function () { mySiteNamespace.switchLanguage('en'); });
$('.lang-french').click(function () { mySiteNamespace.switchLanguage('fr'); });
$('.lang-arabic').click(function () { mySiteNamespace.switchLanguage('ar'); });
$('.lang-spanish').click(function () { mySiteNamespace.switchLanguage('es'); });
});
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment