Archive: Multilingual EULA using LicenseLangString


Multilingual EULA using LicenseLangString
Hi All,

I am facing this problem related to localisation of EULA. I want that which ever language is selected by the user from the language selection drop down accroding to it the EULA also should change. For this I am also maintaining different rtf files for the related languages used but somehow m not able to get the end result. Please help me on this. I am attaching the implemented code here to get some idea regarding the problem.

Regards,
Parth


; Script generated by the HM NIS Edit Script Wizard.

; HM NIS Edit Wizard helper defines
!define PRODUCT_NAME "VPN Remote Access Client"
!define PRODUCT_VERSION "2.0.1"
!define PRODUCT_PUBLISHER "ClearPath Network, Inc."
!define PRODUCT_WEB_SITE "http://www.clearpathnet.com"
!define PRODUCT_DIR_REGKEY "Software\Microsoft\Windows\CurrentVersion\App Paths\VPN Remote Access Client.exe"
!define PRODUCT_UNINST_KEY "Software\Microsoft\Windows\CurrentVersion\Uninstall\${PRODUCT_NAME}"
!define PRODUCT_UNINST_ROOT_KEY "HKLM"

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

; MUI Settings
!define MUI_ABORTWARNING
!define MUI_ICON "C:\Documents and Settings\parthiv\Desktop\RAC\Resources\CPN.ico"
!define MUI_UNICON "C:\Documents and Settings\parthiv\Desktop\RAC\Resources\UNCPN.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
!insertmacro MUI_PAGE_LICENSE "C:\Documents and Settings\parthiv\Desktop\RAC\Resources\CPN-EULA.rtf"
; Directory page
!insertmacro MUI_PAGE_DIRECTORY
; Instfiles page
!insertmacro MUI_PAGE_INSTFILES
; Finish page
!define MUI_FINISHPAGE_RUN "$INSTDIR\VPN Remote Access Client.exe"
!insertmacro MUI_PAGE_FINISH

; Uninstaller pages
!insertmacro MUI_UNPAGE_INSTFILES


; Language files
!insertmacro MUI_LANGUAGE "English"
!insertmacro MUI_LANGUAGE "Italian"
!insertmacro MUI_LANGUAGE "French"
!insertmacro MUI_LANGUAGE "German"

; License Language
LicenseLangString MUILicense LANG_ENGLISH "C:\Documents and Settings\parthiv\Desktop\RAC\Resources\CPN-EULA.rtf"
LicenseLangString MUILicense LANG_FRENCH "C:\Documents and Settings\parthiv\Desktop\RAC\Resources\CPN-EULA_French.rtf"
LicenseLangString MUILicense LANG_GERMAN "C:\Documents and Settings\parthiv\Desktop\RAC\Resources\CPN-EULA_German.rtf"
LicenseLangString MUILicense LANG_ITALIAN "C:\Documents and Settings\parthiv\Desktop\RAC\Resources\CPN-EULA_Italian.rtf"
; LicenseData MUILicense



; MUI end ------

Name "${PRODUCT_NAME} ${PRODUCT_VERSION}"
OutFile "VPNRemoteAccessClientSetupFramework2WithMultiLang.exe"
InstallDir "$PROGRAMFILES\VPN Remote Access Client"
InstallDirRegKey HKLM "${PRODUCT_DIR_REGKEY}" ""
ShowInstDetails show
ShowUnInstDetails show

Function .onInit
!insertmacro MUI_LANGDLL_DISPLAY
FunctionEnd

;Function testLang
;!if ${LANG_ENGLISH}
; !insertmacro MUI_PAGE_LICENSE "C:\Documents and Settings\parthiv\Desktop\RAC\Resources\CPN-EULA.rtf"
;!else if ${LANG_FRENCH}
; !insertmacro MUI_PAGE_LICENSE "C:\Documents and Settings\parthiv\Desktop\RAC\Resources\CPN-EULA_French.rtf"
;!Endif
;FunctionEnd

