Get Windows Language from PC

For questions about using Classic.

Post » Mon Apr 12, 2010 5:51 pm

I wanted to save the settings as an .ini file. The first thing I try, is to put languages in my game (English and German). Now, I can't find anything related for condition like: If value 1 of item "Language" in group "Settings", then "change something". Did I miss something here? And last question, is it possible for Construct to find out what Language the user's windows has, so the game automatically sets the game to the right language on first start.
B
7
S
1
G
2
Posts: 87
Reputation: 1,099

Post » Sat Apr 17, 2010 7:08 pm

Well, I'm going to bump a little. No help here?
B
7
S
1
G
2
Posts: 87
Reputation: 1,099

Post » Sat Apr 17, 2010 8:52 pm

You have to use Registry Object and retrieve value from "\HKEY_LOCAL_MACHINE\SYSTEM\ControlSet001\Control\Nls\Language\Default" which is language that is stored there.

http://www.windowsitpro.com/article/con ... ored-.aspx here you have ID table of languages.

Edit: Ok after playing with Registry object i think you cant even read other values than you made.
B
4
S
2
G
4
Posts: 719
Reputation: 2,938

Post » Sat Apr 17, 2010 11:10 pm

Yep, it's not working. I have a MUI that changed Windows from English to German. I have value not listed.
But I found something else:
Can someone check "/HKEY_CURRENT_USER/Control Panel/Desktop/MuiCached/MachinePreferredUILanguages"?
I got de-DE so it's right. I just need to know if everyone else has this Registry key also and if it's the right language. :)
B
7
S
1
G
2
Posts: 87
Reputation: 1,099

Post » Sun Apr 18, 2010 12:45 am

Hello.

I don't have the registry key that you mention:

"/HKEY_CURRENT_USER/Control Panel/Desktop/MuiCached/MachinePreferredUILanguages"

The bold part is as far as I could go on that path.

I do, however, have "\HKEY_LOCAL_MACHINE\SYSTEM\ControlSet001\Control\Nls\Language\Default", mentioned earlier, which correctly has value 0409 for English.

Also, I found "HKEY_CURRENT_USER\Control Panel\International", which had an item "sLanguage" with value "ENU" for U.S. English. I don't know if one can count on that being there for other machines.

EDIT - I got a bit more curious about this, and tried it in Construct 0.99.84. I Created a new .cap, dropped a Registry and a Text object in it, and it works. Here is the one event that I used 'copied as text' using Construct:

[code:2s6rxsh0]+ System: Start of layout
-> Registry: Open key "SYSTEM\\ControlSet001\\Control\\Nls\\Language" under root HKEY_LOCAL_MAHCINE
-> Text: Set text to "Language code is " & Registry.ReadString("Default")[/code:2s6rxsh0]

This displays 0409 for me (US English.)

Note that the backslashes were 'escaped' using double backslashes, and the 'MAHCINE' is a typo in Construct.
B
3
S
2
G
2
Posts: 187
Reputation: 1,449

Post » Sun Apr 18, 2010 9:32 am

While the first one doesn't work, having a value of 0807.
The second one with "sLanguage" does have DES for me, which is Deutsch Swiss (German Swiss). So it seems like this is the right registry to choose from. :D
B
7
S
1
G
2
Posts: 87
Reputation: 1,099

Post » Sun Apr 18, 2010 1:24 pm

OK, I also tried this with my XP Virtual Machine. I found out, that sLanguage is not the language of the windows. It's the setting of your Regional Options. But this doesn't really hurt.

Now, looking at Language\Default in XP shows 0409 too, which is right, because the Windows is in English. My Windows 7 says 0807, while in the list it says 0407 is German. It's possible, that after installing a MUI, the first two numbers of the value change from 04 to 08. :|

[Edit]At last it's working, but I need to know something. Is there any Wildcard option (*) in Construct?
B
7
S
1
G
2
Posts: 87
Reputation: 1,099

Post » Sun Apr 18, 2010 2:34 pm

[quote="Neo1000":2yh0bj7z][Edit]At last it's working, but I need to know something. Is there any Wildcard option (*) in Construct?[/quote:2yh0bj7z]

I don't think that Construct has any regular expression support, but you can probably do make an acceptable function in Construct using the text processing functions shown here:

http://sourceforge.net/apps/mediawiki/c ... xpressions
B
3
S
2
G
2
Posts: 187
Reputation: 1,449


Return to Help & Support using Construct Classic

Who is online

Users browsing this forum: No registered users and 7 guests