[SOLVED] Localization Mobile

Hi, I’m currently using localization to get the browser language and translate my experience to dutch if any people from the Netherland use my experience. Since it’s an AR experience it has to work in mobile too, but when I test it on mobile the language never changes to nl-NL, although I have my device set to the Netherlands. I now use the following code to get the language:

var userLanguage = window.navigator.userLanguage || window.navigator.language;
console.log(userLanguage); 
if(userLanguage != 'nl-NL' && userLanguage != 'nl'){
        userLanguage = 'en-US';
}else{
        userLanguage = 'nl-NL';
        changeTextToNL(); 
}
this.app.i18n.locale = userLanguage;

Does this code have to be changed in order to work for mobile too?

Hi @DampedFred ,

What the following line returns on mobile in the console?

console.log(userLanguage);
2 Likes

Ok, nevermind… It’s an uppercase issue :upside_down_face:
The mobile console gives back nl-nl while the console on my pc gives back nl-NL.
Sorry for wasting your time!

1 Like