Archive: System locale tip


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
http://nsis.sourceforge.net/Detect_U...C_LangID...%29
but it didn't detect the system locale correctly.

Hope this helps someone.

You may want to add the remark on the referred wiki page so would be accessible by everyone.


To be more specific ,for automatic locale language detection


onInit


System
::Call "kernel32::GetSystemDefaultLCID()i .R0"
StrCpy $LANGUAGE $R0
Pop $R0

FunctionEnd
>

Or even:
System::Call "kernel32::GetSystemDefaultLCID()i .a"
a = $LANGUAGE.

Stu