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