Detect user os langage

BlitzMax Forums/BlitzMax Beginners Area/Detect user os langage

hub(Posted 2012) [#1]
Hi !
Is there a way to detect the user os langage ? (windows, Just french or not !)
Thanks !


SystemError51(Posted 2012) [#2]
Hmm good question! :) I think BlitzMax does not have access to that on Windows (I think on Mac and Linux you can query the language by checking certain files).

In my opinion, for a Windows client, maybe it's best if you provide a choice for the language.

If the user can choose this at download, you'd have to recompile the game for every single language (not really efficient).

If the user can choose this when running the program, you could compile all language strings into the game, and then pick the right ones depending on what the user chose.

For Mac OS X 10.4 and later:

defaults read .GlobalPreferences AppleLanguages | tr -d [:space:] | cut -c2-3


Under Linux it works with the

locale


command.


Zeke(Posted 2012) [#3]
SuperStrict

Extern "win32"
	Function GetSystemDefaultLocaleName:Int(lplocalename:Byte Ptr,cchLocaleName:Int)
End Extern

Local locale:Short[10]

Local result:Int=GetSystemDefaultLocaleName(locale,10)

Print String.FromShorts(locale,result)



matibee(Posted 2012) [#4]
Here's one way..
SuperStrict 

Extern "Win32"

	Function GetUserDefaultLCID:Int()
		
End Extern

Print GetUserDefaultLCID()

Which on my system returns 2057 as expected. See: http://support.microsoft.com/kb/193080

Last edited 2012

Last edited 2012


hub(Posted 2012) [#5]
many thanks !


SystemError51(Posted 2012) [#6]
I rest my case.