Section "MainSection" SEC01
SetOutPath "$INSTDIR"
SetOverwrite ifnewer
File "VPN Remote Access Client.exe"
CreateDirectory "$SMPROGRAMS\VPN Remote Access Client"
CreateShortCut "$SMPROGRAMS\VPN Remote Access Client\VPN Remote Access Client.lnk" "$INSTDIR\VPN Remote Access Client.exe" "" "$INSTDIR\Icons\snapvpn5.ico"
CreateShortCut "$DESKTOP\VPN Remote Access Client.lnk" "$INSTDIR\VPN Remote Access Client.exe" "" "$INSTDIR\Icons\snapvpn5.ico"
SetOverwrite try
File "License.rtf"
File "License.txt"
SetOutPath "$INSTDIR\Icons"
File "Icons\connected.ico"
File "Icons\connecting.ico"
File "Icons\disconnected.ico"
File "Icons\reconnecting.ico"
File "Icons\snapvpn5.ico"
SetOutPath "$INSTDIR\de-DE"
File "de-DE\VPN Remote Access Client.resources.dll"
SetOutPath "$INSTDIR\it-IT"
File "it-IT\VPN Remote Access Client.resources.dll"
SetOutPath "$INSTDIR\fr-FR"
File "fr-FR\VPN Remote Access Client.resources.dll"
SetOutPath "$INSTDIR\en-US"
File "en-US\VPN Remote Access Client.resources.dll"
SetOutPath "$INSTDIR\Connections\Icons"
File "Connections\Icons\connected.ico"
File "Connections\Icons\connecting.ico"
File "Connections\Icons\disconnected.ico"
File "Connections\Icons\reconnecting.ico"
File "Connections\Icons\snapvpn5.ico"
SetOutPath "$INSTDIR\Connections\Site - 14"
File "Connections\Site - 14\ca_file"
File "Connections\Site - 14\cert_file"
File "Connections\Site - 14\dh_file"
File "Connections\Site - 14\key_file"
SetOutPath "$INSTDIR\Connections\Site - 279"
File "Connections\Site - 279\ca_file"
File "Connections\Site - 279\cert_file"
File "Connections\Site - 279\dh_file"
File "Connections\Site - 279\key_file"
SetOutPath "$INSTDIR\Connections\Site - 334"
File "Connections\Site - 334\ca_file"
File "Connections\Site - 334\cert_file"
File "Connections\Site - 334\dh_file"
File "Connections\Site - 334\key_file"
SetOutPath "$INSTDIR\Connections\Site - 342"
File "Connections\Site - 342\ca_file"
File "Connections\Site - 342\cert_file"
File "Connections\Site - 342\dh_file"
File "Connections\Site - 342\key_file"
SetOutPath "$INSTDIR\Connections\Site - 1176"
File "Connections\Site - 1176\ca_file"
File "Connections\Site - 1176\cert_file"
File "Connections\Site - 1176\dh_file"
File "Connections\Site - 1176\key_file"
SetOutPath "$INSTDIR\VPN Resources"
File "VPN Resources\libeay32.dll"
File "VPN Resources\libssl32.dll"
File "VPN Resources\OemWin2k.inf"
File "VPN Resources\openvpn.exe"
File "VPN Resources\tap0801.sys"
File "VPN Resources\tapinstall.exe"
File "VPN Resources\Branding.bmp"
SetOutPath "$INSTDIR\Connections"
File "Connections\Readme.txt"
SectionEnd

Section -AdditionalIcons
WriteIniStr "$INSTDIR\${PRODUCT_NAME}.url" "InternetShortcut" "URL" "${PRODUCT_WEB_SITE}"
CreateShortCut "$SMPROGRAMS\VPN Remote Access Client\Website.lnk" "$INSTDIR\${PRODUCT_NAME}.url"
CreateShortCut "$SMPROGRAMS\VPN Remote Access Client\Uninstall.lnk" "$INSTDIR\uninst.exe"
SectionEnd

