How do I get language from ios device

Get help using Construct 2

Post » Wed Mar 04, 2015 11:29 pm

Hi, how can I get language from the ios device? The phonegap documentation says it can be done with following javascript:

Code: Select all
navigator.globalization.getPreferredLanguage(
    function (language) {alert('language: ' + language.value + '\n');},
    function () {alert('Error getting language\n');}
);


Although I don't know how can I execute it from within the Construct. Is there a way?
B
7
S
2
Posts: 68
Reputation: 645

Post » Wed Mar 04, 2015 11:52 pm

Well, one possible way to get language is use browser.language variable?

Is there a way to get only first two letters from the variable? (like substring method)

browser language returns en-US or en-UK and I think one "en" version will be fine.
B
7
S
2
Posts: 68
Reputation: 645


Return to How do I....?

Who is online

Users browsing this forum: littleredpanda and 14 guests