Skip to content
⌘ NSIS Forum Archive

System locale tip

4 posts

fishsauce#

System locale tip

I'd just like to make a remark since it took me awhile to figure this out.

To get the setting for language for non-Unicode programs (the system locale), you can use:
System::Call "kernel32::GetSystemDefaultLCID()i .R0"
Pop $R0
The 4-digit decimal locale code will be returned in $R0 (i.e. 1033 for en-US).

At first I tried the 'Detect User Locale INFO' example in the wiki

but it didn't detect the system locale correctly.

Hope this helps someone.
Red Wine#
You may want to add the remark on the referred wiki page so would be accessible by everyone.
Makedon#
To be more specific ,for automatic locale language detection
Function .onInit
   System::Call "kernel32::GetSystemDefaultLCID()i .R0"
   StrCpy $LANGUAGE $R0
   Pop $R0  
   
FunctionEnd