Detect user os langage
BlitzMax Forums/BlitzMax Beginners Area/Detect user os langage
| ||
Hi ! Is there a way to detect the user os langage ? (windows, Just french or not !) Thanks ! |
| ||
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. |
| ||
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) |
| ||
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 |
| ||
many thanks ! |
| ||
I rest my case. |