Old 25th April 2006, 00:32   #1
LRaiz
Guest
 
Posts: n/a
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
  Reply With Quote
Old 25th April 2006, 16:39   #2
Afrow UK
Moderator
 
Afrow UK's Avatar
 
Join Date: Nov 2002
Location: Surrey, England
Posts: 8,434
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
Afrow UK is offline   Reply With Quote
Old 25th April 2006, 17:53   #3
LRaiz
Junior Member
 
Join Date: Apr 2006
Posts: 5
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 -
Quote:
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?
LRaiz is offline   Reply With Quote
Old 25th April 2006, 20:13   #4
Afrow UK
Moderator
 
Afrow UK's Avatar
 
Join Date: Nov 2002
Location: Surrey, England
Posts: 8,434
code:

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
Afrow UK is offline   Reply With Quote
Old 25th April 2006, 20:18   #5
LRaiz
Junior Member
 
Join Date: Apr 2006
Posts: 5
Thanks
LRaiz is offline   Reply With Quote
Old 15th November 2012, 16:05   #6
vpupkin
Junior Member
 
Join Date: Nov 2012
Posts: 1
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:

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

vpupkin is offline   Reply With Quote
Reply
Go Back   Winamp & Shoutcast Forums > Developer Center > NSIS Discussion

Thread Tools Search this Thread
Search this Thread:

Advanced Search
Display Modes

Posting Rules
You may not post new threads
You may not post replies
You may not post attachments
You may not edit your posts

BB code is On
Smilies are On
[IMG] code is On
HTML code is Off

Forum Jump