Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Add localizations Support #39

Closed
wants to merge 7 commits into from
Closed
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension


Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
1 change: 1 addition & 0 deletions README.md
Original file line number Diff line number Diff line change
Expand Up @@ -115,6 +115,7 @@ detailed configuration of the UI. It has the following optional properties:
* `template` (string, optional) - Substitute your own XML that will be inserted
into the final `.wxs` file before compiling the installer to customize the UI
options.
* `localizations` (string[], optional) - Provide an array of paths to `.wxl` files.
* `chooseDirectory` (boolean, optional) - If set to `true`, the end user will be
able to choose the installation directory. Set to `false` by default. Without
effect if a custom `template` is used.
Expand Down
2 changes: 1 addition & 1 deletion package-lock.json

Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.

4 changes: 2 additions & 2 deletions package.json
Original file line number Diff line number Diff line change
@@ -1,6 +1,6 @@
{
"name": "electron-wix-msi",
"version": "2.1.1",
"name": "@kno2/electron-wix-msi",
"version": "2.1.5",
"description": "Creates an MSI installer for your Electron app",
"license": "MIT",
"repository": "",
Expand Down
9 changes: 7 additions & 2 deletions src/creator.ts
Original file line number Diff line number Diff line change
Expand Up @@ -41,6 +41,7 @@ export interface UIOptions {
chooseDirectory?: boolean;
template?: string;
images?: UIImages;
localizations?: Array<string>;
}

export interface UIImages {
Expand Down Expand Up @@ -256,6 +257,10 @@ export class MSICreator {

const preArgs = flatMap(this.extensions.map((e) => (['-ext', e])));

if (typeof this.ui === 'object' && this.ui.localizations && this.ui.localizations.length && type === 'msi') {
this.ui.localizations.forEach((l) => preArgs.push('-loc', l));
}

const { code, stderr, stdout } = await spawnPromise(binary, [ ...preArgs, input ], {
env: process.env,
cwd
Expand Down Expand Up @@ -316,9 +321,9 @@ export class MSICreator {
if (typeof this.ui === 'object' && this.ui !== 'null') {
const { images, template, chooseDirectory } = this.ui;
const propertiesXml = this.getUIProperties(this.ui);
const uiTemplate = template || chooseDirectory
const uiTemplate = template || (chooseDirectory
? this.uiDirTemplate
: this.uiTemplate;
: this.uiTemplate);

xml = replaceInString(uiTemplate, {
'<!-- {{Properties}} -->': propertiesXml
Expand Down
4 changes: 1 addition & 3 deletions static/wix.xml
Original file line number Diff line number Diff line change
Expand Up @@ -19,9 +19,7 @@

<!-- Handle Updates -->
<Upgrade Id="{{UpgradeCode}}">
<UpgradeVersion OnlyDetect="no" Property="PREVIOUSFOUND"
Minimum="0.0.0" IncludeMinimum="yes"
Maximum="{{Version}}" IncludeMaximum="no" />
<UpgradeVersion OnlyDetect="yes" Property="PREVIOUSFOUND" />
</Upgrade>

<InstallExecuteSequence>
Expand Down