Retrieve System Language

BlitzMax Forums/BlitzMax Programming/Retrieve System Language

Uncle Ho(Posted 2006) [#1]
I have been trying to get the current system language the blitzmax program is being executed on. i want to make a decision upon which language the game should show.
i have tried several things but it doesn't work out.
this is what i have tried:

Import "-luser32"

Extern "win32"

  Function GetSystemDefaultLangID () = "GetSystemDefaultLangID@0"
  Function VerLanguageName:Int (wLang:Int, szLang$z, nSize:Int ) = "VerLanguageNameA"
   
EndExtern

Local Lid:Int = GetSystemDefaultLangID()
Global Language:String
Notify "id = " + Lid
VerLanguageName( Lid, Language, 64 )
Notify "lang = " + Language

End


but this always gives me:
undefined reference to `VerLanguageNameA'


commenting this out will give me an ID.
but i could not find a table with matching values to it yet.
'VerLanguageName( Lid, Language, 64 )


maybe i am doing it completely wrong and there is a much better way to find out. could someone help, please?


Uncle Ho(Posted 2006) [#2]
Hm... Nobody has an idea?


Dreamora(Posted 2006) [#3]
Wouldn't it be VerLanguageNameA@4 as it returns int?


Gabriel(Posted 2006) [#4]
I thought it was the data which it takes, not returns. Which would make it VerLanguageNameA@12


MattVonFat(Posted 2006) [#5]
http://www.microsoft.com/globaldev/reference/win2k/setup/lcid.mspx

This has a table with the IDs that you get from GetSystemDefaultLangID


MattVonFat(Posted 2006) [#6]
I managed to get this to work:



There might be a better way but I'm not good at coming up with the best way to do things :)

I'm not sure what the max size of the memory needs to be but 30 was larger than what VerLanguageName was returning.


Uncle Ho(Posted 2006) [#7]
Hey, thank you guys.
Especially MattVonFat!

That was what i was looking for!
You really made my day :)

One crazy thing:
If i compile the exe in Debugmode: ID = 1031 (German)
if i compile the exe without Debug: ID = 15991815 (?)

Nonetheless "LangName" will show the correct Language.

what is this?


MattVonFat(Posted 2006) [#8]
I tried it on mine with debug on and off but i still got the the same language code.


Uncle Ho(Posted 2006) [#9]
I found out what it was.

If you add:

AppTitle = "BuBu" ' Or whatever


before calling:

GetSystemDefaultLangID( ) 


you get those weird results.