diff pidgin/win32/nsis/pidgin-installer.nsi @ 29624:6d6921daf2da

Add the ability to choose which translations are installed.
author Daniel Atallah <daniel.atallah@gmail.com>
date Sun, 08 Nov 2009 03:53:07 +0000
parents e7b9cf2f2386
children 4f325adb8ced
line wrap: on
line diff
--- a/pidgin/win32/nsis/pidgin-installer.nsi	Mon Nov 02 03:18:15 2009 +0000
+++ b/pidgin/win32/nsis/pidgin-installer.nsi	Sun Nov 08 03:53:07 2009 +0000
@@ -35,6 +35,7 @@
 !include "Sections.nsh"
 !include "WinVer.nsh"
 !include "LogicLib.nsh"
+!include "Memento.nsh"
 
 !include "FileFunc.nsh"
 !insertmacro GetParameters
@@ -73,6 +74,9 @@
 !define ASPELL_REG_KEY				"SOFTWARE\Aspell"
 !define DOWNLOADER_URL				"http://pidgin.im/win32/download_redir.php"
 
+!define MEMENTO_REGISTRY_ROOT			HKLM
+!define MEMENTO_REGISTRY_KEY			"${PIDGIN_UNINSTALL_KEY}"
+
 ;--------------------------------
 ;Version resource
 VIProductVersion "${PIDGIN_PRODUCT_VERSION}"
@@ -408,7 +412,7 @@
     Delete "$INSTDIR\plugins\liboscar.dll"
     Delete "$INSTDIR\plugins\libjabber.dll"
 
-    File /r ..\..\..\${PIDGIN_INSTALL_DIR}\*.*
+    File /r /x locale ..\..\..\${PIDGIN_INSTALL_DIR}\*.*
     File "${PIDGIN_INSTALLER_DEPS}\exchndl.dll"
 
     ; Check if Perl is installed, if so add it to the AppPaths
@@ -494,6 +498,22 @@
 SectionGroupEnd
 
 ;--------------------------------
+;Translations
+
+!macro LANG_SECTION lang
+  ${MementoUnselectedSection} "${lang}" SecLang_${lang}
+    SetOutPath "$INSTDIR\locale\${lang}\LC_MESSAGES"
+    File /oname=pidgin.mo "..\..\..\${PIDGIN_INSTALL_DIR}\locale\${lang}\LC_MESSAGES\pidgin.mo"
+    SetOutPath "$INSTDIR"
+  ${MementoSectionEnd}
+!macroend
+SectionGroup $(TRANSLATIONS_SECTION_TITLE) SecTranslations
+  # pidgin-translations is generated based on the contents of the locale directory
+  !include "pidgin-translations.nsh"
+SectionGroupEnd
+${MementoSectionDone}
+
+;--------------------------------
 ;Spell Checking
 
 SectionGroup /e $(PIDGIN_SPELLCHECK_SECTION_TITLE) SecSpellCheck
@@ -1199,6 +1219,8 @@
   DeleteRegValue HKCU "${OLD_GAIM_REG_KEY}" "Installer Language"
   WriteRegStr HKCU "${PIDGIN_REG_KEY}" "Installer Language" "$R0"
 
+  ${MementoSectionRestore}
+
   !insertmacro SetSectionFlag ${SecSpellCheck} ${SF_RO}
   !insertmacro UnselectSection ${SecSpellCheck}
 
@@ -1310,6 +1332,13 @@
   Pop $R0
 FunctionEnd
 
+Function .onInstSuccess
+
+  ${MementoSectionSave}
+
+FunctionEnd
+
+
 Function un.onInit
 
   Call un.RunCheck