Detect device language

Get help using Construct 2

Post » Wed Aug 14, 2013 11:54 am

Hi there, I'm just sorting out the localisation side of things in my game. I can successfully load strings from a csv using rexrainbows excellent csv plugin.

I'm intending to use separate csvs for each language.

Does anyone know how to detect the language of the device (Specifically iOS and Android?

I've searched around and found out how to detect Windows Language through a registry entry but cant find an equivalent for Android/iOS.

Any help, as always, is massively appreciated!
B
4
S
1
Posts: 12
Reputation: 985

Post » Thu Aug 15, 2013 4:40 am

Use "Browser" plugin, then use expression "Browser Language" to compare.
B
99
S
35
G
29
Posts: 3,139
Reputation: 28,421

Post » Thu Aug 15, 2013 11:03 am

Thankyou!
B
4
S
1
Posts: 12
Reputation: 985

Post » Tue Jan 13, 2015 12:25 pm

My Android Tablet (4.4.2) always shows en-US as Browser.Language, allthough I changed the language in the settings.
What can I do?
B
3
Posts: 2
Reputation: 179

Post » Mon Jul 20, 2015 11:10 pm

Sorry that i get up this posting, but

how to use this Plugin?

If i call the Browser Language, what i can do with this? I found no Option like

"When Browser Language is en-US -> Set Text to "Hello" / or / Set Variable to 0"

or

"When Browser Language is de-DE -> Set Text to "Hallo" / or / Set Variable to 1"
B
8
S
2
Posts: 53
Reputation: 687

Post » Mon Jul 20, 2015 11:17 pm

system compare value "browser.language" = want you want then action
Image Image
B
25
S
14
G
136
Posts: 876
Reputation: 71,005

Post » Mon Jul 20, 2015 11:18 pm

B
8
S
2
Posts: 53
Reputation: 687

Post » Mon Jul 20, 2015 11:41 pm

Now it works:

Compare two Values: Browser.Language = Browser.Language

Action: Set Variable Language to Browser.Language

Now it autodetect the Language of the Browser
B
8
S
2
Posts: 53
Reputation: 687

Post » Mon Jul 20, 2015 11:53 pm

or
1.on start of layout set glob text var 'language' = Browser.Language
2.system compare var 'language'= "En-Us" then set text to "Hello"
-else system compare var 'language'= "De-De" then set text to "Hallo" and so on...
Image Image
B
25
S
14
G
136
Posts: 876
Reputation: 71,005

Post » Tue Jul 21, 2015 9:53 am

@Edelplastic: Make sure to put all string text between quotes ( "" ).
In your first screenshot you need to check for the value "en-US" not en-US.

Also, instead of "Compare two values: Browser.Language = Browser.language" you can have the action in a "On start of layout" system condition instead.
Comparing if 0 is 0 every frame is not a good habit to take honestly. See how events work.
New to Construct ? Where to start

Image Image

Image Image

Please attach a capx to any help request or bug report !
Moderator
B
292
S
115
G
96
Posts: 7,293
Reputation: 70,769

Next

Return to How do I....?

Who is online

Users browsing this forum: richardfu and 32 guests