Archive: How to use LicenseLangString


How to use LicenseLangString
I have release 2.0 and HM NIS. I am trying to use LicenseLangString in a MUI and can't figure it out. I get the prompt to select my language and the prompts are in the selected language but I can't figure out where and what exactly to put in the NSI file.

I have included the relevant portion of my NSI file below.

It currently gives the following warnings:

warnings:
LicenseLangString "myLicenseData" set multiple times for 0, wasting space (D:\cswing\staging\release\myInstaller.nsi:34)
LicenseLangString "myLicenseData" set multiple times for 0, wasting space (D:\cswing\staging\release\myInstaller.nsi:35)
LangString "myLicenseData" is not set in language table of language 1041
LangString "myLicenseData" is not set in language table of language 1031

I've tried lots of variations without success. I've also tried googling and reading the manual and the multi-language sample but couldn't figure it out.

TIA.

====

; MUI 1.67 compatible ------
!include "MUI.nsh"
!include UpgradeDLL.nsh

; MUI Settings
!define MUI_ABORTWARNING
!define MUI_ICON "app.ico"
!define MUI_UNICON "app.ico"

; Language Selection Dialog Settings
!define MUI_LANGDLL_REGISTRY_ROOT "${PRODUCT_UNINST_ROOT_KEY}"
!define MUI_LANGDLL_REGISTRY_KEY "${PRODUCT_UNINST_KEY}"
!define MUI_LANGDLL_REGISTRY_VALUENAME "NSIS:Language"

; Welcome page
!insertmacro MUI_PAGE_WELCOME
; License page
!define MUI_LICENSEPAGE_CHECKBOX

LicenseLangString myLicenseData ${LANG_ENGLISH} "license.txt"
LicenseLangString myLicenseData ${LANG_GERMAN) "license_de.txt"
LicenseLangString myLicenseData ${LANG_JAPANESE) "license_jp.txt"
LicenseData $(myLicenseData)
!insertmacro MUI_PAGE_LICENSE $(myLicenseData)


; Directory page
!insertmacro MUI_PAGE_DIRECTORY
; Instfiles page
!insertmacro MUI_PAGE_INSTFILES


I apologize about the ')'s that are in the lines below in my original post (corrected here to '}'). Surprisingly, it doesn't change the warnings.

LicenseLangString myLicenseData ${LANG_GERMAN} "license_de.txt"
LicenseLangString myLicenseData ${LANG_JAPANESE} "license_jp.txt"


The "LicenseLangString" lines should come AFTER the "!insertmacro MUI_LANGUAGE" lines.


Thanks. That helped. However, I'm curious as to why the code pages aren't defined. I have to use:

LicenseLangString myLicenseData ${LANG_ENGLISH} "license.txt"
LicenseLangString myLicenseData 1031 "license_de.txt"
LicenseLangString myLicenseData 1041 "license_jp.txt"

Instead of:

LicenseLangString myLicenseData ${LANG_GERMAN} "license_de.txt"
LicenseLangString myLicenseData ${LANG_JAPANESE} "license_jp.txt"

Otherwise the compiler gives the warnings I put in my first post:

LicenseLangString "myLicenseData" set multiple times for 0, wasting space (D:\cswing\staging\release\myInstaller.nsi:34)
LicenseLangString "myLicenseData" set multiple times for 0, wasting space (D:\cswing\staging\release\myInstaller.nsi:35)
LangString "myLicenseData" is not set in language table of language 1041
LangString "myLicenseData" is not set in language table of language 1031

It also seems that I don't need this line:

LicenseData $(myLicenseData)


Are you using MUI_LANGUAGE for each language you want to use, like this:

!insertmacro MUI_LANGUAGE "English"
!insertmacro MUI_LANGUAGE "French"
!insertmacro MUI_LANGUAGE "German"
etc

As for the LicenseData, I think all you need is:

!define MUI_LICENSEPAGE_CHECKBOX
!insertmacro MUI_PAGE_LICENSE "$(myLicenseData)"

The LangString and LicenseLangString lines all have to come after the MUI_LANGUAGE lines.

The order of the MUI "commands" is very important - it took me several attempts to find the correct order (I had to re-read the MUI ReadMe lots of times).


I appreciate your help pengyou. Putting the LicenseLangString lines after "!insertmacro MUI_PAGE_LICENSE $(myLicenseData)
" fixed the problem execept for the ${LANG_xxx}.

I was able to fixed this by moving the LicenseLangString lines under the insertmacro lines for the languages (see below).

!insertmacro MUI_LANGUAGE "English"
!insertmacro MUI_LANGUAGE "German"
!insertmacro MUI_LANGUAGE "Japanese"
LicenseLangString myLicenseData ${LANG_ENGLISH} "license.txt"
LicenseLangString myLicenseData ${LANG_GERMAN} "license_de.txt"
LicenseLangString myLicenseData ${LANG_JAPANESE} "license_jp.txt"