Section -Post
WriteRegStr HKCU "Software\ClearPath Network\SNAP VPN Remote Client\" "SNAP VPN Remote Client" "SNAP"
WriteRegStr HKCU "Software\ClearPath Network\SNAP VPN Remote Client\checked" "remember" "false"
WriteRegStr HKCU "Software\ClearPath Network\SNAP VPN Remote Client\Company_ID" "Company_ID" "10742"
WriteRegStr HKCU "Software\ClearPath Network\SNAP VPN Remote Client\Culture_ID" "Culture_ID" "en-US"
WriteRegStr HKCU "Software\ClearPath Network\SNAP VPN Remote Client\username" "username" "noctemp"
WriteRegStr HKCU "Software\ClearPath Network\SNAP VPN Remote Client\username" "password" "password"
WriteUninstaller "$INSTDIR\uninst.exe"
WriteRegStr HKLM "${PRODUCT_DIR_REGKEY}" "" "$INSTDIR\VPN Remote Access Client.exe"
WriteRegStr ${PRODUCT_UNINST_ROOT_KEY} "${PRODUCT_UNINST_KEY}" "DisplayName" "$(^Name)"
WriteRegStr ${PRODUCT_UNINST_ROOT_KEY} "${PRODUCT_UNINST_KEY}" "UninstallString" "$INSTDIR\uninst.exe"
WriteRegStr ${PRODUCT_UNINST_ROOT_KEY} "${PRODUCT_UNINST_KEY}" "DisplayIcon" "$INSTDIR\VPN Remote Access Client.exe"
WriteRegStr ${PRODUCT_UNINST_ROOT_KEY} "${PRODUCT_UNINST_KEY}" "DisplayVersion" "${PRODUCT_VERSION}"
WriteRegStr ${PRODUCT_UNINST_ROOT_KEY} "${PRODUCT_UNINST_KEY}" "URLInfoAbout" "${PRODUCT_WEB_SITE}"
WriteRegStr ${PRODUCT_UNINST_ROOT_KEY} "${PRODUCT_UNINST_KEY}" "Publisher" "${PRODUCT_PUBLISHER}"
SectionEnd


Function un.onUninstSuccess
HideWindow
MessageBox MB_ICONINFORMATION|MB_OK "$(^Name) was successfully removed from your computer."
FunctionEnd

Function un.onInit
MessageBox MB_ICONQUESTION|MB_YESNO|MB_DEFBUTTON2 "Are you sure you want to completely remove $(^Name) and all of its components?" IDYES +2
Abort
FunctionEnd

Function InstallDotNet
MessageBox MB_ICONQUESTION|MB_YESNO|MB_DEFBUTTON2 "DotNET Framework 2.0 is required. Install Framework ?" IDYES +2
Abort 'Cannot install application without DotNET Framework 2.0'
FunctionEnd

Function IsDotNET2Installed
Push $0
Push $1
Push $2
Push $3
Push $4

; Check for HKLM\Software\Microsoft\.NETFramework\InstallRoot value
ReadRegStr $4 HKLM "Software\Microsoft\.NETFramework" "InstallRoot"
; remove trailing back slash
Push $4
Exch $EXEDIR
Exch $EXEDIR
Pop $4
; if the root directory doesn't exist .NET is not installed
IfFileExists $4 0 noDotNET

; Loop through all subkeys in HKLM\Software\Microsoft\.NETFramework\Policy, looking for v2.0
StrCpy $0 0
EnumStart:
EnumRegKey $2 HKLM "Software\Microsoft\.NETFramework\Policy" $0
IntOp $0 $0 + 1
StrCmp $2 "v2.0" GotKey
StrCmp $2 "" noDotNet
goto EnumStart
GotKey:

; Now loop through all values in appropriate key, and make sure its actual directory exists
StrCpy $1 0
EnumPolicy:
EnumRegValue $3 HKLM "Software\Microsoft\.NETFramework\Policy\v2.0" $1
IntOp $1 $1 + 1
StrCmp $3 "" noDotNet
IfFileExists "$4\v2.0.$3" GotDir EnumPolicy
GotDir:

; We have now verified that .NET is there
StrCpy $0 "$4\v2.0.$3"
; MessageBox MB_OK "Found .NET v2.0 at $0"
Goto done

noDotNET:
StrCpy $0 ""
Goto done

done:
Pop $4
Pop $3
Pop $2
Pop $1
Exch $0
FunctionEnd

Section Uninstall
Delete "$INSTDIR\${PRODUCT_NAME}.url"
Delete "$INSTDIR\uninst.exe"
Delete "$INSTDIR\VPN Resources\tapinstall.exe"
Delete "$INSTDIR\VPN Resources\tap0801.sys"
Delete "$INSTDIR\VPN Resources\openvpn.exe"
Delete "$INSTDIR\VPN Resources\OemWin2k.inf"
Delete "$INSTDIR\VPN Resources\libssl32.dll"
Delete "$INSTDIR\VPN Resources\libeay32.dll"
Delete "$INSTDIR\VPN Resources\Branding.bmp"
Delete "$INSTDIR\Icons\\snapvpn5.ico"
Delete "$INSTDIR\Icons\\reconnecting.ico"
Delete "$INSTDIR\License.txt"
Delete "$INSTDIR\License.rtf"
Delete "$INSTDIR\Icons\disconnected.ico"
Delete "$INSTDIR\Icons\connecting.ico"
Delete "$INSTDIR\Icons\connected.ico"
Delete "$INSTDIR\VPN Remote Access Client.exe"
Delete "$INSTDIR\Connections\Readme.txt"

