Skip to content

Commit 14743dc

Browse files
authored
Merge pull request #3947 from bclothier/SetUpTheBomb
Fixes encoding issues with localized installer messages.
2 parents a7475d7 + 4568b9d commit 14743dc

File tree

5 files changed

+36
-33
lines changed

5 files changed

+36
-33
lines changed

Rubberduck.Deployment/BuildRegistryScript.ps1

Lines changed: 17 additions & 16 deletions
Original file line numberDiff line numberDiff line change
@@ -28,18 +28,18 @@ param (
2828

2929
function Get-ScriptDirectory
3030
{
31-
$Invocation = (Get-Variable MyInvocation -Scope 1).Value
32-
Split-Path $Invocation.MyCommand.Path
31+
$Invocation = (Get-Variable MyInvocation -Scope 1).Value;
32+
Split-Path $Invocation.MyCommand.Path;
3333
}
3434

35-
Set-StrictMode -Version latest
35+
Set-StrictMode -Version latest;
3636
$ErrorActionPreference = "Stop";
3737

3838
try
3939
{
4040
# Allow multiple DLL files to be registered if necessary
41-
$separator = "|"
42-
$option = [System.StringSplitOptions]::RemoveEmptyEntries
41+
$separator = "|";
42+
$option = [System.StringSplitOptions]::RemoveEmptyEntries;
4343
$files = $filesToExtract.Split($separator, $option);
4444

4545
foreach($file in $files)
@@ -50,8 +50,8 @@ try
5050
$targetTlb32 = $targetDir + ($file -replace ".dll", ".x32.tlb");
5151
$sourceTlb64 = $sourceDir + ($file -replace ".dll", ".x64.tlb");
5252
$targetTlb64 = $targetDir + ($file -replace ".dll", ".x64.tlb");
53-
$dllXml = $targetDll + ".xml"
54-
$tlbXml = $targetTlb32 + ".xml"
53+
$dllXml = $targetDll + ".xml";
54+
$tlbXml = $targetTlb32 + ".xml";
5555

5656
# Use for debugging issues with passing parameters to the external programs
5757
# Note that it is not legal to have syntax like `& $cmdIncludingArguments` or `& $cmd $args`
@@ -67,19 +67,20 @@ try
6767
& $cmd file ""$sourceTlb32"" -out ""$tlbXml"";
6868

6969
[System.Reflection.Assembly]::LoadFrom($builderAssemblyPath);
70-
$builder = New-Object Rubberduck.Deployment.Builders.RegistryEntryBuilder
70+
$builder = New-Object Rubberduck.Deployment.Builders.RegistryEntryBuilder;
7171

7272
$entries = $builder.Parse($tlbXml, $dllXml);
7373

7474
# For debugging
7575
# $entries | Format-Table | Out-String |% {Write-Host $_};
7676

77-
$writer = New-Object Rubberduck.Deployment.Writers.InnoSetupRegistryWriter
77+
$writer = New-Object Rubberduck.Deployment.Writers.InnoSetupRegistryWriter;
7878
$content = $writer.Write($entries);
79-
80-
$regFile = ($includeDir + ($file -replace ".dll", ".reg.iss"))
81-
$encoding = New-Object System.Text.UTF8Encoding $False
82-
[System.IO.File]::WriteAllLines($regFile, $content, $encoding)
79+
80+
# The file must be encoded in UTF-8 BOM
81+
$regFile = ($includeDir + ($file -replace ".dll", ".reg.iss"));
82+
$encoding = New-Object System.Text.UTF8Encoding $true;
83+
[System.IO.File]::WriteAllLines($regFile, $content, $encoding);
8384

8485
# Register the debug build on the local machine
8586
if($config -eq "Debug")
@@ -105,18 +106,18 @@ try
105106
& reg.exe import $regFile;
106107
}
107108
& reg.exe import ($dir + "\RubberduckAddinRegistry.reg");
108-
Move-Item -Path $regFile -Destination ($regFile + ".imported_" + $datetime.ToUniversalTime().ToString("yyyyMMddHHmmss") + ".txt" )
109+
Move-Item -Path $regFile -Destination ($regFile + ".imported_" + $datetime.ToUniversalTime().ToString("yyyyMMddHHmmss") + ".txt" );
109110
}
110111
}
111112
else
112113
{
113-
New-Item $dir -ItemType Directory
114+
New-Item $dir -ItemType Directory;
114115
}
115116

116117
# NOTE: The local writer will perform the actual registry changes; the return
117118
# is a registry script with deletion instructions for the keys to be deleted
118119
# in the next build.
119-
$writer = New-Object Rubberduck.Deployment.Writers.LocalDebugRegistryWriter
120+
$writer = New-Object Rubberduck.Deployment.Writers.LocalDebugRegistryWriter;
120121
$content = $writer.Write($entries);
121122

