Get Windows Language from PC

This forum is currently in read-only mode.
From the Asset Store
A space themed game with high quality 2D graphics and addictive music that provide hours of fun
  • 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.

  • Well, I'm going to bump a little. No help here?

  • 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.

  • 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.

  • 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:

    + 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.
  • 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.

  • Try Construct 3

    Develop games in your browser. Powerful, performant & highly capable.

    Try Now Construct 3 users don't see these ads
  • 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?

  • [Edit]At last it's working, but I need to know something. Is there any Wildcard option (*) in Construct?

    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

Jump to:
Active Users
There are 1 visitors browsing this topic (0 users and 1 guests)