;NSIS Modern User Interface
;Multilingual Example Script
;Written by Joost Verburg

;--------------------------------
;Include Modern UI

  !include "MUI.nsh"

;--------------------------------
;General

  ;Name and file
  Name "Modern UI Test"
  OutFile "MultiLanguage.exe"

  ;Default installation folder
  InstallDir "$PROGRAMFILES\Modern UI Test"
  
  ;Get installation folder from registry if available
  InstallDirRegKey HKCU "Software\Modern UI Test" ""

;--------------------------------
;Interface Settings

  !define MUI_ABORTWARNING

;--------------------------------
;Language Selection Dialog Settings

  ;Remember the installer language
  !define MUI_LANGDLL_REGISTRY_ROOT "HKCU" 
  !define MUI_LANGDLL_REGISTRY_KEY "Software\Modern UI Test" 
  !define MUI_LANGDLL_REGISTRY_VALUENAME "Installer Language"

;--------------------------------
;Pages

  !insertmacro MUI_PAGE_LICENSE $(MUILicense)
  !insertmacro MUI_PAGE_COMPONENTS
  !insertmacro MUI_PAGE_DIRECTORY
  !insertmacro MUI_PAGE_INSTFILES
  
  !insertmacro MUI_UNPAGE_CONFIRM
  !insertmacro MUI_UNPAGE_INSTFILES

;--------------------------------
;Languages

  !insertmacro MUI_LANGUAGE "English" # first language is the default language
  !insertmacro MUI_LANGUAGE "French"
  !insertmacro MUI_LANGUAGE "German"
  !insertmacro MUI_LANGUAGE "Spanish"
  !insertmacro MUI_LANGUAGE "SimpChinese"
  !insertmacro MUI_LANGUAGE "TradChinese"
  !insertmacro MUI_LANGUAGE "Japanese"
  !insertmacro MUI_LANGUAGE "Korean"
  !insertmacro MUI_LANGUAGE "Italian"
  !insertmacro MUI_LANGUAGE "Dutch"
  !insertmacro MUI_LANGUAGE "Danish"
  !insertmacro MUI_LANGUAGE "Swedish"
  !insertmacro MUI_LANGUAGE "Norwegian"
  !insertmacro MUI_LANGUAGE "Finnish"
  !insertmacro MUI_LANGUAGE "Greek"
  !insertmacro MUI_LANGUAGE "Russian"
  !insertmacro MUI_LANGUAGE "Portuguese"
  !insertmacro MUI_LANGUAGE "PortugueseBR"
  !insertmacro MUI_LANGUAGE "Polish"
  !insertmacro MUI_LANGUAGE "Ukrainian"
  !insertmacro MUI_LANGUAGE "Czech"
  !insertmacro MUI_LANGUAGE "Slovak"
  !insertmacro MUI_LANGUAGE "Croatian"
  !insertmacro MUI_LANGUAGE "Bulgarian"
  !insertmacro MUI_LANGUAGE "Hungarian"
  !insertmacro MUI_LANGUAGE "Thai"
  !insertmacro MUI_LANGUAGE "Romanian"
  !insertmacro MUI_LANGUAGE "Latvian"
  !insertmacro MUI_LANGUAGE "Macedonian"
  !insertmacro MUI_LANGUAGE "Estonian"
  !insertmacro MUI_LANGUAGE "Turkish"
  !insertmacro MUI_LANGUAGE "Lithuanian"
  !insertmacro MUI_LANGUAGE "Catalan"
  !insertmacro MUI_LANGUAGE "Slovenian"
  !insertmacro MUI_LANGUAGE "Serbian"
  !insertmacro MUI_LANGUAGE "SerbianLatin"
  !insertmacro MUI_LANGUAGE "Arabic"
  !insertmacro MUI_LANGUAGE "Farsi"
  !insertmacro MUI_LANGUAGE "Hebrew"
  !insertmacro MUI_LANGUAGE "Indonesian"
  !insertmacro MUI_LANGUAGE "Mongolian"
  !insertmacro MUI_LANGUAGE "Luxembourgish"
  !insertmacro MUI_LANGUAGE "Albanian"
  !insertmacro MUI_LANGUAGE "Breton"
  !insertmacro MUI_LANGUAGE "Belarusian"
  !insertmacro MUI_LANGUAGE "Icelandic"
  !insertmacro MUI_LANGUAGE "Malay"
  !insertmacro MUI_LANGUAGE "Bosnian"
  !insertmacro MUI_LANGUAGE "Kurdish"