122123
$encoding = New-Object System.Text.ASCIIEncoding;

Rubberduck.Deployment/InnoSetup/Includes/English.CustomMessages.iss

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1,4 +1,4 @@
1-
; English Custom Messages Include
1+
; English Custom Messages Include -- Must be encoded in UTF-8 BOM
22
English.PerUser=Current User
33
English.Everyone=All Users
44
English.RegisterAddin=Repair VBE Addin registration

Rubberduck.Deployment/InnoSetup/Includes/French.CustomMessages.iss

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -1,4 +1,4 @@
1-
; French Custom Messages Include
1+
; French Custom Messages Include -- Must be encoded in UTF-8 BOM
22
French.PerUser=Utilisateur courant
33
French.Everyone=Tous les utilisateurs
44
French.RegisterAddin=Réparer l'enregistrement du complément VBE
@@ -19,7 +19,7 @@ French.RegisterAddInButtonCaption=Enregistrer Rubberduck
1919
French.WillExecuteAdminInstall=Le complément VBE Rubberduck sera disponible pour tous les utilisateurs.%n%nNOTE: chaque utilisateur devra enregistrer le complément individuellement, puisque : %nUne installation par utilisateur ne peut être déployée à tous les utilisateurs.%n%nAprès l'installation, un raccourci "Réparer l'enregistrement du complément VBE" sera disponible pour tous les utilisateurs dans le dossier %nRubberduck's du menu démarrer/programmes.
2020
French.WillLaunchAdminInstall=L'installateur va demander l'accès administrateur pour procéder à l'installation pour tous les utilisateurs.%nEnsuite le complément sera enregistré, mais seulement pour l'utilisateur courant.
2121
French.WillInstallForCurrentUser=Le complément Rubberduck sera disponible seulement pour l'utilisateur courant et ne requièrera pas de privilèges administrateur.
22-
French.UninstallOldVersionPrompt=Il semble y avoir une version antérieure de Rubberduck installée sur ce système pour %s.There seems to be a previous version of Rubberduck, qui devra d'abord être désinstallée. Procéder à la désinstallation?
22+
French.UninstallOldVersionPrompt=Il semble y avoir une version antérieure de Rubberduck installée sur ce système pour %s, qui devra d'abord être désinstallée. Procéder à la désinstallation?
2323
French.UninstallOldVersionFail=Impossible de désinstaller la version antérieure. Essayez de désinstaller via Ajout/Suppression de Programmes dans le panneau de contrôle, puis recommencer l'installation.
2424
French.WarnInstallPerUserOverEveryone=Il semble y avoir une version de Rubberduck installée pour tous les utilisateurs. Procéder à une installation utilisateur simple modifiera l'enregistrement, sans affecter les autres utilisateurs. Procéder?
2525
French.ElevationRequestFailMessage=Impossible de désinstaller la version précédente de Rubberduck. Vous devrez d'abord désinstaller l'ancienne version avant de procéder à la mise à jour.

Rubberduck.Deployment/InnoSetup/Includes/German.CustomMessages.iss

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1,4 +1,4 @@
1-
; German Custom Messages Include
1+
; German Custom Messages Include -- Must be encoded in UTF-8 BOM
22
German.PerUser=Aktueller Benutzer
33
German.Everyone=Alle Benutzer
44
German.RegisterAddin=VBE AddIn Registrierung reparieren

Rubberduck.Deployment/InnoSetup/Installer Build Script.iss

Lines changed: 15 additions & 13 deletions
Original file line numberDiff line numberDiff line change
@@ -1,3 +1,5 @@
1+
;The file must be encoded in UTF-8 BOM
2+
13
#pragma include __INCLUDE__ + ";" + SourcePath + "\Includes\"
24

35
#define protected
@@ -111,7 +113,7 @@ Source: "{#IncludesDir}Rubberduck.RegisterAddIn.reg"; DestDir: "{app}"; Flags: i
111113

