0

I found a reference for multi language for my website without using php. I had 2 languages: english & bahasa. Default is english when I choose bahasa and i refresh the page, it's back to english again as I want it to stay on the selected language

I couldn't figure out anyway as I'm still learning about jQuery and others.

changeLanguage("en");

$("#id_button").click(function(){
    changeLanguage("id");
});

$("#eng_button").click(function(){
    changeLanguage("en");
});

I expect that when I select bahasa dan when the page refresh or move to other pages, it will remain on my selected language.

marc_s
  • 732,580
  • 175
  • 1,330
  • 1,459

1 Answers1

1

You can use a cookie to store the language using Jquery

  $.cookie('lang','en');

To retrieve the data

  var current_language = $.cookie('lang');

For more reference please visit the link https://github.com/jaaulde/cookies#With_jQuery

and also someone answered this

how to save data in a cookie using jquery

Sanjun Dev
  • 518
  • 8
  • 20