;--------------------------------
;License Language String

  LicenseLangString MUILicense ${LANG_ENGLISH} "${NSISDIR}\Docs\Modern UI\License.txt"
  LicenseLangString MUILicense ${LANG_FRENCH} "${NSISDIR}\Docs\Modern UI\License.txt"
  LicenseLangString MUILicense ${LANG_GERMAN} "${NSISDIR}\Docs\Modern UI\License.txt"
  LicenseLangString MUILicense ${LANG_SPANISH} "${NSISDIR}\Docs\Modern UI\License.txt"
  LicenseLangString MUILicense ${LANG_SIMPCHINESE} "${NSISDIR}\Docs\Modern UI\License.txt"
  LicenseLangString MUILicense ${LANG_TRADCHINESE} "${NSISDIR}\Docs\Modern UI\License.txt"
  LicenseLangString MUILicense ${LANG_JAPANESE} "${NSISDIR}\Docs\Modern UI\License.txt"
  LicenseLangString MUILicense ${LANG_KOREAN} "${NSISDIR}\Docs\Modern UI\License.txt"
  LicenseLangString MUILicense ${LANG_ITALIAN} "${NSISDIR}\Docs\Modern UI\License.txt"
  LicenseLangString MUILicense ${LANG_DUTCH} "${NSISDIR}\Docs\Modern UI\License.txt"
  LicenseLangString MUILicense ${LANG_DANISH} "${NSISDIR}\Docs\Modern UI\License.txt"
  LicenseLangString MUILicense ${LANG_SWEDISH} "${NSISDIR}\Docs\Modern UI\License.txt"
  LicenseLangString MUILicense ${LANG_NORWEGIAN} "${NSISDIR}\Docs\Modern UI\License.txt"
  LicenseLangString MUILicense ${LANG_FINNISH} "${NSISDIR}\Docs\Modern UI\License.txt"
  LicenseLangString MUILicense ${LANG_GREEK} "${NSISDIR}\Docs\Modern UI\License.txt"
  LicenseLangString MUILicense ${LANG_RUSSIAN} "${NSISDIR}\Docs\Modern UI\License.txt"
  LicenseLangString MUILicense ${LANG_PORTUGUESE} "${NSISDIR}\Docs\Modern UI\License.txt"
  LicenseLangString MUILicense ${LANG_PORTUGUESEBR} "${NSISDIR}\Docs\Modern UI\License.txt"
  LicenseLangString MUILicense ${LANG_POLISH} "${NSISDIR}\Docs\Modern UI\License.txt"
  LicenseLangString MUILicense ${LANG_UKRAINIAN} "${NSISDIR}\Docs\Modern UI\License.txt"
  LicenseLangString MUILicense ${LANG_CZECH} "${NSISDIR}\Docs\Modern UI\License.txt"
  LicenseLangString MUILicense ${LANG_SLOVAK} "${NSISDIR}\Docs\Modern UI\License.txt"
  LicenseLangString MUILicense ${LANG_CROATIAN} "${NSISDIR}\Docs\Modern UI\License.txt"
  LicenseLangString MUILicense ${LANG_BULGARIAN} "${NSISDIR}\Docs\Modern UI\License.txt"
  LicenseLangString MUILicense ${LANG_HUNGARIAN} "${NSISDIR}\Docs\Modern UI\License.txt"
  LicenseLangString MUILicense ${LANG_THAI} "${NSISDIR}\Docs\Modern UI\License.txt"
  LicenseLangString MUILicense ${LANG_ROMANIAN} "${NSISDIR}\Docs\Modern UI\License.txt"
  LicenseLangString MUILicense ${LANG_LATVIAN} "${NSISDIR}\Docs\Modern UI\License.txt"
  LicenseLangString MUILicense ${LANG_MACEDONIAN} "${NSISDIR}\Docs\Modern UI\License.txt"
  LicenseLangString MUILicense ${LANG_ESTONIAN} "${NSISDIR}\Docs\Modern UI\License.txt"
  LicenseLangString MUILicense ${LANG_TURKISH} "${NSISDIR}\Docs\Modern UI\License.txt"
  LicenseLangString MUILicense ${LANG_LITHUANIAN} "${NSISDIR}\Docs\Modern UI\License.txt"
  LicenseLangString MUILicense ${LANG_CATALAN} "${NSISDIR}\Docs\Modern UI\License.txt"
  LicenseLangString MUILicense ${LANG_SLOVENIAN} "${NSISDIR}\Docs\Modern UI\License.txt"
  LicenseLangString MUILicense ${LANG_SERBIAN} "${NSISDIR}\Docs\Modern UI\License.txt"
  LicenseLangString MUILicense ${LANG_SERBIANLATIN} "${NSISDIR}\Docs\Modern UI\License.txt"
  LicenseLangString MUILicense ${LANG_ARABIC} "${NSISDIR}\Docs\Modern UI\License.txt"
  LicenseLangString MUILicense ${LANG_FARSI} "${NSISDIR}\Docs\Modern UI\License.txt"
  LicenseLangString MUILicense ${LANG_HEBREW} "${NSISDIR}\Docs\Modern UI\License.txt"
  LicenseLangString MUILicense ${LANG_INDONESIAN} "${NSISDIR}\Docs\Modern UI\License.txt"
  LicenseLangString MUILicense ${LANG_MONGOLIAN} "${NSISDIR}\Docs\Modern UI\License.txt"
  LicenseLangString MUILicense ${LANG_LUXEMBOURGISH} "${NSISDIR}\Docs\Modern UI\License.txt"
  LicenseLangString MUILicense ${LANG_ALBANIAN} "${NSISDIR}\Docs\Modern UI\License.txt"
  LicenseLangString MUILicense ${LANG_BRETON} "${NSISDIR}\Docs\Modern UI\License.txt"
  LicenseLangString MUILicense ${LANG_BELARUSIAN} "${NSISDIR}\Docs\Modern UI\License.txt"
  LicenseLangString MUILicense ${LANG_ICELANDIC} "${NSISDIR}\Docs\Modern UI\License.txt"
  LicenseLangString MUILicense ${LANG_MALAY} "${NSISDIR}\Docs\Modern UI\License.txt"
  LicenseLangString MUILicense ${LANG_BOSNIAN} "${NSISDIR}\Docs\Modern UI\License.txt"
  LicenseLangString MUILicense ${LANG_KURDISH} "${NSISDIR}\Docs\Modern UI\License.txt"