112114
[CustomMessages]
113115
; TODO add additional languages here by adding include files in \Includes folder
114-
; and uncomment or add lines to include the file.
116+
; and uncomment or add lines to include the file.
115117
#include <English.CustomMessages.iss>
116118
#include <French.CustomMessages.iss>
117119
#include <German.CustomMessages.iss>
@@ -169,7 +171,7 @@ var
169171
///<remarks>
170172
///Custom page to select whether the installer should run for the
171173
///current user only or for all users (requiring elevation).
172-
///Configured in the WizardInitialize event function.
174+
///Configured in the WizardInitialize event function.
173175
///</remarks>
174176
InstallForWhoOptionPage: TInputOptionWizardPage;
175177
@@ -183,7 +185,7 @@ var
183185
///<remarks>
184186
///Set by the <see cref="RegisterAddInOptionPage" />; should be
185187
///read-only normally. When set to true, it is used to check if
186-
///elevation is needed for the installer.
188+
///elevation is needed for the installer.
187189
///</remarks>
188190
ShouldInstallAllUsers: Boolean;
189191
@@ -220,7 +222,7 @@ var
220222
221223
///<remarks>
222224
///Win32 API function used to launch a 2nd instance of the installer
223-
///under elevated context, used by <see cref="Elevate" />.
225+
///under elevated context, used by <see cref="Elevate" />.
224226
///</remarks>
225227
function ShellExecute(hwnd: HWND; lpOperation: string; lpFile: string;
226228
lpParameters: string; lpDirectory: string; nShowCmd: Integer): HINSTANCE;
@@ -232,7 +234,7 @@ function ShellExecute(hwnd: HWND; lpOperation: string; lpFile: string;
232234
///Encapuslate the check whether the installer is running in an
233235
///elevated context or not. This does not indicate whether the
234236
///installer was launched by a non-elevated installer, however.
235-
///<see cref="HasElevateSwitch" />
237+
///<see cref="HasElevateSwitch" />
236238
///</remarks>
237239
function IsElevated: Boolean;
238240
begin
@@ -259,7 +261,7 @@ end;
259261
///<remarks>
260262
///Used to determine whether a install directory that user
261263
///selected is in fact writable by the user, especially
262-
///for non-elevated installation.
264+
///for non-elevated installation.
263265
///</remarks>
264266
function HaveWriteAccessToApp: Boolean;
265267
var
@@ -480,7 +482,7 @@ end;
480482
///to do so. This guards against the case of both the non-elevated
481483
///installer and the elevated installer installing same files into
482484
///same place, which will cause problems. This function ensures only
483-
///one or other mode will actually install the files.
485+
///one or other mode will actually install the files.
484486
///</remarks>
485487
function CheckShouldInstallFiles():boolean;
486488
begin
@@ -730,7 +732,7 @@ begin
730732
begin
731733
Log('Uninstall of previous version (%s) was declined by the user.');
732734
result := false;
733-
end;
735+
end;
734736
end;
735737
736738
// Event functions called by Inno Setup
@@ -742,7 +744,7 @@ end;
742744
///<remarks>
743745
///This is the first event of the installer, fires prior to the wizard
744746
///being initialized. This is primarily used to validate that the
745-
///pre-requisites are met, in this case, pre-existence of .NET framework.
747+
///pre-requisites are met, in this case, pre-existence of .NET framework.
746748
///</remarks>
747749
function InitializeSetup(): Boolean;
748750
var
@@ -770,7 +772,7 @@ end;
770772
///set up the <see cref="InstallForWhoOptionPage" /> and
771773
///<see cref="RegisterAddInOptionPage" /> pages. In both cases, their
772774
///behavior differs depending on whether we are elevated, and need to be
773-
///configured accordingly.
775+
///configured accordingly.
774776
///</remarks>
775777
procedure InitializeWizard();
776778
begin
@@ -859,7 +861,7 @@ begin
859861
begin
860862
Log('Skipping Finished page because we are running with /ELEVATE switch');
861863
Result := true;
862-
end;
864+
end;
863865
end;
864866
865867
///<remarks>
@@ -1015,7 +1017,7 @@ end;
10151017
///The event function is called when wizard reaches the ready to install page.
10161018
///Because we may or may not launch an elevated installer which will show similar
10171019
///page, we need to help to make clear to the user what the installer(s) will be
1018-
///doing by adding the extra custom messages accordingly to the page.
1020+
///doing by adding the extra custom messages accordingly to the page.
10191021
///</remarks>
10201022
function UpdateReadyMemo(Space, NewLine, MemoUserInfoInfo, MemoDirInfo, MemoTypeInfo, MemoComponentsInfo, MemoGroupInfo, MemoTasksInfo: String): String;
10211023
var
@@ -1063,7 +1065,7 @@ end;
10631065
///
10641066
///As a rule, the addin registration should be always uninstalled; there is no
10651067
///purpose in having the addin registered when the DLL gets uninstalled. Note
1066-
///this is also unconditional - it will uninstall the related registry keys.
1068+
///this is also unconditional - it will uninstall the related registry keys.
10671069
///</remarks>
10681070
procedure CurUninstallStepChanged(CurUninstallStep: TUninstallStep);
10691071
begin

0 commit comments

Comments
 (0)