Cuatro Fitness
Posts: 0
Joined: Mon Nov 10, 2014 8:09 pm

Translate Header Back Button

Hello,

I have a question about translating the back button in header.
I tried to use this code
var backTransl = {"en-EN": "Back", "es-ES": "espalda"};
$('[data-rel="back"]').text(backTransl[lang]);

But how to make based on language of device the information will show on english, spanish, french and etc...

Evgene Karachevtsev
Posts: 12
Joined: Mon Apr 28, 2014 1:12 pm

Translate Header Back Button

Hello Cuatro,

You need to fill a variable lang. You may do this like this
prevar lang = navigator.language || navigator.userLanguage;/pre
But please note that this variable may not be "es-es", and maybe just "es" (depending on device).
Please read more here https://developer.mozilla.org/en-us/d...
I.e. you should add extra validation on the value of the variable lang or add the object backTransl by other possible values

Return to “Issues”