Delete "$SMPROGRAMS\VPN Remote Access Client\Uninstall.lnk"
Delete "$SMPROGRAMS\VPN Remote Access Client\Website.lnk"
Delete "$DESKTOP\VPN Remote Access Client.lnk"
Delete "$SMPROGRAMS\VPN Remote Access Client\VPN Remote Access Client.lnk"

RMDir "$SMPROGRAMS\VPN Remote Access Client"
RMDir "$INSTDIR\Icons"
RMDir "$INSTDIR\VPN Resources"
RMDIR "$INSTDIR\Connections"
RMDir "$INSTDIR"

DeleteRegKey ${PRODUCT_UNINST_ROOT_KEY} "${PRODUCT_UNINST_KEY}"
DeleteRegKey HKLM "${PRODUCT_DIR_REGKEY}"
DeleteRegKey HKCU "Software\ClearPath Network\"
SetAutoClose true
SectionEnd


Hi parthivk!

There is a perfect example.

Look here:

http://nsis.sourceforge.net/Examples...tiLanguage.nsi

You'll find this in your Examples\Modern UI\MultiLanguage.nsi as well.

Have a nice day!

Cheers

Bruno


Try this

...
LicenseLangString MUILicense ${LANG_ENGLISH} "C:\Documents and Settings\parthiv\Desktop\RAC\Resources\CPN-EULA.rtf"
LicenseLangString MUILicense ${LANG_FRENCH} "C:\Documents and Settings\parthiv\Desktop\RAC\Resources\CPN-EULA_French.rtf"
...

Hi,

Thanx for the reply but it is still not working. I am getting this error for the above change.



Command line:
"C:\Program Files\NSIS\makensis.exe" /NOTIFYHWND 197450 "C:\Documents and Settings\parthiv\Desktop\VPN Client\VPN Remote Access Client - Framework & Language Support.nsi"

MakeNSIS v2.18 - Copyright 1999-2006 Nullsoft, Inc.

Portions Copyright (C) 1995-1998 Jean-loup Gailly and Mark Adler (zlib).
Portions Copyright (C) 1996-2002 Julian R Seward (bzip2).
Portions Copyright (C) 1999-2003 Igor Pavlov (lzma).

Contributors: nnop@newmail.ru, Ryan Geiss, Andras Varga, Drew Davidson, Peter Windridge, Dave Laundon, Robert Rainwater, Yaroslav Faybishenko, Jeff Doozan, Amir Szekely, Ximon Eighteen, et al.

Processing config:
Processing plugin dlls: "C:\Program Files\NSIS\Plugins\*.dll"
- AdvSplash::show
- Banner::destroy
- Banner::getWindow
- Banner::show
- BgImage::AddImage
- BgImage::AddText
- BgImage::Clear
- BgImage::Destroy
- BgImage::Redraw
- BgImage::SetBg
- BgImage::SetReturn
- BgImage::Sound
- Dialer::AttemptConnect
- Dialer::AutodialHangup
- Dialer::AutodialOnline
- Dialer::AutodialUnattended
- Dialer::GetConnectedState
- InstallOptions::dialog
- InstallOptions::initDialog
- InstallOptions::show
- LangDLL::LangDialog
- Math::Script
- NSISdl::download
- NSISdl::download_quiet
- Splash::show
- StartMenu::Init
- StartMenu::Select
- StartMenu::Show
- System::Alloc
- System::Call
- System::Copy
- System::Free
- System::Get
- System::Int64Op
- System::Store
- TypeLib::GetLibVersion
- TypeLib::Register
- TypeLib::UnRegister
- UserInfo::GetAccountType
- UserInfo::GetName
- VPatch::vpatchfile
- nsExec::Exec
- nsExec::ExecToLog
- nsExec::ExecToStack

!define: "MUI_INSERT_NSISCONF"=""

Changing directory to: "C:\Documents and Settings\parthiv\Desktop\VPN Client"

