Search code examples
nsis

NSIS: LangString X set multiple times for 0, wasting space


I want to define LangString for more languages. Here is a example

LangString TEXT_LICENSE_TITLE ${ENGLISH_LANG} "Installer"
LangString TEXT_LICENSE_TITLE ${NORWEGIAN_LANG} "installatør"

But I got the warning LangString "TEXT_LICENSE_TITLE" set multiple times for 0, wasting space.

I think I have the correct order. Here my code

!insertmacro MUI_LANGUAGE "Norwegian"
!insertmacro MUI_LANGUAGE "English"

then

LangString TEXT_LICENSE_TITLE ${ENGLISH_LANG} "Installer"
LangString TEXT_LICENSE_TITLE ${NORWEGIAN_LANG} "installatør"

!define MUI_TEXT_LICENSE_TITLE $(TEXT_LICENSE_TITLE)

So how could i get away this warning? I use nsis 2.51.


Solution

  • 0 is the default/"last used" language id and it is used because you did not pass a valid id.

    The correct syntax is

    LangString TEXT_LICENSE_TITLE ${LANG_ENGLISH} "English text"
    

    Note the use of { } braces, not ( ) for the 2nd parameter. ${} expands a define at compile-time (what you need in this case) and the other expands a langstring. The name of the define is LANG_* if I remember correctly.