Archive: How NSIS handles OS language?


How NSIS handles OS language?
Hello,

I am a NSIS newbie and would like some guidance regarding handling of OS language. My installer is written using MUI and at the moment works only in English. It checks and if necessary installs .NET 2.0 but since I handle only English version of .NET I would like to make sure and abort the installer on in case of non-English OS. Do I need to code this logic by hand (and detect OS Language in .onInit) or NSIS engine would do me a favor and automatically abort installation on non-English OS?

Thanks


http://forums.winamp.com/showthread....ystem+language
Edit: Ok that is wrong information.

Use the MoreInfo plugin:
http://nsis.sourceforge.net/MoreInfo_plug-in

-Stu


Thanks for the suggestion but I am not sure if MoreInfo::GetOSUserinterfaceLanguage answers my question.

According to plug-in documentation this function returns GUI Language suitable for NSIS that is determined by the algorithm -

When the installer starts up it goes through these steps to select the interface language:

1. Get user's default Windows OS GUI language
2. Find a perfect match for the langauge
3. If there is no perfect match, find a primary language match
4. If there is no match, use the first language defined in the script (make sure your first language is a common one like English)
5. If the langauge variable $LANGUAGE has changed during .onInit, NSIS goes through steps 2 to 4 again, as in the case of this plugin.

As you can see the outcome of a chosen language is never un-expected.
But in reality I don't want steps 4-5. My installer has only one language - "English", so step 4 will always guarantee that I will get it. However I don't want to install English .NET 2.0 on non-English computer. That would seriously mess up user machine. Is there an easy way to force installer to abort on non-English machine or do I have to implement it from scratch?


System::Call `kernel32::GetUserDefaultUILanguage() i.s`
Pop $R0 # $R0 == 1033

Either use GetUserDefaultUILanguage (as shown) or GetSystemDefaultUILanguage.

Edit: Note that this function does not exist on Windows 95 or NT. http://support.microsoft.com/default...NoWebContent=1

-Stu

Thanks


Why don't NSIS use GetSystemDefaultLCID for language selection? Most software does that to detect correct language for systems with English UI and non-English locale. NSIS fails here.

Nevermind, found an easy way to achieve this:

Function .onInit
; Language detection
System::Call 'kernel32::GetSystemDefaultLangID() i.a'
FunctionEnd