Author: Zero3 Date: 2009-04-08 14:51:17 +0000 (Wed, 08 Apr 2009) New Revision: 26653
Added: trunk/apps/wininstaller/src_freenetinstaller/FreenetInstaller_Include_Lang_da.inc Modified: trunk/apps/wininstaller/src_freenetinstaller/FreenetInstaller.ahk trunk/apps/wininstaller/src_freenetinstaller/FreenetInstaller_Include_Helpers.inc Log: Added localization support, Danish translation, bumped to beta, misc fixes Modified: trunk/apps/wininstaller/src_freenetinstaller/FreenetInstaller.ahk =================================================================== --- trunk/apps/wininstaller/src_freenetinstaller/FreenetInstaller.ahk 2009-04-08 14:44:43 UTC (rev 26652) +++ trunk/apps/wininstaller/src_freenetinstaller/FreenetInstaller.ahk 2009-04-08 14:51:17 UTC (rev 26653) @@ -1,15 +1,19 @@ ; ; Windows Freenet Installer by Zero3 (zero3 that-a-thingy zero3 that-dot-thingy dk) - http://freenetproject.org/ +; +; Extra credits: +; - Charset conversion functions: Sean (http://www.autohotkey.com/forum/topic17343.html) + ; - -; ; Don't-touch-unless-you-know-what-you-are-doing settings ; #NoEnv ; Recommended for performance and compatibility with future AutoHotkey releases #NoTrayIcon ; We won't need this... -#SingleInstance ignore ; Only allow one instance of at any given time (theoretically, if we allowed multiple, we could run into some temp files problems) -#Include FreenetInstaller_Include_Info.inc ; Include version and build info (which should be updated by the compiler bot before compiling this installer) +#SingleInstance ignore ; Only allow one instance of at any given time (theoretically, if we allowed multiple, we could run into some temp files problems) +#Include FreenetInstaller_Include_Info.inc ; Include version and build info (which should be updated by the compiler bot before compiling this installer) as well as localizations +#Include FreenetInstaller_Include_Lang_da.inc ; Include Danish (da) translation + SendMode, Input ; Recommended for new scripts due to its superior speed and reliability SetFormat, FLOAT, 0.0 ; Remove trailing zeroes on floats. We won't need the precision and it looks stupid with numbers printed with 27 trailing zeroes StringCaseSense, Off ; Treat A-Z as equal to a-z when comparing strings. Useful when dealing with folders, as Windows treat them as equals. @@ -21,7 +25,8 @@ ; _GuiWidth := 450+10+10 ; Main GUI width. Should be the same size as the header image + default element margins (used for the GUI window itself) _StandardMargin := 12 ; Our standard margin. Must be at least 8 px. -_ButtonWidth := 100 ; Width of our buttons +_ButtonWidth := 100 ; Width of our buttons +_LanguageListWidth := 100 ; Width of language drop-down list _RequiredJRE := 1.5 ; Java version required by Freenet. If not found, user will be asked to upgrade/install via the bundled online installer _UsedFreeSpace := _Inc_InstallSize+256 ; What we actually need. Installation size + default datastore size @@ -29,18 +34,29 @@ _InternalPathLength := 75 ; Length of longest path within the Freenet installation. Installation will refuse to continue if install path + this number exceeds 255 (FAT32 and NTFS limit) _DefaultInstallDir = %A_ProgramFiles%\Freenet ; Default installation directory -_DefaultInstallStartMenuShortcuts := 1 ; Install start menu shortcut(s) by default? -_DefaultInstallDesktopShortcuts := 1 ; Install desktop shorctu(s) by default? -_DefaultBrowseAfterInstall := 1 ; Browse Freenet after installation by default? +_cInstallStartMenuShortcuts := 1 ; Install start menu shortcut(s) by default? +_cInstallDesktopShortcuts := 1 ; Install desktop shorctu(s) by default? +_cBrowseAfterInstall := 1 ; Browse Freenet after installation by default? +; +; Setup localization +; +_LangArray := 1 ; Set initial position for languages array + +; AddLanguage() arguments: <localized language name> <language load function name from language file> <windows language code (see http://www.autohotkey.com/docs/misc/Languages.htm)> +AddLanguage("English","","") ; Load English (en) translation (dummy) +AddLanguage("Dansk","LoadLanguage_da","0406") ; Load Danish (da) translation + +LoadLanguage(LanguageCodeToID(A_Language)) ; Load language matching OS language (will fall back to English if no match) + ; ; General init stuff -; +; FileRemoveDir, %A_Temp%\FreenetInstaller, 1 ; Remove any old temp dir FileCreateDir, %A_Temp%\FreenetInstaller ; Create a new temp dir If (ErrorLevel) { - MsgBox, 16, Freenet Installer fatal error, Freenet Installer was not able to unpack necessary installation files to:`n`n%A_Temp%\FreenetInstaller`n`nPlease make sure that Freenet Installer has full access to the system's temporary files folder. ; 16 = Icon Hand (stop/error) + MsgBox, 16, % Trans("Freenet Installer fatal error"), % Trans("Freenet Installer was not able to unpack necessary installation files to:") "`n`n" A_Temp "\FreenetInstaller`n`n" Trans("Please make sure that Freenet Installer has full access to the system's temporary files folder.") ; 16 = Icon Hand (stop/error) ExitApp } SetWorkingDir, %A_Temp%\FreenetInstaller ; Switch to our new temp dir as working dir. *NO* FileInstall lines before this! @@ -48,7 +64,7 @@ FileInstall, FreenetInstaller_Icon.ico, %A_WorkingDir%\FreenetInstaller_Icon.ico ; Unpack our small icon Menu, Tray, Icon, FreenetInstaller_Icon.ico ; Set tray and GUI icon to our icon. Must be done before any Gui command to work -Gui, Font, s%_FontSize%, MS sans serif ; As default font may vary (and thereby mess up custom positioning and layout), we should force a specific +Gui, Font, s%_FontSize%, MS sans serif ; As default font may vary (and thereby mess up custom positioning and layout), we should force a specific _StandardMargin2 := _StandardMargin-8 Gui, Margin, , %_StandardMargin2% ; 0=8px (which is minimum?). (A margin of 2px seems to be used outside groupboxes. Need to figure out why that is.) @@ -67,10 +83,10 @@ ; If not (A_IsAdmin) { - MsgBox, 16, Freenet Installer fatal error, Freenet Installer requires administrator privileges to install Freenet.`nPlease make sure that your user account has administrative access to the system,`nand Freenet Installer is executed with access to use these privileges. ; 16 = Icon Hand (stop/error) + MsgBox, 16, % Trans("Freenet Installer fatal error"), % Trans("Freenet Installer requires administrator privileges to install Freenet.`nPlease make sure that your user account has administrative access to the system,`nand Freenet Installer is executed with access to use these privileges.") ; 16 = Icon Hand (stop/error) Exit() -} - +} + ; ; Main GUI starts here! ; @@ -80,14 +96,27 @@ ; Image: Header logo ; FileInstall, FreenetInstaller_Header.png, %A_WorkingDir%\FreenetInstaller_Header.png -Gui, Add, Picture, Section, FreenetInstaller_Header.png - +Gui, Add, Picture, Section, FreenetInstaller_Header.png + ; ; Welcome text ; -Gui, Font, bold -Gui, Add, Text, xs W%_GuiWidth2% Center Section, `nWelcome to the Freenet Installer!`n -Gui, Font, norm +Gui, Font, bold +Gui, Add, Text, xs W%_GuiWidth2% Center Section, % "`n" Trans("Welcome to the Freenet Installer!") "`n" +Gui, Font, norm + +; +; Drop-down list: Language selector +; +_LanguageList = + +Loop % _LangArray-1 +{ + _LanguageList := _LanguageList UTF82Ansi(_LanguageNames%A_Index%) "|" +} +_Listx := _GuiWidth2-_LanguageListWidth +_Listy := ((_TextHeight*3)/2)-(21/2) +Gui, Add, DropDownList, xp+%_Listx% yp+%_Listy% W%_LanguageListWidth% Choose%_LangNum% v_cLanguageSelector g_ListSelectLanguage AltSubmit , %_LanguageList% ; ; Check for unsupported Windows version @@ -97,18 +126,18 @@ ; ; Groupbox: Installation problem (OS requirement not met) ; - _GBHeight := CalculateGroupBoxHeight(8,0,0,0) ; (_GBTextLines, _GBButtonLines, _GBCheckBoxLines, _GBSpacings) (Number of text lines, number of button lines, number of checkbox lines, number of spacings) - Gui, Add, GroupBox, xs w%_GuiWidth2% h%_GBHeight% Section, Installation problem + _GBHeight := CalculateGroupBoxHeight(8,0,0,0) + Gui, Add, GroupBox, xs w%_GuiWidth2% h%_GBHeight% Section, % Trans("Installation problem") - Gui, Add, Text, W%_GuiWidth3% xs+%_GBHorMargin% ys+%_GBTopMargin%, Freenet only supports the following versions of the Windows operating system:`n`n- Windows 2000`n- Windows XP`n- Windows Server 2003`n- Windows Vista`n`nPlease install one of these versions if you want to use Freenet on Windows. + Gui, Add, Text, W%_GuiWidth3% xs+%_GBHorMargin% ys+%_GBTopMargin%, % Trans("Freenet only supports the following versions of the Windows operating system:") "`n`n- Windows 2000`n- Windows XP`n- Windows Server 2003`n- Windows Vista`n`n" Trans("Please install one of these versions if you want to use Freenet on Windows.") ; ; Exit button ; _Buttonx := (_GuiWidth2/2)-(_ButtonWidth/2) ; Center our button - Gui, Add, Button, Default xs%_Buttonx% W%_ButtonWidth%, E&xit ; Label "Exit" is triggered upon activation + Gui, Add, Button, Default xs%_Buttonx% W%_ButtonWidth% gButtonExit, % Trans("E&xit") ; Label "Exit" is triggered upon activation - Gui, Show, W%_GuiWidth%, Freenet Installer + Gui, Show, W%_GuiWidth%, % Trans("Freenet Installer") return } @@ -120,23 +149,23 @@ ; ; Groupbox: Installation problem (Java requirement not met) ; - _GBHeight := CalculateGroupBoxHeight(4,1,0,2) ; (_GBTextLines, _GBButtonLines, _GBCheckBoxLines, _GBSpacings) (Number of text lines, number of button lines, number of checkbox lines, number of spacings) - Gui, Add, GroupBox, xs w%_GuiWidth2% h%_GBHeight% Section, Installation problem + _GBHeight := CalculateGroupBoxHeight(4,1,0,2) + Gui, Add, GroupBox, xs w%_GuiWidth2% h%_GBHeight% Section, % Trans("Installation problem") - Gui, Add, Text, W%_GuiWidth3% xs+%_GBHorMargin% ys+%_GBTopMargin%, Freenet requires the Java Runtime Environment, but your system does not appear to have an up-to-date version installed. You can install Java by using the included online installer, which will download and install the necessary files from the Java website automatically: + Gui, Add, Text, W%_GuiWidth3% xs+%_GBHorMargin% ys+%_GBTopMargin%, % Trans("Freenet requires the Java Runtime Environment, but your system does not appear to have an up-to-date version installed. You can install Java by using the included online installer, which will download and install the necessary files from the Java website automatically:") _Buttonx := (_GuiWidth2/2)-(_ButtonWidth/2) ; Center our button - Gui, Add, Button, xs%_Buttonx% y+%_StandardMargin% W%_ButtonWidth% v_cInstallJavaButton, Install Java + Gui, Add, Button, xs%_Buttonx% y+%_StandardMargin% W%_ButtonWidth% v_cInstallJavaButton gButtonInstallJava, % Trans("&Install Java") - Gui, Add, Text, xs+%_GBHorMargin% y+%_StandardMargin% W%_GuiWidth3%, The installation will continue once Java version %_RequiredJRE% or later has been installed. + Gui, Add, Text, xs+%_GBHorMargin% y+%_StandardMargin% W%_GuiWidth3%, % Trans("The installation will continue once Java version ") _RequiredJRE Trans(" or later has been installed.") ; ; Exit button ; _Buttonx := (_GuiWidth2/2)-(_ButtonWidth/2) ; Center our button - Gui, Add, Button, Default xs%_Buttonx% W%_ButtonWidth%, E&xit + Gui, Add, Button, Default xs%_Buttonx% W%_ButtonWidth% gButtonExit, % Trans("E&xit") - Gui, Show, W%_GuiWidth%, Freenet Installer + Gui, Show, W%_GuiWidth%, % Trans("Freenet Installer") SetTimer, RecheckJavaVersionTimer, 5000 return } @@ -149,23 +178,23 @@ ; ; Groupbox: Installation problem (Old uninstaller detected) ; - _GBHeight := CalculateGroupBoxHeight(4,1,0,2) ; (_GBTextLines, _GBButtonLines, _GBCheckBoxLines, _GBSpacings) (Number of text lines, number of button lines, number of checkbox lines, number of spacings) - Gui, Add, GroupBox, xs w%_GuiWidth2% h%_GBHeight% Section, Installation problem + _GBHeight := CalculateGroupBoxHeight(4,1,0,2) + Gui, Add, GroupBox, xs w%_GuiWidth2% h%_GBHeight% Section, % Trans("Installation problem") - Gui, Add, Text, W%_GuiWidth3% xs+%_GBHorMargin% ys+%_GBTopMargin%, Freenet Installer has detected that you already have Freenet installed. Your current installation was installed using an older, unsupported installer. To continue, you must first uninstall your current version of Freenet using the previously created uninstaller: + Gui, Add, Text, W%_GuiWidth3% xs+%_GBHorMargin% ys+%_GBTopMargin%, % Trans("Freenet Installer has detected that you already have Freenet installed. Your current installation was installed using an older, unsupported installer. To continue, you must first uninstall your current version of Freenet using the previously created uninstaller:") _Buttonx := (_GuiWidth2/2)-(_ButtonWidth/2) ; Center our button - Gui, Add, Button, xs+%_Buttonx% y+%_StandardMargin% W%_ButtonWidth% v_cUninstallButton, &Uninstall + Gui, Add, Button, xs+%_Buttonx% y+%_StandardMargin% W%_ButtonWidth% v_cUninstallButton gButtonUninstall, % Trans("&Uninstall") - Gui, Add, Text, xs+%_GBHorMargin% y+%_StandardMargin% W%_GuiWidth3%, The installation will continue once the old installation has been removed. + Gui, Add, Text, xs+%_GBHorMargin% y+%_StandardMargin% W%_GuiWidth3%, % Trans("The installation will continue once the old installation has been removed.") ; ; Exit button ; _Buttonx := (_GuiWidth2/2)-(_ButtonWidth/2) ; Center our button - Gui, Add, Button, Default xs%_Buttonx% W%_ButtonWidth%, E&xit + Gui, Add, Button, Default xs%_Buttonx% W%_ButtonWidth% gButtonExit, % Trans("E&xit") - Gui, Show, W%_GuiWidth%, Freenet Installer + Gui, Show, W%_GuiWidth%, % Trans("Freenet Installer") SetTimer, RecheckOldUninstallerTimer, 5000 return } @@ -173,67 +202,64 @@ ; ; Text: Install guideline header ; -Gui, Add, Text, xs W%_GuiWidth2% Section, Please check the following default settings before continuing with the installation of Freenet. +Gui, Add, Text, xs W%_GuiWidth2% Section, % Trans("Please check the following default settings before continuing with the installation of Freenet.") ; ; Groupbox: Install directory ; -_GBHeight := CalculateGroupBoxHeight(4,1,0,3) ; (_GBTextLines, _GBButtonLines, _GBCheckBoxLines, _GBSpacings) (Number of text lines, number of button lines, number of checkbox lines, number of spacings) -Gui, Add, GroupBox, xs w%_GuiWidth2% h%_GBHeight% Section, Installation directory +_GBHeight := CalculateGroupBoxHeight(4,1,0,3) +Gui, Add, GroupBox, xs w%_GuiWidth2% h%_GBHeight% Section, % Trans("Installation directory") Gui, Add, Text, xs+%_GBHorMargin% ys+%_GBTopMargin% W%_GuiWidth3% v_cInstallDirText, ... _Buttonx := (_GuiWidth3+_GBHorMargin)-1*(_StandardMargin+_ButtonWidth)-_ButtonWidth _Buttony := _GBTopMargin+_TextHeight+_StandardMargin -Gui, Add, Button, xs+%_Buttonx% ys%_Buttony% W%_ButtonWidth% v_cBrowseButton, &Browse -Gui, Add, Button, x+%_StandardMargin% W%_ButtonWidth% v_cDefaultButton, De&fault +Gui, Add, Button, xs+%_Buttonx% ys%_Buttony% W%_ButtonWidth% v_cBrowseButton gButtonBrowse, % Trans("&Browse") +Gui, Add, Button, x+%_StandardMargin% W%_ButtonWidth% v_cDefaultButton gButtonDefault, % Trans("De&fault") _Texty := 24+_StandardMargin -Gui, Add, Text, xs+%_GBHorMargin% yp+%_Texty% W%_GuiWidth3%, Freenet requires at least %_UsedFreeSpace% MB free disk space, but will not install with less than %_RequiredFreeSpace% MB free. The amount of space reserved can be changed after installation. +Gui, Add, Text, xs+%_GBHorMargin% yp+%_Texty% W%_GuiWidth3%, % Trans("Freenet requires at least ") _UsedFreeSpace Trans(" MB free disk space, but will not install with less than ") _RequiredFreeSpace Trans(" MB free. The amount of space reserved can be changed after installation.") + +_StatusWidth := _GuiWidth3-50 ; We won't have a whole _GuiWidth3 to play around with, as the "Status: " part will use some of it (but we don't know how much because of localization). Allocating too much space will cause a small cosmetic bug (overlapping groupbox border), so make a proper guesstimate +Gui, Add, Text, , % Trans("Status:") +Gui, Add, Text, W%_StatusWidth% x+4 v_cInstallDirStatusText, ... -; Calculate size and placement of status text. Hack-hack, I know -_StatusSize := 40 ; The margin between "Status:" and the actual status text -_StatusTextSize := _GuiWidth3-_StatusSize-_GBHorMargin - -Gui, Add, Text, W%_StatusSize%, Status: -Gui, Add, Text, W%_StatusTextSize% x+0 v_cInstallDirStatusText, ... - ; ; Groupbox: Node service ; -_GBHeight := CalculateGroupBoxHeight(3,0,0,0) ; (_GBTextLines, _GBButtonLines, _GBCheckBoxLines, _GBSpacings) (Number of text lines, number of button lines, number of checkbox lines, number of spacings) -Gui, Add, GroupBox, xs w%_GuiWidth2% h%_GBHeight% Section, System service +_GBHeight := CalculateGroupBoxHeight(3,0,0,0) +Gui, Add, GroupBox, xs w%_GuiWidth2% h%_GBHeight% Section, % Trans("System service") -Gui, Add, Text, xs+%_GBHorMargin% ys+%_GBTopMargin% W%_GuiWidth3%, Freenet will automatically start in the background as a system service. This is required to be a part of the Freenet network, and will use a small amount of system resources. The amount of resources used can be adjusted after installation. +Gui, Add, Text, xs+%_GBHorMargin% ys+%_GBTopMargin% W%_GuiWidth3%, % Trans("Freenet will automatically start in the background as a system service. This is required to be a part of the Freenet network, and will use a small amount of system resources. The amount of resources used can be adjusted after installation.") ; ; Groupbox: Additional settings ; -_GBHeight := CalculateGroupBoxHeight(0,0,3,0) ; (_GBTextLines, _GBButtonLines, _GBCheckBoxLines, _GBSpacings) (Number of text lines, number of button lines, number of checkbox lines, number of spacings) -Gui, Add, GroupBox, xs w%_GuiWidth2% h%_GBHeight% Section, Additional settings +_GBHeight := CalculateGroupBoxHeight(0,0,3,0) +Gui, Add, GroupBox, xs w%_GuiWidth2% h%_GBHeight% Section, % Trans("Additional settings") -Gui, Add, Checkbox, xs+%_GBHorMargin% ys+%_GBTopMargin% W%_GuiWidth3% v_cInstallStartMenuShortcuts Checked%_DefaultInstallStartMenuShortcuts%, Install &start menu shortcuts (All users: Browse Freenet, Start Freenet, Stop Freenet) -Gui, Add, Checkbox, v_cInstallDesktopShortcuts Checked%_DefaultInstallDesktopShortcuts%, Install &desktop shortcut (All users: Browse Freenet) -Gui, Add, Checkbox, v_cBrowseAfterInstall Checked%_DefaultBrowseAfterInstall%, Browse Freenet &after installation +Gui, Add, Checkbox, xs+%_GBHorMargin% ys+%_GBTopMargin% W%_GuiWidth3% v_cInstallStartMenuShortcuts Checked%_cInstallStartMenuShortcuts%, % Trans("Install &start menu shortcuts (All users: Browse Freenet, Start Freenet, Stop Freenet)") +Gui, Add, Checkbox, v_cInstallDesktopShortcuts Checked%_cInstallDesktopShortcuts%, % Trans("Install &desktop shortcut (All users: Browse Freenet)") +Gui, Add, Checkbox, v_cBrowseAfterInstall Checked%_cBrowseAfterInstall%, % Trans("Browse Freenet &after the installation") ; ; Status bar and main buttons ; -Gui, Add, Button, Default xs W%_ButtonWidth% v_cExitButton Section, E&xit +Gui, Add, Button, Default xs W%_ButtonWidth% v_cExitButton Section gButtonExit, % Trans("E&xit") _StatusSize := _GuiWidth2-2*(_StandardMargin+_ButtonWidth) ; Calculate size of our status bar Gui, Add, Progress, x+%_StandardMargin% yp+%_MixLineTextPush% W%_StatusSize% Hidden h%_TextHeight% -Smooth v_cProgressBar -Gui, Add, Text, Center xp yp W%_StatusSize% v_cStatusText, Version %_Inc_FreenetVersion% - Build %_Inc_FreenetBuild% +Gui, Add, Text, Center xp yp W%_StatusSize% v_cStatusText, % Trans("Version ") _Inc_FreenetVersion Trans(" - Build ") _Inc_FreenetBuild -Gui, Add, Button, x+%_StandardMargin% ys W%_ButtonWidth% v_cInstallButton, &Install +Gui, Add, Button, x+%_StandardMargin% ys W%_ButtonWidth% v_cInstallButton gButtonInstall, % Trans("&Install") ; ; Gui layout finished, do GUI init stuff and return to "idle" state... ; -SetInstallDir(_DefaultInstallDir) +SetInstallDir("") SetTimer, UpdateInstallDirStatusTimer, 5000 -Gui, Show, W%_GuiWidth%, Freenet Installer (Alpha) +Gui, Show, W%_GuiWidth%, % Trans("Freenet Installer (Beta)") return ; @@ -249,7 +275,7 @@ ; If (!TestInstallDirWriteAccess()) { - MsgBox, 48, Freenet Installer Error, Freenet Installer was not able to write to the selected installation directory.`nPlease select one to which you have write access. ; 48 = Icon Exclamation + MsgBox, 48, % Trans("Freenet Installer error"), % Trans("Freenet Installer was not able to write to the selected installation directory.`nPlease select one to which you have write access.") ; 48 = Icon Exclamation VisualInstallEnd() return } @@ -299,7 +325,7 @@ FileAppend, wrapper.ntservice.name=freenet%_InstallSuffix%`n, %_InstallDir%\wrapper.conf FileAppend, `n, %_InstallDir%\wrapper.conf FileAppend, # Display name of the service`n, %_InstallDir%\wrapper.conf -FileAppend, wrapper.ntservice.displayname=Freenet Background Service%_InstallSuffix%`n, %_InstallDir%\wrapper.conf +FileAppend, % "wrapper.ntservice.displayname=" Trans("Freenet background service") _InstallSuffix "`n", %_InstallDir%\wrapper.conf FileAppend, `n, %_InstallDir%\wrapper.conf FileAppend, # User account to run the serve runder`n, %_InstallDir%\wrapper.conf FileAppend, wrapper.ntservice.account=.\Freenet%_InstallSuffix%`n, %_InstallDir%\wrapper.conf @@ -351,14 +377,14 @@ If (_cInstallStartMenuShortcuts) { FileCreateDir, %A_ProgramsCommon%\Freenet%_InstallSuffix% - FileCreateShortcut, %_InstallDir%\freenetlauncher.exe, %A_ProgramsCommon%\Freenet%_InstallSuffix%\Browse Freenet.lnk, , , Opens the Freenet proxy homepage in a web browser, %_InstallDir%\Freenet.ico - FileCreateShortcut, %_InstallDir%\bin\start.exe, %A_ProgramsCommon%\Freenet%_InstallSuffix%\Start Freenet.lnk, , , Starts the background service needed to use Freenet, %_InstallDir%\Freenet.ico - FileCreateShortcut, %_InstallDir%\bin\stop.exe, %A_ProgramsCommon%\Freenet%_InstallSuffix%\Stop Freenet.lnk, , , Stops the background service needed to use Freenet, %_InstallDir%\Freenet.ico + FileCreateShortcut, %_InstallDir%\freenetlauncher.exe, % A_ProgramsCommon "\Freenet" _InstallSuffix "\" Trans("Browse Freenet") ".lnk", , , % Trans("Opens the Freenet proxy homepage in a web browser"), %_InstallDir%\Freenet.ico + FileCreateShortcut, %_InstallDir%\bin\start.exe, % A_ProgramsCommon "\Freenet" _InstallSuffix "\" Trans("Start Freenet") ".lnk", , , % Trans("Starts the background service needed to use Freenet"), %_InstallDir%\Freenet.ico + FileCreateShortcut, %_InstallDir%\bin\stop.exe, % A_ProgramsCommon "\Freenet" _InstallSuffix "\" Trans("Stop Freenet") ".lnk", , , % Trans("Stops the background service needed to use Freenet"), %_InstallDir%\Freenet.ico } If (_cInstallDesktopShortcuts) { FileCreateDir, %A_DesktopCommon% - FileCreateShortcut, %_InstallDir%\freenetlauncher.exe, %A_DesktopCommon%\Browse Freenet%_InstallSuffix%.lnk, , , Opens the Freenet%_InstallSuffix% proxy homepage in a web browser, %_InstallDir%\Freenet.ico + FileCreateShortcut, %_InstallDir%\freenetlauncher.exe, % A_DesktopCommon "\" Trans("Browse Freenet") _InstallSuffix ".lnk", , , % Trans("Opens the Freenet proxy homepage in a web browser"), %_InstallDir%\Freenet.ico } GuiControl, , _cProgressBar, +1 @@ -371,7 +397,7 @@ ; ; Installation (almost) finished! (launching fproxy is done below for usability reasons) ; -MsgBox, 64, Freenet Installer, Installation finished successfully! ; 64 = Icon Asterisk (info) +MsgBox, 64, % Trans("Freenet Installer"), % Trans("Installation finished successfully!") ; 64 = Icon Asterisk (info) ; ; Launch fproxy Modified: trunk/apps/wininstaller/src_freenetinstaller/FreenetInstaller_Include_Helpers.inc =================================================================== --- trunk/apps/wininstaller/src_freenetinstaller/FreenetInstaller_Include_Helpers.inc 2009-04-08 14:44:43 UTC (rev 26652) +++ trunk/apps/wininstaller/src_freenetinstaller/FreenetInstaller_Include_Helpers.inc 2009-04-08 14:51:17 UTC (rev 26653) @@ -95,10 +95,12 @@ } ButtonInstallJava: - GuiControl, +Disabled, _cInstallJavaButton + GuiControl, +Disabled, _cLanguageSelector + GuiControl, +Disabled, _cInstallJavaButton FileInstall, files_bundle\jre-online-installer.exe, %A_WorkingDir%\jre-online-installer.exe RunWait, %A_WorkingDir%\jre-online-installer.exe, , UseErrorLevel - GuiControl, -Disabled, _cInstallJavaButton + GuiControl, -Disabled, _cLanguageSelector + GuiControl, -Disabled, _cInstallJavaButton return RecheckJavaVersionTimer: @@ -106,7 +108,7 @@ { SetTimer, RecheckJavaVersionTimer, Off Gui, Destroy - Goto, GuiStart + SetTimer, GuiStart, -100 } return @@ -134,14 +136,16 @@ { SetTimer, RecheckOldUninstallerTimer, Off Gui, Destroy - Goto, GuiStart + SetTimer, GuiStart, -100 } return -ButtonUninstall: +ButtonUninstall: + GuiControl, +Disabled, _cLanguageSelector GuiControl, +Disabled, _cUninstallButton RunWait, %_OldUninstallerPath%, , UseErrorLevel - GuiControl, -Disabled, _cUninstallButton + GuiControl, -Disabled, _cLanguageSelector + GuiControl, -Disabled, _cUninstallButton return ; @@ -151,7 +155,7 @@ Gui, +OwnDialogs ; Bind the dialog below to the main GUI StringLeft, _OldBaseInstallDir, _InstallDir, StrLen(_InstallDir)-8 - FileSelectFolder, _NewInstallDir, *%_OldBaseInstallDir%, 1, If you do not choose a folder containg containing "Freenet" in the path, a folder will be created for you automatically. ; *=Don't restrict user from browsing upwards from default folder, 1=Show a 'new folder' button + FileSelectFolder, _NewInstallDir, *%_OldBaseInstallDir%, 1, % Trans("If you do not choose a folder containing 'Freenet' in the path, a folder will be created for you automatically.") ; *=Don't restrict user from browsing upwards from default folder, 1=Show a 'new folder' button _NewInstallDir := RegExReplace(_NewInstallDir, "\\$") ; Removes the trailing backslash, if present If (_NewInstallDir <> "") ; If user cancels, this will be empty, so don't pass it on in that case @@ -166,9 +170,20 @@ SetInstallDir(_NewInstallDir) { - global + global + + If (_NewInstallDir == "") + { + If (_InstallDir == "") + { + _NewInstallDir := _DefaultInstallDir + } + Else + { + _NewInstallDir := _InstallDir + } + } - ;If (SubStr(_NewInstallDir, -7) <> "\Freenet") IfNotInString, _NewInstallDir, Freenet { _NewInstallDir = %_NewInstallDir%\Freenet @@ -205,13 +220,13 @@ If (ErrorLevel || _InstallDrive1 = "") { GuiControl, +cRed, _cInstallDirStatusText - GuiControl, Text, _cInstallDirStatusText, Invalid install path! + GuiControl, Text, _cInstallDirStatusText, % Trans("Invalid install path!") GuiControl, +Disabled, _cInstallButton } Else if (StrLen(_InstallDir) + _InternalPathLength > 255) { GuiControl, +cRed, _cInstallDirStatusText - GuiControl, Text, _cInstallDirStatusText, Invalid install path! (Too long for file system to handle) + GuiControl, Text, _cInstallDirStatusText, % Trans("Invalid install path! (Too long for file system to handle)") GuiControl, +Disabled, _cInstallButton } Else @@ -220,19 +235,19 @@ If (_InstallDriveFreeSpace < _RequiredFreeSpace) { GuiControl, +cRed, _cInstallDirStatusText - GuiControl, Text, _cInstallDirStatusText, Not enough free space on installation drive! + GuiControl, Text, _cInstallDirStatusText, % Trans("Not enough free space on installation drive!") GuiControl, +Disabled, _cInstallButton } Else If (FileExist(_InstallDir . "\freenet.jar") || FileExist(_InstallDir . "\freenet.jar.new")) { GuiControl, +cRed, _cInstallDirStatusText - GuiControl, Text, _cInstallDirStatusText, Freenet already installed! Please uninstall first or choose another directory! + GuiControl, Text, _cInstallDirStatusText, % Trans("Freenet already installed! Please uninstall first or choose another directory!") GuiControl, +Disabled, _cInstallButton } Else { GuiControl, +cGreen, _cInstallDirStatusText - GuiControl, Text, _cInstallDirStatusText, Installation directory OK! + GuiControl, Text, _cInstallDirStatusText, % Trans("Installation directory OK!") GuiControl, -Disabled, _cInstallButton } } @@ -240,7 +255,139 @@ UpdateInstallDirStatusTimer: UpdateInstallDirStatus() -return +return + +; +; Localization helpers +; +AddLanguage(_Name, _LoadFunction, _LanguageCode) +{ + global + + _LanguageNames%_LangArray% := _Name + _LanguageLoadFunctions%_LangArray% := _LoadFunction + _LanguageCodes%_LangArray% := _LanguageCode + + _LangArray++ +} + +LoadLanguage(_LoadNum) +{ + global + + _LangNum := _LoadNum + _TransArray := 1 + _LoadFunction := _LanguageLoadFunctions%_LoadNum% + + If (_LoadFunction <> "") + { + %_LoadFunction%() + } +} + +LanguageCodeToID(_LanguageCode) +{ + global + + Loop % _LangArray-1 + { + If (_LanguageCode = _LanguageCodes%A_Index%) + { + return A_Index + } + } + + return 1 ; Language 1 should always be the default language, so use that if no match above +} + +Trans_Add(_OriginalText, _TranslatedText) +{ + global + + _OriginalTextArray%_TransArray% := _OriginalText + _TranslatedTextArray%_TransArray% := _TranslatedText + + _TransArray++ +} + +Trans(_OriginalText) +{ + global + + Loop % _TransArray-1 + { + If (_OriginalText = _OriginalTextArray%A_Index%) + { + return UTF82Ansi(_TranslatedTextArray%A_Index%) + } + } + + return _OriginalText +} + +_ListSelectLanguage: + Gui, Submit, NoHide ; Read values of controls into their variables + + If (_cLanguageSelector <> _LangNum) + { + Gui, Destroy + LoadLanguage(_cLanguageSelector) + SetTimer, GuiStart, -100 + } +return + +UTF82Ansi(zString) +{ + Ansi2Unicode(zString, wString, 65001) + Unicode2Ansi(wString, sString, 0) + Return sString +} + +Ansi2Unicode(ByRef sString, ByRef wString, CP = 0) +{ + nSize := DllCall("MultiByteToWideChar" + , "Uint", CP + , "Uint", 0 + , "Uint", &sString + , "int", -1 + , "Uint", 0 + , "int", 0) + + VarSetCapacity(wString, nSize * 2) + + DllCall("MultiByteToWideChar" + , "Uint", CP + , "Uint", 0 + , "Uint", &sString + , "int", -1 + , "Uint", &wString + , "int", nSize) +} + +Unicode2Ansi(ByRef wString, ByRef sString, CP = 0) +{ + nSize := DllCall("WideCharToMultiByte" + , "Uint", CP + , "Uint", 0 + , "Uint", &wString + , "int", -1 + , "Uint", 0 + , "int", 0 + , "Uint", 0 + , "Uint", 0) + + VarSetCapacity(sString, nSize) + + DllCall("WideCharToMultiByte" + , "Uint", CP + , "Uint", 0 + , "Uint", &wString + , "int", -1 + , "str", sString + , "int", nSize + , "Uint", 0 + , "Uint", 0) +} ; ; Actual installation helpers @@ -294,7 +441,8 @@ Gui, Submit, NoHide ; Read values of checkboxes etc. into their variables ; Disable timers and buttons - SetTimer, UpdateInstallDirStatusTimer, Off + SetTimer, UpdateInstallDirStatusTimer, Off + GuiControl, +Disabled, _cLanguageSelector GuiControl, +Disabled, _cBrowseButton GuiControl, +Disabled, _cDefaultButton GuiControl, +Disabled, _cExitButton @@ -313,7 +461,8 @@ global ; Re-enable timers and buttons - SetTimer, UpdateInstallDirStatusTimer, 5000 + SetTimer, UpdateInstallDirStatusTimer, 5000 + GuiControl, -Disabled, _cLanguageSelector GuiControl, -Disabled, _cBrowseButton GuiControl, -Disabled, _cExitButton GuiControl, -Disabled, _cInstallButton @@ -336,11 +485,11 @@ if (A_Index > 256) ; If this many tries isn't enough, checking any more in this way is probably just a waste of time. Throw an error instead. { _Endport := _StartPort + 256 - 1 - MsgBox, 48, Freenet Installer error, Freenet Installer was not able to find a free port on your system in the range %_StartPort%-%_EndPort%.`nPlease free a system port in this range to install Freenet. ; 48 = Icon Exclamation + MsgBox, 48, % Trans("Freenet Installer error"), % Trans("Freenet Installer was not able to find a free port on your system in the range ") _StartPort "-" _EndPort ".`n" Trans("Please free a system port in this range to install Freenet.") ; 48 = Icon Exclamation return -1 } Else If (TestPortAvailability(_StartPort+A_Index-1)) - { + { return _StartPort+A_Index-1 } } @@ -353,16 +502,16 @@ VarSetCapacity(wsaData, 32) _Result := DllCall("Ws2_32\WSAStartup", "UShort", 0x0002, "UInt", &wsaData) ; Request Winsock 2.0 (0x0002) - if (ErrorLevel) + If (ErrorLevel) { - MsgBox, 16, Freenet Installer fatal error, Freenet Installer was not able to create a Winsock 2.0 socket`nfor port availability testing. ; 16 = Icon Hand (stop/error) + MsgBox, 16, % Trans("Freenet Installer fatal error"), % Trans("Freenet Installer was not able to create a Winsock 2.0 socket`nfor port availability testing.") ; 16 = Icon Hand (stop/error) Exit() } Else If (_Result) ; Non-zero, which means it failed (most Winsock functions return 0 upon success) { _Error := DllCall("Ws2_32\WSAGetLastError") DllCall("Ws2_32\WSACleanup") - MsgBox, 16, Freenet Installer fatal error, Freenet Installer was not able to create a Winsock 2.0 socket`nfor port availability testing (Error: %_Error%). ; 16 = Icon Hand (stop/error) + MsgBox, 16, % Trans("Freenet Installer fatal error"), % Trans("Freenet Installer was not able to create a Winsock 2.0 socket`nfor port availability testing.") " (" Trans("Error: ") _Error ")" ; 16 = Icon Hand (stop/error) Exit() } @@ -375,7 +524,7 @@ { _Error := DllCall("Ws2_32\WSAGetLastError") DllCall("Ws2_32\WSACleanup") - MsgBox, 16, Freenet Installer fatal error, Freenet Installer was not able to create a Winsock 2.0 socket`nfor port availability testing (Error: %_Error%). ; 16 = Icon Hand (stop/error) + MsgBox, 16, % Trans("Freenet Installer fatal error"), % Trans("Freenet Installer was not able to create a Winsock 2.0 socket`nfor port availability testing.") " (" Trans("Error: ") _Error ")" ; 16 = Icon Hand (stop/error) Exit() } Added: trunk/apps/wininstaller/src_freenetinstaller/FreenetInstaller_Include_Lang_da.inc =================================================================== --- trunk/apps/wininstaller/src_freenetinstaller/FreenetInstaller_Include_Lang_da.inc (rev 0) +++ trunk/apps/wininstaller/src_freenetinstaller/FreenetInstaller_Include_Lang_da.inc 2009-04-08 14:51:17 UTC (rev 26653) @@ -0,0 +1,84 @@ +; +; Windows Freenet Installer - Include file - Localization - Danish (da) +; + +LoadLanguage_da() +{ + ; Common + Trans_Add("Freenet Installer", "Freenet Installer") + Trans_Add("Freenet Installer (Beta)", "Freenet Installer (Beta)") + Trans_Add("Welcome to the Freenet Installer!", "Velkommen til Freenet Installer!") + Trans_Add("Installation Problem", "Installationsproblem") + Trans_Add("Freenet Installer fatal error", "Freenet Installer fatal fejl") + Trans_Add("Freenet Installer error", "Freenet Installer fejl") + Trans_Add("Error: ", "Fejl: ") + Trans_Add("E&xit", "&Afslut") + + ; Error messageboxes + Trans_Add("Freenet Installer was not able to unpack necessary installation files to:", "Freenet Installer kunne ikke udpakke nødvendige installationsfiler til:") + Trans_Add("Please make sure that Freenet Installer has full access to the system's temporary files folder.", "Kontrollér at Freenet Installer har ubegrænset adgang til systemets mappe til midlertidige filer.") + Trans_Add("Freenet Installer requires administrator privileges to install Freenet.`nPlease make sure that your user account has administrative access to the system,`nand Freenet Installer is executed with access to use these privileges.", "Freenet Installer kræver administratorrettigheder for at installere Freenet.`nKontrollér at din brugerkonto har administrativ adgang til systemet,`nog at Freenet Installer køres med adgang til at udnytte disse rettigheder.") + Trans_Add("Freenet Installer was not able to write to the selected installation directory.`nPlease select one to which you have write access.", "Freenet Installer kunne ikke skrive til den valgte installationsmappe.`nVælg venligst en mappe du har skriveadgang til.") + Trans_Add("Freenet Installer was not able to find a free port on your system in the range ", "Freenet Installer kunne ikke finde en fri port på dit system i intervallet ") + Trans_Add("Please free a system port in this range to install Freenet.", "For at installere Freenet er du nødt til at frigøre en port i dette interval.") + Trans_Add("Freenet Installer was not able to create a Winsock 2.0 socket`nfor port availability testing.", "Freenet Installer kunne ikke oprette en Winsock 2.0-sokkel`ntil porttestning.") + + ; Unsupported Windows version + Trans_Add("Freenet only supports the following versions of the Windows operating system:", "Freenet understøtter kun følgende versioner af Windows-operativsystemet:") + Trans_Add("Please install one of these versions if you want to use Freenet on Windows.", "Hvis du vil bruge Freenet er du nødt til at installere en af disse versioner.") + + ; Java missing + Trans_Add("Freenet requires the Java Runtime Environment, but your system does not appear to have an up-to-date version installed. You can install Java by using the included online installer, which will download and install the necessary files from the Java website automatically:", "Freenet kræver Java Runtime Environment, men dit system har tilsyneladende ikke en opdateret version installeret. Du kan installere Java ved hjælp af den inkluderede online-installer som automatisk vil downloade og installere filerne fra Javas hjemmeside:") + Trans_Add("&Install Java", "&Installer Java") + Trans_Add("The installation will continue once Java version ", "Installationen vil fortsætte når Java version ") + Trans_Add(" or later has been installed.", " eller nyere er blevet installeret.") + + ; Old installation detected + Trans_Add("Freenet Installer has detected that you already have Freenet installed. Your current installation was installed using an older, unsupported installer. To continue, you must first uninstall your current version of Freenet using the previously created uninstaller:", "Freenet Installer har opdaget at Freenet allerede er installeret, men af et ældre, ikke længere understøttet, installationsprogram. For at fortsætte skal du først afinstallere din nuværende version ved hjælp af det tidligere oprettede afinstallationsprogram:") + Trans_Add("&Uninstall", "A&finstaller") + Trans_Add("The installation will continue once the old installation has been removed.", "Installationen vil fortsætte når den tidligere installation er blevet fjernet.") + + ; Main GUI - Header + Trans_Add("Please check the following default settings before continuing with the installation of Freenet.", "Kontrollér nedenstående standardindstillinger før du fortsætter med installationen af Freenet.") + + ; Main GUI - Install folder + Trans_Add("Installation directory", "Installationsmappe") + Trans_Add("Freenet requires at least ", "Freenet kræver mindst ") + Trans_Add(" MB free disk space, but will not install with less than ", " MB fri diskplads, men vil ikke installere med mindre end ") + Trans_Add(" MB free. The amount of space reserved can be changed after installation.", " MB fri. Mængden af reserveret diskplads kan justeres efter installationen.") + Trans_Add("&Browse", "&Gennemse") + Trans_Add("If you do not choose a folder containing 'Freenet' in the path, a folder will be created for you automatically.", "Hvis du ikke vælger en mappe der indeholder 'Freenet' i stien vil en mappe automatisk blive oprettet for dig.") + Trans_Add("De&fault", "&Standard") + Trans_Add("Status:", "Status:") + Trans_Add("Invalid install path!", "Ugyldig installationssti!") + Trans_Add("Invalid install path! (Too long for file system to handle)", "Ugyldig installationssti! (For lang til filsystemet)") + Trans_Add("Not enough free space on installation drive!", "Ikke nok fri plads på installationsdrevet!") + Trans_Add("Freenet already installed! Please uninstall first or choose another directory!", "Freenet allerede installeret! Afinstaller først eller vælg en anden mappe!") + Trans_Add("Installation directory OK!", "Installationsmappe OK!") + + ; Main GUI - System service + Trans_Add("System service", "Systemtjeneste") + Trans_Add("Freenet will automatically start in the background as a system service. This is required to be a part of the Freenet network, and will use a small amount of system resources. The amount of resources used can be adjusted after installation.", "Freenet vil automatisk starte i baggrunden som en systemtjeneste. Denne er nødvendigt for at være en del af Freenet-netværket, og vil bruge en lille andel systemresurser. Mængden af resurser kan justeres efter installationen.") + + ; Main GUI - Additional settings + Trans_Add("Additional settings", "Yderligere indstillinger") + Trans_Add("Install &start menu shortcuts (All users: Browse Freenet, Start Freenet, Stop Freenet)", "Installer start&menugenveje (Alle brugere: Åbn Freenet, Start Freenet, Stop Freenet)") + Trans_Add("Install &desktop shortcut (All users: Browse Freenet)", "Installer s&krivebordsgenvej (Alle brugere: Åbn Freenet)") + Trans_Add("Browse Freenet &after the installation", "Åbn Freenet &efter installationen") + + ; Main GUI - Footer + Trans_Add("Version ", "Version ") + Trans_Add(" - Build ", " - Build ") + Trans_Add("&Install", "&Installer") + + ; Installation itself + Trans_Add("Freenet Background Service", "Freenet baggrundstjeneste") + Trans_Add("Browse Freenet", "Åbn Freenet") ; Shortcut name + Trans_Add("Opens the Freenet proxy homepage in a web browser", "Åbner Freenet-proxyen i en webbrowser") + Trans_Add("Start Freenet", "Start Freenet") ; Shortcut name + Trans_Add("Starts the background service needed to use Freenet", "Starter baggrundstjenesten krævet for at bruge Freenet") + Trans_Add("Stop Freenet", "Stop Freenet") ; Shortcut name + Trans_Add("Stops the background service needed to use Freenet", "Stopper baggrundstjenesten krævet for at bruge Freenet") + Trans_Add("Installation finished successfully!", "Installationen gennemført med succes!") +} + _______________________________________________ cvs mailing list [email protected] http://emu.freenetproject.org/cgi-bin/mailman/listinfo/cvs
