Changeset 6054 in osm for applications/editors


Ignore:
Timestamp:
2007-12-13T03:21:16+01:00 (17 years ago)
Author:
ulf
Message:

add multi language support to the installer

Location:
applications/editors/josm/nsis
Files:
4 added
1 edited

Legend:

Unmodified
Added
Removed
  • applications/editors/josm/nsis/josm.nsi

    r5861 r6054  
    22; josm.nsi
    33;
    4 
    54
    65; Set the compression mechanism first.
     
    1615!define DEST "josm"
    1716
    18 InstType "JOSM (full install)"
    19 
    20 InstType "un.Default (keep Personal Settings and plugins)"
    21 InstType "un.All (remove all)"
    22 
    2317; Used to refresh the display of file association
    2418!define SHCNE_ASSOCCHANGED 0x08000000
     
    3832; The file to write
    3933OutFile "${DEST}-setup-${VERSION}.exe"
    40 
    41 ; Uninstall stuff (NSIS 2.08: "\r\n" don't work here)
    42 !define MUI_UNCONFIRMPAGE_TEXT_TOP "The following JAVA OpenStreetMap editor (JOSM) installation will be uninstalled. Click 'Next' to continue."
    4334
    4435XPStyle on
     
    6152!define MUI_UNFINISHPAGE_NOAUTOCLOSE
    6253!define MUI_WELCOMEFINISHPAGE_BITMAP "josm-nsis-brand.bmp"
    63 !define MUI_WELCOMEPAGE_TEXT "This wizard will guide you through the installation of the JAVA OpenStreetMap editor (JOSM).\r\n\r\nBefore starting the installation, make sure any JOSM applications are not running.\r\n\r\nClick 'Next' to continue."
     54!define MUI_WELCOMEPAGE_TEXT $(JOSM_WELCOME_TEXT)
    6455;!define MUI_FINISHPAGE_LINK "Install WinPcap to be able to capture packets from a network!"
    6556;!define MUI_FINISHPAGE_LINK_LOCATION "http://www.winpcap.org"
     
    10192; ============================================================================
    10293
    103 !insertmacro MUI_LANGUAGE "English"
     94  ;Remember the installer language
     95  !define MUI_LANGDLL_REGISTRY_ROOT "HKLM"
     96  !define MUI_LANGDLL_REGISTRY_KEY "Software\Microsoft\Windows\CurrentVersion\Uninstall\OSM"
     97  !define MUI_LANGDLL_REGISTRY_VALUENAME "Installer Language"
     98 
     99  ;; English goes first because its the default. The rest are
     100  ;; in alphabetical order (at least the strings actually displayed
     101  ;; will be).
     102
     103  !insertmacro MUI_LANGUAGE "English"
     104  !insertmacro MUI_LANGUAGE "German"
     105
     106;--------------------------------
     107;Translations
     108
     109  !define JOSM_DEFAULT_LANGFILE "locale\english.nsh"
     110
     111  !include "langmacros.nsh"
     112 
     113  !insertmacro JOSM_MACRO_INCLUDE_LANGFILE "ENGLISH" "locale\english.nsh"
     114  !insertmacro JOSM_MACRO_INCLUDE_LANGFILE "GERMAN" "locale\german.nsh"
     115
     116; Uninstall stuff (NSIS 2.08: "\r\n" don't work here)
     117!define MUI_UNCONFIRMPAGE_TEXT_TOP ${un.JOSM_UNCONFIRMPAGE_TEXT_TOP}
     118
     119; ============================================================================
     120; Installation types
     121; ============================================================================
     122
     123InstType "$(JOSM_FULL_INSTALL)"
     124
     125InstType "un.$(un.JOSM_DEFAULT_UNINSTALL)"
     126InstType "un.$(un.JOSM_FULL_UNINSTALL)"
    104127
    105128; ============================================================================
     
    155178; ============================================================================
    156179; The text to prompt the user to enter a directory
    157 DirText "Choose a directory in which to install OpenStreeMap."
     180DirText $(JOSM_DIR_TEXT)
    158181
    159182; The default installation directory
     
    192215
    193216UpdateIcons.error1_${UPDATEICONS_UNIQUE}:
    194         MessageBox MB_OK|MB_ICONSTOP  "Can't find 'shell32.dll' library. Impossible to update icons"
     217        MessageBox MB_OK|MB_ICONSTOP $(JOSM_UPDATEICONS_ERROR1)
    195218        Goto UpdateIcons.quit_${UPDATEICONS_UNIQUE}
    196219UpdateIcons.error2_${UPDATEICONS_UNIQUE}:
    197         MessageBox MB_OK|MB_ICONINFORMATION "You should install the free 'Microsoft Layer for Unicode' to update JOSM file icons"
     220        MessageBox MB_OK|MB_ICONINFORMATION $(JOSM_UPDATEICONS_ERROR2)
    198221        Goto UpdateIcons.quit_${UPDATEICONS_UNIQUE}
    199222UpdateIcons.quit_${UPDATEICONS_UNIQUE}:
     
    238261  ;Extract InstallOptions INI files
    239262;  !insertmacro MUI_INSTALLOPTIONS_EXTRACT "AdditionalTasksPage.ini"
     263  !insertmacro MUI_LANGDLL_DISPLAY
     264FunctionEnd
     265
     266Function un.onInit
     267
     268  !insertmacro MUI_UNGETLANGUAGE
     269 
    240270FunctionEnd
    241271
     
    279309
    280310
    281 Section "JOSM" SecJosm
     311Section $(JOSM_SEC_JOSM) SecJosm
    282312;-------------------------------------------
    283313SectionIn 1
     
    306336
    307337${WriteINIStrNS} $R0 "$APPDATA\JOSM\preferences" "validator.visible" "true"
    308 SectionEnd
    309 
    310 
    311 SectionGroup "Plugins" SecPluginsGroup
    312 
    313 Section "mappaint" SecMappaintPlugin
     338
     339SectionEnd
     340
     341
     342SectionGroup $(JOSM_SEC_PLUGINS_GROUP) SecPluginsGroup
     343
     344Section $(JOSM_SEC_MAPPAINT_PLUGIN) SecMappaintPlugin
    314345;-------------------------------------------
    315346SectionIn 1 2
     
    332363;SectionEnd
    333364
    334 Section "WMS" SecWMSPlugin
     365Section $(JOSM_SEC_WMS_PLUGIN) SecWMSPlugin
    335366;-------------------------------------------
    336367SectionIn 1 2
     
    340371SectionEnd
    341372
    342 Section "namefinder" SecNamefinderPlugin
     373Section $(JOSM_SEC_NAMEFINDER_PLUGIN) SecNamefinderPlugin
    343374;-------------------------------------------
    344375SectionIn 1 2
     
    348379SectionEnd
    349380
    350 Section "validator" SecValidatorPlugin
     381Section $(JOSM_SEC_VALIDATOR_PLUGIN) SecValidatorPlugin
    351382;-------------------------------------------
    352383SectionIn 1 2
     
    358389SectionGroupEnd ; "Plugins"
    359390
    360 Section "Start Menu Entry" SecStartMenu
     391Section $(JOSM_SEC_STARTMENU) SecStartMenu
    361392;-------------------------------------------
    362393SectionIn 1 2
     
    366397; To qoute "http://msdn.microsoft.com/library/default.asp?url=/library/en-us/dnwue/html/ch11d.asp":
    367398; "Do not include Readme, Help, or Uninstall entries on the Programs menu."
    368 CreateShortCut "$SMPROGRAMS\JOSM.lnk" "$INSTDIR\josm.exe" "" "$INSTDIR\josm.exe" 0 "" "" "JAVA OpenStreetMap - Editor"
     399CreateShortCut "$SMPROGRAMS\JOSM.lnk" "$INSTDIR\josm.exe" "" "$INSTDIR\josm.exe" 0 "" "" $(JOSM_LINK_TEXT)
    369400;SecRequired_skip_StartMenu:
    370401SectionEnd
    371402
    372 Section "Desktop Icon" SecDesktopIcon
     403Section $(JOSM_SEC_DESKTOP_ICON) SecDesktopIcon
    373404;-------------------------------------------
    374405; SectionIn 1 2
     
    383414;StrCmp $0 "0" SecRequired_skip_DesktopIcon
    384415;SecRequired_install_DesktopIcon:
    385 CreateShortCut "$DESKTOP\JOSM.lnk" "$INSTDIR\josm.exe" "" "$INSTDIR\josm.exe" 0 "" "" "JAVA OpenStreetMap - Editor"
     416CreateShortCut "$DESKTOP\JOSM.lnk" "$INSTDIR\josm.exe" "" "$INSTDIR\josm.exe" 0 "" "" $(JOSM_LINK_TEXT)
    386417;SecRequired_skip_DesktopIcon:
    387418SectionEnd
    388419
    389 Section "Quick Launch Icon" SecQuickLaunchIcon
     420Section $(JOSM_SEC_QUICKLAUNCH_ICON) SecQuickLaunchIcon
    390421;-------------------------------------------
    391422SectionIn 1 2
     
    400431;StrCmp $0 "0" SecRequired_skip_QuickLaunchIcon
    401432;SecRequired_install_QuickLaunchIcon:
    402 CreateShortCut "$QUICKLAUNCH\JOSM.lnk" "$INSTDIR\josm.exe" "" "$INSTDIR\josm.exe" 0 "" "" "JAVA OpenStreetMap - Editor"
     433CreateShortCut "$QUICKLAUNCH\JOSM.lnk" "$INSTDIR\josm.exe" "" "$INSTDIR\josm.exe" 0 "" "" $(JOSM_LINK_TEXT)
    403434;SecRequired_skip_QuickLaunchIcon:
    404435SectionEnd
    405436
    406 Section "File Extensions" SecFileExtensions
     437Section $(JOSM_SEC_FILE_EXTENSIONS) SecFileExtensions
    407438;-------------------------------------------
    408439SectionIn 1 2
     
    431462; XXX - should better be handled inside JOSM (recent plugin manager is going in the right direction)
    432463SetShellVarContext current
     464!include LogicLib.nsh
     465${Switch} $LANGUAGE
     466${Case} ${LANG_GERMAN}
     467File "..\plugins\dist\lang-de.jar"
     468${WriteINIStrNS} $R0 "$APPDATA\JOSM\preferences" "plugins" "mappaint,wmsplugin,namefinder,validator,lang-de"
     469${Break}
     470${Default}
    433471${WriteINIStrNS} $R0 "$APPDATA\JOSM\preferences" "plugins" "mappaint,wmsplugin,namefinder,validator"
    434 SectionEnd
    435 
    436 
    437 Section "Uninstall" un.SecUinstall
     472${Break}
     473${EndSwitch}
     474SectionEnd
     475
     476
     477Section "un.$(un.JOSM_SEC_UNINSTALL)" un.SecUinstall
    438478;-------------------------------------------
    439479
     
    445485
    446486Delete "$INSTDIR\josm.exe"
     487IfErrors 0 NoJOSMErrorMsg
     488        MessageBox MB_OK $(un.JOSM_IN_USE_ERROR) IDOK 0 ;skipped if josm.exe removed
     489        Abort $(un.JOSM_IN_USE_ERROR)
     490NoJOSMErrorMsg:
    447491Delete "$INSTDIR\uninstall.exe"
    448492Delete "$APPDATA\JOSM\plugins\wmsplugin.jar"
     
    453497RMDir "$APPDATA\JOSM\plugins"
    454498RMDir "$APPDATA\JOSM"
    455 IfErrors 0 NoJOSMErrorMsg
    456         MessageBox MB_OK "Please note: josm.exe could not be removed, it's probably in use!" IDOK 0 ;skipped if josm.exe removed
    457         Abort "Please note: josm.exe could not be removed, it's probably in use! Abort uninstall process!"
    458 NoJOSMErrorMsg:
    459499
    460500DeleteRegKey HKEY_LOCAL_MACHINE "Software\Microsoft\Windows\CurrentVersion\Uninstall\OSM"
    461501DeleteRegKey HKEY_LOCAL_MACHINE "Software\josm.exe"
    462502DeleteRegKey HKEY_LOCAL_MACHINE "Software\Microsoft\Windows\CurrentVersion\App Paths\josm.exe"
     503
     504; Remove Language preference info
     505DeleteRegKey HKCU "Software/JOSM" ;${MUI_LANGDLL_REGISTRY_ROOT} ${MUI_LANGDLL_REGISTRY_KEY}
    463506
    464507push $R0
     
    482525SectionEnd ; "Uinstall"
    483526
    484 Section /o "Un.Personal Settings" un.SecPersonalSettings
     527Section /o "un.$(un.JOSM_SEC_PERSONAL_SETTINGS)" un.SecPersonalSettings
    485528;-------------------------------------------
    486529SectionIn 2
     
    493536SectionEnd
    494537
    495 Section /o "Un.Personal Plugins" un.SecPlugins
     538Section /o "un.$(un.JOSM_SEC_PLUGINS)"un.SecPlugins
    496539;-------------------------------------------
    497540SectionIn 2
     
    516559; this test must be done after all other things uninstalled (e.g. Global Settings)
    517560IfFileExists "$INSTDIR" 0 NoFinalErrorMsg
    518     MessageBox MB_OK "Please note: The directory $INSTDIR could not be removed!" IDOK 0 ; skipped if dir doesn't exist
     561    MessageBox MB_OK $(un.JOSM_INSTDIR_ERROR) IDOK 0 ; skipped if dir doesn't exist
    519562NoFinalErrorMsg:
    520563SectionEnd
     
    525568; ============================================================================
    526569!insertmacro MUI_FUNCTION_DESCRIPTION_BEGIN
    527   !insertmacro MUI_DESCRIPTION_TEXT ${SecJosm} "JOSM is the JAVA OpenStreetMap editor for .osm files."
    528   !insertmacro MUI_DESCRIPTION_TEXT ${SecPluginsGroup} "An assortment of useful JOSM plugins."
    529   !insertmacro MUI_DESCRIPTION_TEXT ${SecMappaintPlugin} "An alternative renderer for the map with colouring, line thickness, icons after tags."
    530 ;  !insertmacro MUI_DESCRIPTION_TEXT ${SecOsmarenderPlugin} "Displays the current screen as nicely rendered SVG graphics in FireFox."
    531   !insertmacro MUI_DESCRIPTION_TEXT ${SecWMSPlugin} "Display background images from Web Map Service (WMS) sources."
    532   !insertmacro MUI_DESCRIPTION_TEXT ${SecNamefinderPlugin} "Add a 'Find places by their name' tab to the download dialog."
    533   !insertmacro MUI_DESCRIPTION_TEXT ${SecValidatorPlugin} "Validates edited data if it conforms to common suggestions."
    534   !insertmacro MUI_DESCRIPTION_TEXT ${SecStartMenu} "Add a JOSM start menu entry."
    535   !insertmacro MUI_DESCRIPTION_TEXT ${SecDesktopIcon} "Add a JOSM desktop icon."
    536   !insertmacro MUI_DESCRIPTION_TEXT ${SecQuickLaunchIcon} "Add a JOSM icon to the quick launch bar."
    537   !insertmacro MUI_DESCRIPTION_TEXT ${SecFileExtensions} "Add JOSM file extensions for .osm and .gpx files."
     570  !insertmacro MUI_DESCRIPTION_TEXT ${SecJosm} $(JOSM_SECDESC_JOSM)
     571  !insertmacro MUI_DESCRIPTION_TEXT ${SecPluginsGroup} $(JOSM_SECDESC_PLUGINS_GROUP)
     572  !insertmacro MUI_DESCRIPTION_TEXT ${SecMappaintPlugin} $(JOSM_SECDESC_MAPPAINT_PLUGIN)
     573  !insertmacro MUI_DESCRIPTION_TEXT ${SecWMSPlugin} $(JOSM_SECDESC_WMS_PLUGIN)
     574  !insertmacro MUI_DESCRIPTION_TEXT ${SecNamefinderPlugin} $(JOSM_SECDESC_NAMEFINDER_PLUGIN)
     575  !insertmacro MUI_DESCRIPTION_TEXT ${SecValidatorPlugin} $(JOSM_SECDESC_VALIDATOR_PLUGIN)
     576  !insertmacro MUI_DESCRIPTION_TEXT ${SecStartMenu} $(JOSM_SECDESC_STARTMENU)
     577  !insertmacro MUI_DESCRIPTION_TEXT ${SecDesktopIcon} $(JOSM_SECDESC_DESKTOP_ICON)
     578  !insertmacro MUI_DESCRIPTION_TEXT ${SecQuickLaunchIcon} $(JOSM_SECDESC_QUICKLAUNCH_ICON)
     579  !insertmacro MUI_DESCRIPTION_TEXT ${SecFileExtensions} $(JOSM_SECDESC_FILE_EXTENSIONS)
    538580 
    539581
     
    541583
    542584!insertmacro MUI_UNFUNCTION_DESCRIPTION_BEGIN
    543   !insertmacro MUI_DESCRIPTION_TEXT ${un.SecUinstall} "Uninstall JOSM."
    544   !insertmacro MUI_DESCRIPTION_TEXT ${un.SecPersonalSettings} "Uninstall personal settings like your preferences and bookmarks from your profile: $PROFILE."
    545   !insertmacro MUI_DESCRIPTION_TEXT ${un.SecPlugins} "Uninstall all plugins."
     585  !insertmacro MUI_DESCRIPTION_TEXT ${un.SecUinstall} $(un.JOSM_SECDESC_UNINSTALL)
     586  !insertmacro MUI_DESCRIPTION_TEXT ${un.SecPersonalSettings} $(un.JOSM_SECDESC_PERSONAL_SETTINGS)
     587  !insertmacro MUI_DESCRIPTION_TEXT ${un.SecPlugins} $(un.JOSM_SECDESC_PLUGINS)
    546588!insertmacro MUI_UNFUNCTION_DESCRIPTION_END
    547589
Note: See TracChangeset for help on using the changeset viewer.