Software Archive
Read-only legacy content
17061 Discussions

How to use globalization in XDK emulator?

Axel_K_
Beginner
431 Views

Hello,

i want to create a multilingual app with XDK. In the tab "emulate" is under "App Globalization  - Locale Name" a dropdown menu with different languages. How can I use it? 

With navigator.globalization.getPreferredLanguage I got an error. Is this my mistake or don't work in XDK?

Thanks a lot.

 

Axel

 

0 Kudos
3 Replies
José_Manuel_G_
Beginner
431 Views

Hi Axel!

I'm sorry, but I don't understand your request, my brain is on strike this morning.

If I respond your post is to tell you how I get the language of the device to use it in a multilingual app (well, at this time it has only three languages, but in the future it could have more).

I use this code:

var idiomaNavegador = new String;
if (navigator.language) idiomaNavegador = navigator.language;
	else idiomaNavegador = navigator.browserLanguage;
idiomaNavegador = idiomaNavegador.substring(0, 2);

With this code I've got the first part of the language, for example: "en-US" become en, "es-es", become "es".

I don't know if it's the best way to know the language of the device, but it's a simple one that rules fine.

 

0 Kudos
mattias_c_
Beginner
431 Views

This one was great José, thanks! 

0 Kudos
Hamilton_Tenório_da_
Valued Contributor I
431 Views

Is there any plugin ou tutorial to prepare a APP to multilingual? I am looking for it too.

0 Kudos
Reply