Sir Hally
Sir Hally

Reputation: 2358

NSIS works with LangString incorrectly

I have an installer, it builds automatically (on TFS) by using NSIS command line features

"..\..\NSIS\makensis.exe"  /DBUILD_NUMBER=28311 /DPRODUCT_LANGUAGE=English "MTService_setup.nsi"

The installer must use language, which specified in PRODUCT_LANGUAGE parameter. I've done it in the following way

!insertmacro MUI_LANGUAGE "${PRODUCT_LANGUAGE}"

When I build installer in such way, the common language of the interface is correct. But it uses default system language for LangString. So, if default system language is not English, it shows LangString on another language in the English installer.

I've tried to change script to avoid command line parameters (for test purposes)

!insertmacro MUI_LANGUAGE "English"

It doesn't work too.

I've tried to change script to

!insertmacro MUI_LANGUAGE "English" !insertmacro MUI_LANGUAGE "Russian"

Function .onInit

!insertmacro MUI_LANGDLL_DISPLAY

FunctionEnd

It works, but, of course, it shows language selection dialog. I want to use specific ${PRODUCT_LANGUAGE} without any dialog.

So, how can I fix it?

Example

Upvotes: 0

Views: 3238

Answers (1)

Anders
Anders

Reputation: 101666

You did not show us your LangString code in your example so it is hard to say what the problem is!

Here is a working example based on code in the MUI readme:

Outfile "test.exe"
Requestexecutionlevel user

!include MUI2.nsh
!insertmacro MUI_PAGE_COMPONENTS
!insertmacro MUI_PAGE_INSTFILES
!insertmacro MUI_LANGUAGE Swedish ;First language is the default if a better match is not found
!insertmacro MUI_LANGUAGE Danish

Function .onInit
StrCpy $language ${LANG_DANISH} ;Always force Danish?
FunctionEnd

Section "Section Name 1" Section1
SectionEnd
Section "Section Name 2" Section2
SectionEnd

LangString DESC_Section1 ${LANG_SWEDISH} "Bork, bork, bork!"
LangString DESC_Section2 ${LANG_SWEDISH} "Aweenda shmure da froog's legs."
LangString DESC_Section1 ${LANG_DANISH} "Danish text here for section 1"
LangString DESC_Section2 ${LANG_DANISH} "...and section 2"
!insertmacro MUI_FUNCTION_DESCRIPTION_BEGIN
    !insertmacro MUI_DESCRIPTION_TEXT ${Section1} $(DESC_Section1)
    !insertmacro MUI_DESCRIPTION_TEXT ${Section2} $(DESC_Section2)
!insertmacro MUI_FUNCTION_DESCRIPTION_END

Upvotes: 1

Related Questions