;--------------------------------
;Reserve Files
  
  ;These files should be inserted before other files in the data block
  ;Keep these lines before any File command
  ;Only for solid compression (by default, solid compression is enabled for BZIP2 and LZMA)
  
  !insertmacro MUI_RESERVEFILE_LANGDLL

;--------------------------------
;Installer Sections

Section "Dummy Section" SecDummy

  SetOutPath "$INSTDIR"
  
  ;ADD YOUR OWN FILES HERE...
  
  ;Store installation folder
  WriteRegStr HKCU "Software\Modern UI Test" "" $INSTDIR
  
  ;Create uninstaller
  WriteUninstaller "$INSTDIR\Uninstall.exe"

SectionEnd

;--------------------------------
;Installer Functions

Function .onInit

  !insertmacro MUI_LANGDLL_DISPLAY

FunctionEnd

;--------------------------------
;Descriptions

  ;USE A LANGUAGE STRING IF YOU WANT YOUR DESCRIPTIONS TO BE LANGAUGE SPECIFIC

  ;Assign descriptions to sections
  !insertmacro MUI_FUNCTION_DESCRIPTION_BEGIN
    !insertmacro MUI_DESCRIPTION_TEXT ${SecDummy} "A test section."
  !insertmacro MUI_FUNCTION_DESCRIPTION_END

 
;--------------------------------
;Uninstaller Section

Section "Uninstall"

  ;ADD YOUR OWN FILES HERE...

  Delete "$INSTDIR\Uninstall.exe"

  RMDir "$INSTDIR"

  DeleteRegKey /ifempty HKCU "Software\Modern UI Test"

SectionEnd

;--------------------------------
;Uninstaller Functions

Function un.onInit

  !insertmacro MUI_UNGETLANGUAGE
  
FunctionEnd