Processing script file: "C:\Documents and Settings\parthiv\Desktop\VPN Client\VPN Remote Access Client - Framework & Language Support.nsi"
!define: "PRODUCT_NAME"="VPN Remote Access Client"
!define: "PRODUCT_VERSION"="2.0.1"
!define: "PRODUCT_PUBLISHER"="ClearPath Network, Inc."
!define: "PRODUCT_WEB_SITE"="http://www.clearpathnet.com"
!define: "PRODUCT_DIR_REGKEY"="Software\Microsoft\Windows\CurrentVersion\App Paths\VPN Remote Access Client.exe"
!define: "PRODUCT_UNINST_KEY"="Software\Microsoft\Windows\CurrentVersion\Uninstall\VPN Remote Access Client"
!define: "PRODUCT_UNINST_ROOT_KEY"="HKLM"
!include: "C:\Program Files\NSIS\Include\MUI.nsh"
!include: "C:\Program Files\NSIS\Contrib\Modern UI\System.nsh"
NSIS Modern User Interface version 1.75 - © 2002-2006 Joost Verburg (C:\Program Files\NSIS\Contrib\Modern UI\System.nsh:11)
!define: "MUI_VERBOSE"="3"
!include: closed: "C:\Program Files\NSIS\Contrib\Modern UI\System.nsh"
!include: closed: "C:\Program Files\NSIS\Include\MUI.nsh"
!define: "MUI_ABORTWARNING"=""
!define: "MUI_ICON"="C:\Documents and Settings\parthiv\Desktop\RAC\Resources\CPN.ico"
!define: "MUI_UNICON"="C:\Documents and Settings\parthiv\Desktop\RAC\Resources\UNCPN.ico"
!define: "MUI_LANGDLL_REGISTRY_ROOT"="HKLM"
!define: "MUI_LANGDLL_REGISTRY_KEY"="Software\Microsoft\Windows\CurrentVersion\Uninstall\VPN Remote Access Client"
!define: "MUI_LANGDLL_REGISTRY_VALUENAME"="NSIS:Language"
!insertmacro: MUI_PAGE_WELCOME
!insertmacro: end of MUI_PAGE_WELCOME
!define: "MUI_LICENSEPAGE_CHECKBOX"=""
!insertmacro: MUI_PAGE_LICENSE
!insertmacro: end of MUI_PAGE_LICENSE
!insertmacro: MUI_PAGE_DIRECTORY
!insertmacro: end of MUI_PAGE_DIRECTORY
!insertmacro: MUI_PAGE_INSTFILES
!insertmacro: end of MUI_PAGE_INSTFILES
!define: "MUI_FINISHPAGE_RUN"="$INSTDIR\VPN Remote Access Client.exe"
!insertmacro: MUI_PAGE_FINISH
!insertmacro: end of MUI_PAGE_FINISH
!insertmacro: MUI_UNPAGE_INSTFILES
!insertmacro: end of MUI_UNPAGE_INSTFILES
!insertmacro: MUI_LANGUAGE
!insertmacro: end of MUI_LANGUAGE
!insertmacro: MUI_LANGUAGE
!insertmacro: end of MUI_LANGUAGE
!insertmacro: MUI_LANGUAGE
!insertmacro: end of MUI_LANGUAGE
!insertmacro: MUI_LANGUAGE
!insertmacro: end of MUI_LANGUAGE
LicenseLangString: "MUILicense" 1033 "C:\Documents and Settings\parthiv\Desktop\RAC\Resources\CPN-EULA.rtf"
LicenseLangString: "MUILicense" 1036 "C:\Documents and Settings\parthiv\Desktop\RAC\Resources\CPN-EULA_French.rtf"
LicenseLangString: "MUILicense" 1031 "C:\Documents and Settings\parthiv\Desktop\RAC\Resources\CPN-EULA_German.rtf"
LicenseLangString: "MUILicense" 1040 "C:\Documents and Settings\parthiv\Desktop\RAC\Resources\CPN-EULA_Italian.rtf"
LicenseData: open failed "MUILicense"
Usage: LicenseData local_file_that_has_license_text | license_lang_string
Error in script "C:\Documents and Settings\parthiv\Desktop\VPN Client\VPN Remote Access Client - Framework & Language Support.nsi" on line 53 -- aborting creation process


Hi!

Did you accidentally uncomment this line?

; LicenseData MUILicense

Cheers

Bruno


Instead

!insertmacro MUI_PAGE_LICENSE "C:\Documents and Settings\parthiv\Desktop\RAC\Resources\CPN-EULA.rtf"
use
!insertmacro MUI_PAGE_LICENSE "$(MUILicense)"

And use forum search. :D

Hi Mogilev,

Thanx buddy for your timely reply. Now its working fine. Thanx to all the other forum members as well for their inputs on the same.

Regards