0

I am doing a company site, and my task is do the ‘translate’. It was requested to do in JavaScript, and was done. This way, when I click on the flag and select the language, the page is translated automatically. However, when I load another page, the website is not being able to hold the ‘cookie’ and loses the translation, going back to Portuguese. Can anybody help me to solve that? Any solution/suggestion? Here is the website for reference: http://whatsac.com/traducao/

Below are the codings:

var _t = $('body').translate({lang: "pt", t: t});
    var str = _t.g("translate");
      console.log(str);

  $(".lang_selector").click(function(ev) {
    var lang = $(this).attr("data-value");
    _t.lang(lang);

    console.log(lang);
    ev.preventDefault();
  });

});
halfer
  • 19,824
  • 17
  • 99
  • 186
  • Where is the cookie you speak of? Do you have any code that sets and gets a cookie? – trincot May 07 '16 at 08:37
  • Possible duplicate of [How do I create and read a value from cookie?](http://stackoverflow.com/questions/4825683/how-do-i-create-and-read-a-value-from-cookie) – trincot May 07 '16 at 08:44
  • Hi trincot , no i dont have code for cookie and i need cookie code for the above fixes – vinod selvaraj May 07 '16 at 08:57
  • @vinodselvaraj You need to set selected language in cookie. When user go to another page, you must to get cookie and use it. Above link is useful for you. See it. – Mohammad May 07 '16 at 09:25
  • thanks mohammad will check on this. – vinod selvaraj May 07 '16 at 09:48
  • A strange [copy and paste](https://stackoverflow.com/questions/35895946/cookie-manipulation-in-javascript-error) from another question. Are you running the same website as "Larissa", or are you operating sock puppet accounts on Stack Overflow? – halfer May 10 '16 at 12:40

0 Answers0