Set codepage depending on language

This commit is contained in:
UDV\mhg
2018-07-27 16:39:00 +02:00
parent 250fe4ce09
commit ca3d5a1da3
4 changed files with 15 additions and 7 deletions

1
.gitignore vendored
View File

@@ -181,3 +181,4 @@ tests/Test.xml
## CPP db crap ## CPP db crap
*.db *.db
*.opendb *.opendb
.vs/

View File

@@ -5,14 +5,16 @@
Squirrel uses information from your app's EXE as well as the NuGet package Metadata for the setup and uninstall UI. Squirrel uses information from your app's EXE as well as the NuGet package Metadata for the setup and uninstall UI.
* **Id** - name of the application (**warning:** you must **[avoid using spaces and dots](https://github.com/Squirrel/Squirrel.Windows/issues/523)** in the Id). * **Id** - name of the application (**warning:** you must **[avoid using spaces and dots](https://github.com/Squirrel/Squirrel.Windows/issues/523)** in the Id).
* Name of the release packages (e.g., **MyApp**-1.0.0-full.nupkg). * Name of the release packages (e.g., **MyApp**-1.0.0-full.nupkg).
* Local installation directory (e.g., `%LocalAppData%\MyApp`). * Local installation directory (e.g., `%LocalAppData%\MyApp`).
* **Title** - used for the name of the application in the Windows Application Uninstaller. * **Title** - used for the name of the application in the Windows Application Uninstaller.
* **Version** - version specified in `Properties\Assembly.cs`. * **Version** - version specified in `Properties\Assembly.cs`.
* Name of the release package (e.g., MyApp-**1.0.0**-full.nupkg). * Name of the release package (e.g., MyApp-**1.0.0**-full.nupkg).
* Version number in the Windows Uninstaller (see screenshot below). * Version number in the Windows Uninstaller (see screenshot below).
* **Icon Url** - url to an icon to be used for the application. Used for the shortcuts and Windows Uninstaller icons. This must be an icon file (*.ICO) to work correctly. Note that the icon is fetched at installation time rather than packaging (source: [issue #745](https://github.com/Squirrel/Squirrel.Windows/issues/745)) * **Icon Url** - url to an icon to be used for the application. Used for the shortcuts and Windows Uninstaller icons. This must be an icon file (*.ICO) to work correctly. Note that the icon is fetched at installation time rather than
packaging (source: [issue #745](https://github.com/Squirrel/Squirrel.Windows/issues/745))
* **Language** Changes the codepage in to support non english characters. Defaults to 1252 if not present.
![](images/uninstall-app.png) ![](images/uninstall-app.png)

View File

@@ -1,6 +1,7 @@
using System; using System;
using System.Collections.Generic; using System.Collections.Generic;
using System.Diagnostics; using System.Diagnostics;
using System.Globalization;
using System.IO; using System.IO;
using System.IO.Compression; using System.IO.Compression;
using System.Linq; using System.Linq;
@@ -725,6 +726,9 @@ namespace Squirrel.Update
var setupExeDir = Path.GetDirectoryName(setupExe); var setupExeDir = Path.GetDirectoryName(setupExe);
var company = String.Join(",", package.Authors); var company = String.Join(",", package.Authors);
var culture = CultureInfo.GetCultureInfo(package.Language ?? "").TextInfo.ANSICodePage;
var templateText = File.ReadAllText(Path.Combine(pathToWix, "template.wxs")); var templateText = File.ReadAllText(Path.Combine(pathToWix, "template.wxs"));
var templateData = new Dictionary<string, string> { var templateData = new Dictionary<string, string> {
{ "Id", package.Id }, { "Id", package.Id },
@@ -732,6 +736,7 @@ namespace Squirrel.Update
{ "Author", company }, { "Author", company },
{ "Version", Regex.Replace(package.Version.ToString(), @"-.*$", "") }, { "Version", Regex.Replace(package.Version.ToString(), @"-.*$", "") },
{ "Summary", package.Summary ?? package.Description ?? package.Id }, { "Summary", package.Summary ?? package.Description ?? package.Id },
{ "Codepage", $"{culture}" }
}; };
// NB: We need some GUIDs that are based on the package ID, but unique (i.e. // NB: We need some GUIDs that are based on the package ID, but unique (i.e.

View File

@@ -1,5 +1,5 @@
<Wix xmlns="http://schemas.microsoft.com/wix/2006/wi" xmlns:util="http://schemas.microsoft.com/wix/UtilExtension" xmlns:netfx="http://schemas.microsoft.com/wix/NetFxExtension"> <Wix xmlns="http://schemas.microsoft.com/wix/2006/wi" xmlns:util="http://schemas.microsoft.com/wix/UtilExtension" xmlns:netfx="http://schemas.microsoft.com/wix/NetFxExtension">
<Product Id="*" Name="{{Title}} Machine-Wide Installer" Language="1033" Version="!(bind.FileVersion.{{Id}}.exe)" UpgradeCode="{{IdAsGuid1}}" Manufacturer="{{Author}}"> <Product Id="*" Name="{{Title}} Machine-Wide Installer" Language="1033" Codepage="{{Codepage}}" Version="!(bind.FileVersion.{{Id}}.exe)" UpgradeCode="{{IdAsGuid1}}" Manufacturer="{{Author}}">
<Package Description="#Description" Comments="Comments" InstallerVersion="200" Compressed="yes"/> <Package Description="#Description" Comments="Comments" InstallerVersion="200" Compressed="yes"/>
<Media Id="1" Cabinet="contents.cab" EmbedCab="yes" CompressionLevel="high"/> <Media Id="1" Cabinet="contents.cab" EmbedCab="yes" CompressionLevel="high"/>