diff --git a/.idea/dictionaries/develar.xml b/.idea/dictionaries/develar.xml
index 2f9e6a4e9f1..e9388e7c88f 100644
--- a/.idea/dictionaries/develar.xml
+++ b/.idea/dictionaries/develar.xml
@@ -209,6 +209,7 @@
uitk
ulfo
unassociate
+ unflatten
unicon
uninstallation
unmounting
diff --git a/docs/Options.md b/docs/Options.md
index cf5a106f52c..a4f86cb5cfb 100644
--- a/docs/Options.md
+++ b/docs/Options.md
@@ -325,6 +325,9 @@ Debian Package Specific Options
### `DmgOptions` ⇐ [TargetSpecificOptions](electron-builder-core#TargetSpecificOptions)
macOS DMG Options ([dmg](#Config-dmg)).
+To add license to DMG, create file `license_LANG_CODE.txt` in the build resources. Multiple license files in different languages are supported — use lang postfix (e.g. `_de`, `_ru`)). For example, create files `license_de.txt` and `license_en.txt` in the build resources.
+If OS language is german, `license_de.txt` will be displayed. See map of [language code to name](https://github.com/meikidd/iso-639-1/blob/master/src/data.js).
+
**Kind**: interface of [electron-builder](#module_electron-builder)
**Extends**: [TargetSpecificOptions](electron-builder-core#TargetSpecificOptions)
**Properties**
@@ -611,6 +614,7 @@ Windows Specific Options ([win](#Config-win)).
| certificatePassword| string
| The password to the certificate provided in `certificateFile`. Please use it only if you cannot use env variable `CSC_KEY_PASSWORD` (`WIN_CSC_KEY_PASSWORD`) for some reason. Please see [Code Signing](https://github.com/electron-userland/electron-builder/wiki/Code-Signing). |
| certificateSubjectName| string
| The name of the subject of the signing certificate. Required only for EV Code Signing and works only on Windows. |
| certificateSha1| string
| The SHA1 hash of the signing certificate. The SHA1 hash is commonly specified when multiple certificates satisfy the criteria specified by the remaining switches. Works only on Windows. |
+| additionalCertificateFile| string
| The path to an additional certificate file you want to add to the signature block. |
| rfc3161TimeStampServer| string
| The URL of the RFC 3161 time stamp server. Defaults to `http://timestamp.comodoca.com/rfc3161`. |
| timeStampServer| string
| The URL of the time stamp server. Defaults to `http://timestamp.verisign.com/scripts/timstamp.dll`. |
| publisherName| string
\| Array<string>
\| null
| [The publisher name](https://github.com/electron-userland/electron-builder/issues/1187#issuecomment-278972073), exactly as in your code signed certificate. Several names can be provided. Defaults to common name from your code signing certificate. |
diff --git a/docs/api/electron-builder.md b/docs/api/electron-builder.md
index be75ad56a08..fae32b8f834 100644
--- a/docs/api/electron-builder.md
+++ b/docs/api/electron-builder.md
@@ -52,8 +52,12 @@ Developer API only. See [[Options]] for user documentation.
electron-builder/out/targets/dmg
+electron-builder/out/targets/dmgLicense
+
electron-builder/out/targets/fpm
+electron-builder/out/targets/license
+
electron-builder/out/targets/LinuxTargetHelper
electron-builder/out/targets/nsis
@@ -1570,7 +1574,7 @@ Developer API only. See [[Options]] for user documentation.
| Name | Type |
| --- | --- |
| publishTasks=| Array<Promise<any>>
|
-| progress = (<NodeJS.WritableStream>process.stdout).isTTY ? new MultiProgress() : null
| null
\| [MultiProgress](electron-publish#MultiProgress)
|
+| progress = (<TtyWriteStream>process.stdout).isTTY ? new MultiProgress() : null
| null
\| [MultiProgress](electron-publish#MultiProgress)
|
* [.PublishManager](#PublishManager) ⇐ [PublishContext](electron-publish#PublishContext)
@@ -1885,6 +1889,19 @@ Developer API only. See [[Options]] for user documentation.
| readWrite | boolean
|
| task | callback
|
+
+
+## electron-builder/out/targets/dmgLicense
+
+
+### `electron-builder/out/targets/dmgLicense.addLicenseToDmg(packager, dmgPath)` ⇒ Promise<void>
+**Kind**: method of [electron-builder/out/targets/dmgLicense](#module_electron-builder/out/targets/dmgLicense)
+
+| Param | Type |
+| --- | --- |
+| packager | [PlatformPackager](#PlatformPackager)<any>
|
+| dmgPath | string
|
+
## electron-builder/out/targets/fpm
@@ -1914,6 +1931,51 @@ Developer API only. See [[Options]] for user documentation.
| appOutDir | string
|
| arch | [Arch](electron-builder-core#Arch)
|
+
+
+## electron-builder/out/targets/license
+
+* [electron-builder/out/targets/license](#module_electron-builder/out/targets/license)
+ * [`.LicenseFile`](#LicenseFile)
+ * [`.lcid`](#module_electron-builder/out/targets/license.lcid) : any
+ * [`.getLicenseFiles(packager)`](#module_electron-builder/out/targets/license.getLicenseFiles) ⇒ Promise<Array<[LicenseFile](#LicenseFile)>>
+ * [`.toLangWithRegion(lang)`](#module_electron-builder/out/targets/license.toLangWithRegion) ⇒ string
+
+
+
+### `LicenseFile`
+**Kind**: interface of [electron-builder/out/targets/license](#module_electron-builder/out/targets/license)
+**Properties**
+
+| Name | Type |
+| --- | --- |
+| **file**| string
|
+| **lang**| string
|
+| **langWithRegion**| string
|
+| **langName**| string
|
+
+
+
+### `electron-builder/out/targets/license.lcid` : any
+**Kind**: constant of [electron-builder/out/targets/license](#module_electron-builder/out/targets/license)
+
+
+### `electron-builder/out/targets/license.getLicenseFiles(packager)` ⇒ Promise<Array<[LicenseFile](#LicenseFile)>>
+**Kind**: method of [electron-builder/out/targets/license](#module_electron-builder/out/targets/license)
+
+| Param | Type |
+| --- | --- |
+| packager | [PlatformPackager](#PlatformPackager)<any>
|
+
+
+
+### `electron-builder/out/targets/license.toLangWithRegion(lang)` ⇒ string
+**Kind**: method of [electron-builder/out/targets/license](#module_electron-builder/out/targets/license)
+
+| Param | Type |
+| --- | --- |
+| lang | string
|
+
## electron-builder/out/targets/LinuxTargetHelper
diff --git a/packages/electron-builder/src/options/macOptions.ts b/packages/electron-builder/src/options/macOptions.ts
index f4f153f9df2..e36ab06f668 100644
--- a/packages/electron-builder/src/options/macOptions.ts
+++ b/packages/electron-builder/src/options/macOptions.ts
@@ -99,6 +99,9 @@ export interface PkgOptions extends TargetSpecificOptions {
/**
* macOS DMG Options ([dmg](#Config-dmg)).
+ *
+ * To add license to DMG, create file `license_LANG_CODE.txt` in the build resources. Multiple license files in different languages are supported — use lang postfix (e.g. `_de`, `_ru`)). For example, create files `license_de.txt` and `license_en.txt` in the build resources.
+ * If OS language is german, `license_de.txt` will be displayed. See map of [language code to name](https://github.com/meikidd/iso-639-1/blob/master/src/data.js).
*/
export interface DmgOptions extends TargetSpecificOptions {
/**
diff --git a/packages/electron-builder/src/targets/dmg.ts b/packages/electron-builder/src/targets/dmg.ts
index 495748eaaa3..e3fe99e4e76 100644
--- a/packages/electron-builder/src/targets/dmg.ts
+++ b/packages/electron-builder/src/targets/dmg.ts
@@ -10,6 +10,7 @@ import * as path from "path"
import sanitizeFileName from "sanitize-filename"
import { DmgOptions, MacOptions } from "../options/macOptions"
import { PlatformPackager } from "../platformPackager"
+import { addLicenseToDmg } from "./dmgLicense"
export class DmgTarget extends Target {
readonly options = this.packager.config.dmg
@@ -175,6 +176,8 @@ export class DmgTarget extends Target {
await spawn("hdiutil", addVerboseIfNeed(args))
await exec("hdiutil", addVerboseIfNeed(["internet-enable", "-no"]).concat(artifactPath))
+ await addLicenseToDmg(packager, artifactPath)
+
this.packager.dispatchArtifactCreated(artifactPath, this, arch, `${appInfo.name}-${appInfo.version}.dmg`)
}
diff --git a/packages/electron-builder/src/targets/dmgLicense.ts b/packages/electron-builder/src/targets/dmgLicense.ts
new file mode 100644
index 00000000000..61ff8cd0d0a
--- /dev/null
+++ b/packages/electron-builder/src/targets/dmgLicense.ts
@@ -0,0 +1,42 @@
+import { debug, exec } from "electron-builder-util"
+import { readFile, writeFile } from "fs-extra-p"
+import * as path from "path"
+import { PlatformPackager } from "../platformPackager"
+import { getLicenseFiles } from "./license"
+
+// http://www.owsiak.org/?p=700
+export async function addLicenseToDmg(packager: PlatformPackager, dmgPath: string) {
+ const licenseFiles = await getLicenseFiles(packager)
+ if (licenseFiles.length === 0) {
+ return
+ }
+
+ if (debug.enabled) {
+ debug(`License files: ${licenseFiles.join(" ")}`)
+ }
+
+ const tempFile = await packager.getTempFile(".r")
+ let data = await readFile(path.join(__dirname, "..", "..", "templates", "dmg", "license.txt"), "utf8")
+ let counter = 5000
+ for (const item of licenseFiles) {
+ const kind = item.file.toLowerCase().endsWith(".rtf") ? "RTF" : "TEXT"
+ data += `data '${kind}' (${counter}, "${item.langName} SLA") {\n`
+
+ data += '$"' + (await readFile(item.file)).toString("hex").toUpperCase() + '"\n'
+ data += "};\n\n"
+ // noinspection SpellCheckingInspection
+ data += `data 'styl' (${counter}, "${item.langName} SLA") {
+ $"0003 0000 0000 000C 0009 0015 0000 0000"
+ $"0000 0000 0000 0000 002A 000C 0009 0015"
+ $"0100 0000 0000 0000 0000 0000 002E 000C"
+ $"0009 0015 0000 0000 0000 0000 0000"
+};`
+
+ counter++
+ }
+
+ await writeFile(tempFile, data)
+ await exec("hdiutil", ["unflatten", dmgPath])
+ await exec("Rez", ["-a", tempFile, "-o", dmgPath])
+ await exec("hdiutil", ["flatten", dmgPath])
+}
\ No newline at end of file
diff --git a/packages/electron-builder/src/targets/license.ts b/packages/electron-builder/src/targets/license.ts
new file mode 100644
index 00000000000..00a1715de7e
--- /dev/null
+++ b/packages/electron-builder/src/targets/license.ts
@@ -0,0 +1,442 @@
+import * as path from "path"
+import { PlatformPackager } from "../platformPackager"
+
+// "el_GR" "lv_LV" "ko_KR" "tr_TR"
+export const bundledLanguages = ["en_US", "de_DE", "fr_FR", "es_ES", "zh_CN", "zh_TW", "ja_JP", "it_IT", "nl_NL", "ru_RU", "pl_PL", "uk_UA", "cs_CZ", "sv_SE", "nb_NO", "da_DK", "pt_PT"]
+const langToLangWithRegion = new Map()
+for (const id of bundledLanguages) {
+ langToLangWithRegion.set(id.substring(0, id.indexOf("_")), id)
+}
+
+export function toLangWithRegion(lang: string): string {
+ let langWithRegion = langToLangWithRegion.get(lang)
+ if (langWithRegion == null) {
+ langWithRegion = `${lang}_${lang.toUpperCase()}`
+ }
+ return langWithRegion
+}
+
+export async function getLicenseFiles(packager: PlatformPackager): Promise> {
+ const files = (await packager.resourceList)
+ .filter(it => {
+ const name = it.toLowerCase()
+ return (name.startsWith("license_") || name.startsWith("eula_")) && (name.endsWith(".rtf") || name.endsWith(".txt"))
+ })
+ .sort((a, b) => {
+ const aW = a.includes("_en") ? 0 : 100
+ const bW = b.includes("_en") ? 0 : 100
+ return aW === bW ? a.localeCompare(b) : aW - bW
+ })
+
+ return files.map(file => {
+ let lang = file.match(/_([^.]+)\./)![1]
+ let langWithRegion
+ if (lang.includes("_")) {
+ langWithRegion = lang
+ }
+ else {
+ lang = lang.toLowerCase()
+ langWithRegion = toLangWithRegion(lang)
+ }
+ return {file: path.join(packager.buildResourcesDir, file), lang, langWithRegion, langName: (langIdToName)[lang]}
+ })
+}
+
+export const lcid: any = {
+ "af_ZA": 1078,
+ "am_ET": 1118,
+ "ar_AE": 14337,
+ "ar_BH": 15361,
+ "ar_DZ": 5121,
+ "ar_EG": 3073,
+ "ar_IQ": 2049,
+ "ar_JO": 11265,
+ "ar_KW": 13313,
+ "ar_LB": 12289,
+ "ar_LY": 4097,
+ "ar_MA": 6145,
+ "ar_OM": 8193,
+ "ar_QA": 16385,
+ "ar_SA": 1025,
+ "ar_SY": 10241,
+ "ar_TN": 7169,
+ "ar_YE": 9217,
+ "arn_CL": 1146,
+ "as_IN": 1101,
+ "az_AZ": 2092,
+ "ba_RU": 1133,
+ "be_BY": 1059,
+ "bg_BG": 1026,
+ "bn_IN": 1093,
+ "bo_BT": 2129,
+ "bo_CN": 1105,
+ "br_FR": 1150,
+ "bs_BA": 8218,
+ "ca_ES": 1027,
+ "co_FR": 1155,
+ "cs_CZ": 1029,
+ "cy_GB": 1106,
+ "da_DK": 1030,
+ "de_AT": 3079,
+ "de_CH": 2055,
+ "de_DE": 1031,
+ "de_LI": 5127,
+ "de_LU": 4103,
+ "div_MV": 1125,
+ "dsb_DE": 2094,
+ "el_GR": 1032,
+ "en_AU": 3081,
+ "en_BZ": 10249,
+ "en_CA": 4105,
+ "en_CB": 9225,
+ "en_GB": 2057,
+ "en_IE": 6153,
+ "en_IN": 18441,
+ "en_JA": 8201,
+ "en_MY": 17417,
+ "en_NZ": 5129,
+ "en_PH": 13321,
+ "en_TT": 11273,
+ "en_US": 1033,
+ "en_ZA": 7177,
+ "en_ZW": 12297,
+ "es_AR": 11274,
+ "es_BO": 16394,
+ "es_CL": 13322,
+ "es_CO": 9226,
+ "es_CR": 5130,
+ "es_DO": 7178,
+ "es_EC": 12298,
+ "es_ES": 3082,
+ "es_GT": 4106,
+ "es_HN": 18442,
+ "es_MX": 2058,
+ "es_NI": 19466,
+ "es_PA": 6154,
+ "es_PE": 10250,
+ "es_PR": 20490,
+ "es_PY": 15370,
+ "es_SV": 17418,
+ "es_UR": 14346,
+ "es_US": 21514,
+ "es_VE": 8202,
+ "et_EE": 1061,
+ "eu_ES": 1069,
+ "fa_IR": 1065,
+ "fi_FI": 1035,
+ "fil_PH": 1124,
+ "fo_FO": 1080,
+ "fr_BE": 2060,
+ "fr_CA": 3084,
+ "fr_CH": 4108,
+ "fr_FR": 1036,
+ "fr_LU": 5132,
+ "fr_MC": 6156,
+ "fy_NL": 1122,
+ "ga_IE": 2108,
+ "gbz_AF": 1164,
+ "gl_ES": 1110,
+ "gsw_FR": 1156,
+ "gu_IN": 1095,
+ "ha_NG": 1128,
+ "he_IL": 1037,
+ "hi_IN": 1081,
+ "hr_BA": 4122,
+ "hr_HR": 1050,
+ "hu_HU": 1038,
+ "hy_AM": 1067,
+ "id_ID": 1057,
+ "ii_CN": 1144,
+ "is_IS": 1039,
+ "it_CH": 2064,
+ "it_IT": 1040,
+ "iu_CA": 2141,
+ "ja_JP": 1041,
+ "ka_GE": 1079,
+ "kh_KH": 1107,
+ "kk_KZ": 1087,
+ "kl_GL": 1135,
+ "kn_IN": 1099,
+ "ko_KR": 1042,
+ "kok_IN": 1111,
+ "ky_KG": 1088,
+ "lb_LU": 1134,
+ "lo_LA": 1108,
+ "lt_LT": 1063,
+ "lv_LV": 1062,
+ "mi_NZ": 1153,
+ "mk_MK": 1071,
+ "ml_IN": 1100,
+ "mn_CN": 2128,
+ "mn_MN": 1104,
+ "moh_CA": 1148,
+ "mr_IN": 1102,
+ "ms_BN": 2110,
+ "ms_MY": 1086,
+ "mt_MT": 1082,
+ "my_MM": 1109,
+ "nb_NO": 1044,
+ "ne_NP": 1121,
+ "nl_BE": 2067,
+ "nl_NL": 1043,
+ "nn_NO": 2068,
+ "ns_ZA": 1132,
+ "oc_FR": 1154,
+ "or_IN": 1096,
+ "pa_IN": 1094,
+ "pl_PL": 1045,
+ "ps_AF": 1123,
+ "pt_BR": 1046,
+ "pt_PT": 2070,
+ "qut_GT": 1158,
+ "quz_BO": 1131,
+ "quz_EC": 2155,
+ "quz_PE": 3179,
+ "rm_CH": 1047,
+ "ro_RO": 1048,
+ "ru_RU": 1049,
+ "rw_RW": 1159,
+ "sa_IN": 1103,
+ "sah_RU": 1157,
+ "se_FI": 3131,
+ "se_NO": 1083,
+ "se_SE": 2107,
+ "si_LK": 1115,
+ "sk_SK": 1051,
+ "sl_SI": 1060,
+ "sma_NO": 6203,
+ "sma_SE": 7227,
+ "smj_NO": 4155,
+ "smj_SE": 5179,
+ "smn_FI": 9275,
+ "sms_FI": 8251,
+ "sq_AL": 1052,
+ "sr_BA": 7194,
+ "sr_SP": 3098,
+ "sv_FI": 2077,
+ "sv_SE": 1053,
+ "sw_KE": 1089,
+ "syr_SY": 1114,
+ "ta_IN": 1097,
+ "te_IN": 1098,
+ "tg_TJ": 1064,
+ "th_TH": 1054,
+ "tk_TM": 1090,
+ "tmz_DZ": 2143,
+ "tn_ZA": 1074,
+ "tr_TR": 1055,
+ "tt_RU": 1092,
+ "ug_CN": 1152,
+ "uk_UA": 1058,
+ "ur_IN": 2080,
+ "ur_PK": 1056,
+ "uz_UZ": 2115,
+ "vi_VN": 1066,
+ "wen_DE": 1070,
+ "wo_SN": 1160,
+ "xh_ZA": 1076,
+ "yo_NG": 1130,
+ "zh_CHS": 4,
+ "zh_CHT": 31748,
+ "zh_CN": 2052,
+ "zh_HK": 3076,
+ "zh_MO": 5124,
+ "zh_SG": 4100,
+ "zh_TW": 1028,
+ "zu_ZA": 1077
+}
+
+export interface LicenseFile {
+ file: string
+ lang: string
+ langWithRegion: string
+ langName: string
+}
+
+// noinspection SpellCheckingInspection
+const langIdToName = {
+ "ab": "Abkhaz",
+ "aa": "Afar",
+ "af": "Afrikaans",
+ "ak": "Akan",
+ "sq": "Albanian",
+ "am": "Amharic",
+ "ar": "Arabic",
+ "an": "Aragonese",
+ "hy": "Armenian",
+ "as": "Assamese",
+ "av": "Avaric",
+ "ae": "Avestan",
+ "ay": "Aymara",
+ "az": "Azerbaijani",
+ "bm": "Bambara",
+ "ba": "Bashkir",
+ "eu": "Basque",
+ "be": "Belarusian",
+ "bn": "Bengali",
+ "bh": "Bihari",
+ "bi": "Bislama",
+ "bs": "Bosnian",
+ "br": "Breton",
+ "bg": "Bulgarian",
+ "my": "Burmese",
+ "ca": "Catalan",
+ "ch": "Chamorro",
+ "ce": "Chechen",
+ "ny": "Chichewa",
+ "zh": "Chinese",
+ "cv": "Chuvash",
+ "kw": "Cornish",
+ "co": "Corsican",
+ "cr": "Cree",
+ "hr": "Croatian",
+ "cs": "Czech",
+ "da": "Danish",
+ "dv": "Divehi",
+ "nl": "Dutch",
+ "dz": "Dzongkha",
+ "en": "English",
+ "eo": "Esperanto",
+ "et": "Estonian",
+ "ee": "Ewe",
+ "fo": "Faroese",
+ "fj": "Fijian",
+ "fi": "Finnish",
+ "fr": "French",
+ "ff": "Fula",
+ "gl": "Galician",
+ "ka": "Georgian",
+ "de": "German",
+ "el": "Greek",
+ "gn": "Guaraní",
+ "gu": "Gujarati",
+ "ht": "Haitian",
+ "ha": "Hausa",
+ "he": "Hebrew",
+ "hz": "Herero",
+ "hi": "Hindi",
+ "ho": "Hiri Motu",
+ "hu": "Hungarian",
+ "ia": "Interlingua",
+ "id": "Indonesian",
+ "ie": "Interlingue",
+ "ga": "Irish",
+ "ig": "Igbo",
+ "ik": "Inupiaq",
+ "io": "Ido",
+ "is": "Icelandic",
+ "it": "Italian",
+ "iu": "Inuktitut",
+ "ja": "Japanese",
+ "jv": "Javanese",
+ "kl": "Kalaallisut",
+ "kn": "Kannada",
+ "kr": "Kanuri",
+ "ks": "Kashmiri",
+ "kk": "Kazakh",
+ "km": "Khmer",
+ "ki": "Kikuyu",
+ "rw": "Kinyarwanda",
+ "ky": "Kyrgyz",
+ "kv": "Komi",
+ "kg": "Kongo",
+ "ko": "Korean",
+ "ku": "Kurdish",
+ "kj": "Kwanyama",
+ "la": "Latin",
+ "lb": "Luxembourgish",
+ "lg": "Ganda",
+ "li": "Limburgish",
+ "ln": "Lingala",
+ "lo": "Lao",
+ "lt": "Lithuanian",
+ "lu": "Luba-Katanga",
+ "lv": "Latvian",
+ "gv": "Manx",
+ "mk": "Macedonian",
+ "mg": "Malagasy",
+ "ms": "Malay",
+ "ml": "Malayalam",
+ "mt": "Maltese",
+ "mi": "Māori",
+ "mr": "Marathi",
+ "mh": "Marshallese",
+ "mn": "Mongolian",
+ "na": "Nauru",
+ "nv": "Navajo",
+ "nd": "Northern Ndebele",
+ "ne": "Nepali",
+ "ng": "Ndonga",
+ "nb": "Norwegian Bokmål",
+ "nn": "Norwegian Nynorsk",
+ "no": "Norwegian",
+ "ii": "Nuosu",
+ "nr": "Southern Ndebele",
+ "oc": "Occitan",
+ "oj": "Ojibwe",
+ "cu": "Old Church Slavonic",
+ "om": "Oromo",
+ "or": "Oriya",
+ "os": "Ossetian",
+ "pa": "Panjabi",
+ "pi": "Pāli",
+ "fa": "Persian",
+ "pl": "Polish",
+ "ps": "Pashto",
+ "pt": "Portuguese",
+ "qu": "Quechua",
+ "rm": "Romansh",
+ "rn": "Kirundi",
+ "ro": "Romanian",
+ "ru": "Russian",
+ "sa": "Sanskrit",
+ "sc": "Sardinian",
+ "sd": "Sindhi",
+ "se": "Northern Sami",
+ "sm": "Samoan",
+ "sg": "Sango",
+ "sr": "Serbian",
+ "gd": "Gaelic",
+ "sn": "Shona",
+ "si": "Sinhala",
+ "sk": "Slovak",
+ "sl": "Slovene",
+ "so": "Somali",
+ "st": "Southern Sotho",
+ "es": "Spanish",
+ "su": "Sundanese",
+ "sw": "Swahili",
+ "ss": "Swati",
+ "sv": "Swedish",
+ "ta": "Tamil",
+ "te": "Telugu",
+ "tg": "Tajik",
+ "th": "Thai",
+ "ti": "Tigrinya",
+ "bo": "Tibetan Standard",
+ "tk": "Turkmen",
+ "tl": "Tagalog",
+ "tn": "Tswana",
+ "to": "Tonga",
+ "tr": "Turkish",
+ "ts": "Tsonga",
+ "tt": "Tatar",
+ "tw": "Twi",
+ "ty": "Tahitian",
+ "ug": "Uyghur",
+ "uk": "Ukrainian",
+ "ur": "Urdu",
+ "uz": "Uzbek",
+ "ve": "Venda",
+ "vi": "Vietnamese",
+ "vo": "Volapük",
+ "wa": "Walloon",
+ "cy": "Welsh",
+ "wo": "Wolof",
+ "fy": "Western Frisian",
+ "xh": "Xhosa",
+ "yi": "Yiddish",
+ "yo": "Yoruba",
+ "za": "Zhuang",
+ "zu": "Zulu"
+}
\ No newline at end of file
diff --git a/packages/electron-builder/src/targets/nsis.ts b/packages/electron-builder/src/targets/nsis.ts
index 9f7b5d14aaa..840c2c3ce7e 100644
--- a/packages/electron-builder/src/targets/nsis.ts
+++ b/packages/electron-builder/src/targets/nsis.ts
@@ -15,6 +15,7 @@ import { normalizeExt } from "../platformPackager"
import { getSignVendorPath } from "../windowsCodeSign"
import { WinPackager } from "../winPackager"
import { archive } from "./archive"
+import { bundledLanguages, getLicenseFiles, lcid, toLangWithRegion } from "./license"
// noinspection SpellCheckingInspection
const ELECTRON_BUILDER_NS_UUID = "50e065bc-3134-11e6-9bab-38c9862bdaf3"
@@ -513,12 +514,7 @@ export class NsisTarget extends Target {
return [`!insertmacro MUI_PAGE_LICENSE "${license}"`]
}
- const licenseFiles = (await packager.resourceList)
- .filter(it => {
- const name = it.toLowerCase()
- return (name.startsWith("license_") || name.startsWith("eula_")) && (name.endsWith(".rtf") || name.endsWith(".txt"))
- })
-
+ const licenseFiles = await getLicenseFiles(packager)
if (licenseFiles.length === 0) {
return null
}
@@ -527,28 +523,12 @@ export class NsisTarget extends Target {
const unspecifiedLangs = new Set(bundledLanguages)
let defaultFile: string | null = null
- const sortedFiles = licenseFiles.sort((a, b) => {
- const aW = a.includes("_en") ? 0 : 100
- const bW = b.includes("_en") ? 0 : 100
- return aW === bW ? a.localeCompare(b) : aW - bW
- })
- for (const file of sortedFiles) {
- let lang = file.match(/_([^.]+)\./)![1]
- let langWithRegion
- if (lang.includes("_")) {
- langWithRegion = lang
- }
- else {
- lang = lang.toLowerCase()
- langWithRegion = toLangWithRegion(lang)
- }
-
- unspecifiedLangs.delete(langWithRegion)
- const fullFile = path.join(packager.buildResourcesDir, file)
+ for (const item of licenseFiles) {
+ unspecifiedLangs.delete(item.langWithRegion)
if (defaultFile == null) {
- defaultFile = fullFile
+ defaultFile = item.file
}
- licensePage.push(`LicenseLangString MUILicense ${lcid[langWithRegion] || lang} "${fullFile}"`)
+ licensePage.push(`LicenseLangString MUILicense ${lcid[item.langWithRegion] || item.lang} "${item.file}"`)
}
for (const l of unspecifiedLangs) {
@@ -579,225 +559,6 @@ function computeCustomMessageTranslations(messages: any): Array {
return result
}
-function toLangWithRegion(lang: string): string {
- let langWithRegion = langToLangWithRegion.get(lang)
- if (langWithRegion == null) {
- langWithRegion = `${lang}_${lang.toUpperCase()}`
- }
- return langWithRegion
-}
-
function createMacro(name: string, lines: Array) {
return `\n!macro ${name}\n ${lines.join("\n ")}\n!macroend\n`
-}
-
-const lcid: any = {
- "af_ZA": 1078,
- "am_ET": 1118,
- "ar_AE": 14337,
- "ar_BH": 15361,
- "ar_DZ": 5121,
- "ar_EG": 3073,
- "ar_IQ": 2049,
- "ar_JO": 11265,
- "ar_KW": 13313,
- "ar_LB": 12289,
- "ar_LY": 4097,
- "ar_MA": 6145,
- "ar_OM": 8193,
- "ar_QA": 16385,
- "ar_SA": 1025,
- "ar_SY": 10241,
- "ar_TN": 7169,
- "ar_YE": 9217,
- "arn_CL": 1146,
- "as_IN": 1101,
- "az_AZ": 2092,
- "ba_RU": 1133,
- "be_BY": 1059,
- "bg_BG": 1026,
- "bn_IN": 1093,
- "bo_BT": 2129,
- "bo_CN": 1105,
- "br_FR": 1150,
- "bs_BA": 8218,
- "ca_ES": 1027,
- "co_FR": 1155,
- "cs_CZ": 1029,
- "cy_GB": 1106,
- "da_DK": 1030,
- "de_AT": 3079,
- "de_CH": 2055,
- "de_DE": 1031,
- "de_LI": 5127,
- "de_LU": 4103,
- "div_MV": 1125,
- "dsb_DE": 2094,
- "el_GR": 1032,
- "en_AU": 3081,
- "en_BZ": 10249,
- "en_CA": 4105,
- "en_CB": 9225,
- "en_GB": 2057,
- "en_IE": 6153,
- "en_IN": 18441,
- "en_JA": 8201,
- "en_MY": 17417,
- "en_NZ": 5129,
- "en_PH": 13321,
- "en_TT": 11273,
- "en_US": 1033,
- "en_ZA": 7177,
- "en_ZW": 12297,
- "es_AR": 11274,
- "es_BO": 16394,
- "es_CL": 13322,
- "es_CO": 9226,
- "es_CR": 5130,
- "es_DO": 7178,
- "es_EC": 12298,
- "es_ES": 3082,
- "es_GT": 4106,
- "es_HN": 18442,
- "es_MX": 2058,
- "es_NI": 19466,
- "es_PA": 6154,
- "es_PE": 10250,
- "es_PR": 20490,
- "es_PY": 15370,
- "es_SV": 17418,
- "es_UR": 14346,
- "es_US": 21514,
- "es_VE": 8202,
- "et_EE": 1061,
- "eu_ES": 1069,
- "fa_IR": 1065,
- "fi_FI": 1035,
- "fil_PH": 1124,
- "fo_FO": 1080,
- "fr_BE": 2060,
- "fr_CA": 3084,
- "fr_CH": 4108,
- "fr_FR": 1036,
- "fr_LU": 5132,
- "fr_MC": 6156,
- "fy_NL": 1122,
- "ga_IE": 2108,
- "gbz_AF": 1164,
- "gl_ES": 1110,
- "gsw_FR": 1156,
- "gu_IN": 1095,
- "ha_NG": 1128,
- "he_IL": 1037,
- "hi_IN": 1081,
- "hr_BA": 4122,
- "hr_HR": 1050,
- "hu_HU": 1038,
- "hy_AM": 1067,
- "id_ID": 1057,
- "ii_CN": 1144,
- "is_IS": 1039,
- "it_CH": 2064,
- "it_IT": 1040,
- "iu_CA": 2141,
- "ja_JP": 1041,
- "ka_GE": 1079,
- "kh_KH": 1107,
- "kk_KZ": 1087,
- "kl_GL": 1135,
- "kn_IN": 1099,
- "ko_KR": 1042,
- "kok_IN": 1111,
- "ky_KG": 1088,
- "lb_LU": 1134,
- "lo_LA": 1108,
- "lt_LT": 1063,
- "lv_LV": 1062,
- "mi_NZ": 1153,
- "mk_MK": 1071,
- "ml_IN": 1100,
- "mn_CN": 2128,
- "mn_MN": 1104,
- "moh_CA": 1148,
- "mr_IN": 1102,
- "ms_BN": 2110,
- "ms_MY": 1086,
- "mt_MT": 1082,
- "my_MM": 1109,
- "nb_NO": 1044,
- "ne_NP": 1121,
- "nl_BE": 2067,
- "nl_NL": 1043,
- "nn_NO": 2068,
- "ns_ZA": 1132,
- "oc_FR": 1154,
- "or_IN": 1096,
- "pa_IN": 1094,
- "pl_PL": 1045,
- "ps_AF": 1123,
- "pt_BR": 1046,
- "pt_PT": 2070,
- "qut_GT": 1158,
- "quz_BO": 1131,
- "quz_EC": 2155,
- "quz_PE": 3179,
- "rm_CH": 1047,
- "ro_RO": 1048,
- "ru_RU": 1049,
- "rw_RW": 1159,
- "sa_IN": 1103,
- "sah_RU": 1157,
- "se_FI": 3131,
- "se_NO": 1083,
- "se_SE": 2107,
- "si_LK": 1115,
- "sk_SK": 1051,
- "sl_SI": 1060,
- "sma_NO": 6203,
- "sma_SE": 7227,
- "smj_NO": 4155,
- "smj_SE": 5179,
- "smn_FI": 9275,
- "sms_FI": 8251,
- "sq_AL": 1052,
- "sr_BA": 7194,
- "sr_SP": 3098,
- "sv_FI": 2077,
- "sv_SE": 1053,
- "sw_KE": 1089,
- "syr_SY": 1114,
- "ta_IN": 1097,
- "te_IN": 1098,
- "tg_TJ": 1064,
- "th_TH": 1054,
- "tk_TM": 1090,
- "tmz_DZ": 2143,
- "tn_ZA": 1074,
- "tr_TR": 1055,
- "tt_RU": 1092,
- "ug_CN": 1152,
- "uk_UA": 1058,
- "ur_IN": 2080,
- "ur_PK": 1056,
- "uz_UZ": 2115,
- "vi_VN": 1066,
- "wen_DE": 1070,
- "wo_SN": 1160,
- "xh_ZA": 1076,
- "yo_NG": 1130,
- "zh_CHS": 4,
- "zh_CHT": 31748,
- "zh_CN": 2052,
- "zh_HK": 3076,
- "zh_MO": 5124,
- "zh_SG": 4100,
- "zh_TW": 1028,
- "zu_ZA": 1077
-}
-
-// "el_GR" "lv_LV" "ko_KR" "tr_TR"
-const bundledLanguages = ["en_US", "de_DE", "fr_FR", "es_ES", "zh_CN", "zh_TW", "ja_JP", "it_IT", "nl_NL", "ru_RU", "pl_PL", "uk_UA", "cs_CZ", "sv_SE", "nb_NO", "da_DK", "pt_PT"]
-const langToLangWithRegion = new Map()
-for (const id of bundledLanguages) {
- langToLangWithRegion.set(id.substring(0, id.indexOf("_")), id)
}
\ No newline at end of file
diff --git a/packages/electron-builder/templates/dmg/license.txt b/packages/electron-builder/templates/dmg/license.txt
new file mode 100644
index 00000000000..7c958c67bdd
--- /dev/null
+++ b/packages/electron-builder/templates/dmg/license.txt
@@ -0,0 +1,280 @@
+data 'TMPL' (128, "LPic") {
+ $"1344 6566 6175 6C74 204C 616E 6775 6167"
+ $"6520 4944 4457 5244 0543 6F75 6E74 4F43"
+ $"4E54 042A 2A2A 2A4C 5354 430B 7379 7320"
+ $"6C61 6E67 2049 4444 5752 441E 6C6F 6361"
+ $"6C20 7265 7320 4944 2028 6F66 6673 6574"
+ $"2066 726F 6D20 3530 3030 4457 5244 1032"
+ $"2D62 7974 6520 6C61 6E67 7561 6765 3F44"
+ $"5752 4404 2A2A 2A2A 4C53 5445"
+};
+
+data 'LPic' (5000) {
+ $"0000 0002 0000 0000 0000 0000 0004 0000"
+};
+
+data 'STR#' (5000, "English buttons") {
+ $"0006 0D45 6E67 6C69 7368 2074 6573 7431"
+ $"0541 6772 6565 0844 6973 6167 7265 6505"
+ $"5072 696E 7407 5361 7665 2E2E 2E7A 4966"
+ $"2079 6F75 2061 6772 6565 2077 6974 6820"
+ $"7468 6520 7465 726D 7320 6F66 2074 6869"
+ $"7320 6C69 6365 6E73 652C 2063 6C69 636B"
+ $"2022 4167 7265 6522 2074 6F20 6163 6365"
+ $"7373 2074 6865 2073 6F66 7477 6172 652E"
+ $"2020 4966 2079 6F75 2064 6F20 6E6F 7420"
+ $"6167 7265 652C 2070 7265 7373 2022 4469"
+ $"7361 6772 6565 2E22"
+};
+
+data 'STR#' (5001, "German") {
+ $"0006 0744 6575 7473 6368 0B41 6B7A 6570"
+ $"7469 6572 656E 0841 626C 6568 6E65 6E07"
+ $"4472 7563 6B65 6E0A 5369 6368 6572 6E2E"
+ $"2E2E E74B 6C69 636B 656E 2053 6965 2069"
+ $"6E20 D241 6B7A 6570 7469 6572 656E D32C"
+ $"2077 656E 6E20 5369 6520 6D69 7420 6465"
+ $"6E20 4265 7374 696D 6D75 6E67 656E 2064"
+ $"6573 2053 6F66 7477 6172 652D 4C69 7A65"
+ $"6E7A 7665 7274 7261 6773 2065 696E 7665"
+ $"7273 7461 6E64 656E 2073 696E 642E 2046"
+ $"616C 6C73 206E 6963 6874 2C20 6269 7474"
+ $"6520 D241 626C 6568 6E65 6ED3 2061 6E6B"
+ $"6C69 636B 656E 2E20 5369 6520 6B9A 6E6E"
+ $"656E 2064 6965 2053 6F66 7477 6172 6520"
+ $"6E75 7220 696E 7374 616C 6C69 6572 656E"
+ $"2C20 7765 6E6E 2053 6965 20D2 416B 7A65"
+ $"7074 6965 7265 6ED3 2061 6E67 656B 6C69"
+ $"636B 7420 6861 6265 6E2E"
+};
+
+data 'STR#' (5002, "English") {
+ $"0006 0745 6E67 6C69 7368 0541 6772 6565"
+ $"0844 6973 6167 7265 6505 5072 696E 7407"
+ $"5361 7665 2E2E 2E7B 4966 2079 6F75 2061"
+ $"6772 6565 2077 6974 6820 7468 6520 7465"
+ $"726D 7320 6F66 2074 6869 7320 6C69 6365"
+ $"6E73 652C 2070 7265 7373 2022 4167 7265"
+ $"6522 2074 6F20 696E 7374 616C 6C20 7468"
+ $"6520 736F 6674 7761 7265 2E20 2049 6620"
+ $"796F 7520 646F 206E 6F74 2061 6772 6565"
+ $"2C20 7072 6573 7320 2244 6973 6167 7265"
+ $"6522 2E"
+};
+
+data 'STR#' (5003, "Spanish") {
+ $"0006 0745 7370 6196 6F6C 0741 6365 7074"
+ $"6172 0A4E 6F20 6163 6570 7461 7208 496D"
+ $"7072 696D 6972 0A47 7561 7264 6172 2E2E"
+ $"2EC0 5369 2065 7374 8720 6465 2061 6375"
+ $"6572 646F 2063 6F6E 206C 6F73 2074 8E72"
+ $"6D69 6E6F 7320 6465 2065 7374 6120 6C69"
+ $"6365 6E63 6961 2C20 7075 6C73 6520 2241"
+ $"6365 7074 6172 2220 7061 7261 2069 6E73"
+ $"7461 6C61 7220 656C 2073 6F66 7477 6172"
+ $"652E 2045 6E20 656C 2073 7570 7565 7374"
+ $"6F20 6465 2071 7565 206E 6F20 6573 748E"
+ $"2064 6520 6163 7565 7264 6F20 636F 6E20"
+ $"6C6F 7320 748E 726D 696E 6F73 2064 6520"
+ $"6573 7461 206C 6963 656E 6369 612C 2070"
+ $"756C 7365 2022 4E6F 2061 6365 7074 6172"
+ $"2E22"
+};
+
+data 'STR#' (5004, "French") {
+ $"0006 0846 7261 6E8D 6169 7308 4163 6365"
+ $"7074 6572 0752 6566 7573 6572 0849 6D70"
+ $"7269 6D65 720E 456E 7265 6769 7374 7265"
+ $"722E 2E2E BA53 6920 766F 7573 2061 6363"
+ $"6570 7465 7A20 6C65 7320 7465 726D 6573"
+ $"2064 6520 6C61 2070 728E 7365 6E74 6520"
+ $"6C69 6365 6E63 652C 2063 6C69 7175 657A"
+ $"2073 7572 2022 4163 6365 7074 6572 2220"
+ $"6166 696E 2064 2769 6E73 7461 6C6C 6572"
+ $"206C 6520 6C6F 6769 6369 656C 2E20 5369"
+ $"2076 6F75 7320 6E27 9074 6573 2070 6173"
+ $"2064 2761 6363 6F72 6420 6176 6563 206C"
+ $"6573 2074 6572 6D65 7320 6465 206C 6120"
+ $"6C69 6365 6E63 652C 2063 6C69 7175 657A"
+ $"2073 7572 2022 5265 6675 7365 7222 2E"
+};
+
+data 'STR#' (5005, "Italian") {
+ $"0006 0849 7461 6C69 616E 6F07 4163 6365"
+ $"7474 6F07 5269 6669 7574 6F06 5374 616D"
+ $"7061 0B52 6567 6973 7472 612E 2E2E 7F53"
+ $"6520 6163 6365 7474 6920 6C65 2063 6F6E"
+ $"6469 7A69 6F6E 6920 6469 2071 7565 7374"
+ $"6120 6C69 6365 6E7A 612C 2066 6169 2063"
+ $"6C69 6320 7375 2022 4163 6365 7474 6F22"
+ $"2070 6572 2069 6E73 7461 6C6C 6172 6520"
+ $"696C 2073 6F66 7477 6172 652E 2041 6C74"
+ $"7269 6D65 6E74 6920 6661 6920 636C 6963"
+ $"2073 7520 2252 6966 6975 746F 222E"
+};
+
+data 'STR#' (5006, "Japanese") {
+ $"0006 084A 6170 616E 6573 650A 93AF 88D3"
+ $"82B5 82DC 82B7 0C93 AF88 D382 B582 DC82"
+ $"B982 F108 88F3 8DFC 82B7 82E9 0795 DB91"
+ $"B62E 2E2E B496 7B83 5C83 7483 6783 4583"
+ $"4783 418E 6797 708B 9691 F88C 5F96 F182"
+ $"CC8F F08C 8F82 C993 AF88 D382 B382 EA82"
+ $"E98F EA8D 8782 C982 CD81 4183 5C83 7483"
+ $"6783 4583 4783 4182 F083 4383 9383 5883"
+ $"6781 5B83 8B82 B782 E982 BD82 DF82 C981"
+ $"7593 AF88 D382 B582 DC82 B781 7682 F089"
+ $"9F82 B582 C482 AD82 BE82 B382 A281 4281"
+ $"4093 AF88 D382 B382 EA82 C882 A28F EA8D"
+ $"8782 C982 CD81 4181 7593 AF88 D382 B582"
+ $"DC82 B982 F181 7682 F089 9F82 B582 C482"
+ $"AD82 BE82 B382 A281 42"
+};
+
+data 'STR#' (5007, "Dutch") {
+ $"0006 0A4E 6564 6572 6C61 6E64 7302 4A61"
+ $"034E 6565 0550 7269 6E74 0942 6577 6161"
+ $"722E 2E2E A449 6E64 6965 6E20 7520 616B"
+ $"6B6F 6F72 6420 6761 6174 206D 6574 2064"
+ $"6520 766F 6F72 7761 6172 6465 6E20 7661"
+ $"6E20 6465 7A65 206C 6963 656E 7469 652C"
+ $"206B 756E 7420 7520 6F70 2027 4A61 2720"
+ $"6B6C 696B 6B65 6E20 6F6D 2064 6520 7072"
+ $"6F67 7261 6D6D 6174 7575 7220 7465 2069"
+ $"6E73 7461 6C6C 6572 656E 2E20 496E 6469"
+ $"656E 2075 206E 6965 7420 616B 6B6F 6F72"
+ $"6420 6761 6174 2C20 6B6C 696B 7420 7520"
+ $"6F70 2027 4E65 6527 2E"
+};
+
+data 'STR#' (5008, "Swedish") {
+ $"0006 0653 7665 6E73 6B08 476F 646B 8A6E"
+ $"6E73 0641 7662 9A6A 7308 536B 7269 7620"
+ $"7574 0853 7061 7261 2E2E 2E93 4F6D 2044"
+ $"7520 676F 646B 8A6E 6E65 7220 6C69 6365"
+ $"6E73 7669 6C6C 6B6F 7265 6E20 6B6C 6963"
+ $"6B61 2070 8C20 2247 6F64 6B8A 6E6E 7322"
+ $"2066 9A72 2061 7474 2069 6E73 7461 6C6C"
+ $"6572 6120 7072 6F67 7261 6D70 726F 6475"
+ $"6B74 656E 2E20 4F6D 2044 7520 696E 7465"
+ $"2067 6F64 6B8A 6E6E 6572 206C 6963 656E"
+ $"7376 696C 6C6B 6F72 656E 2C20 6B6C 6963"
+ $"6B61 2070 8C20 2241 7662 9A6A 7322 2E"
+};
+
+data 'STR#' (5009, "Brazilian Portuguese") {
+ $"0006 1150 6F72 7475 6775 9073 2C20 4272"
+ $"6173 696C 0943 6F6E 636F 7264 6172 0944"
+ $"6973 636F 7264 6172 0849 6D70 7269 6D69"
+ $"7209 5361 6C76 6172 2E2E 2E8C 5365 2065"
+ $"7374 8720 6465 2061 636F 7264 6F20 636F"
+ $"6D20 6F73 2074 6572 6D6F 7320 6465 7374"
+ $"6120 6C69 6365 6E8D 612C 2070 7265 7373"
+ $"696F 6E65 2022 436F 6E63 6F72 6461 7222"
+ $"2070 6172 6120 696E 7374 616C 6172 206F"
+ $"2073 6F66 7477 6172 652E 2053 6520 6E8B"
+ $"6F20 6573 7487 2064 6520 6163 6F72 646F"
+ $"2C20 7072 6573 7369 6F6E 6520 2244 6973"
+ $"636F 7264 6172 222E"
+};
+
+data 'STR#' (5010, "Simplified Chinese") {
+ $"0006 1253 696D 706C 6966 6965 6420 4368"
+ $"696E 6573 6504 CDAC D2E2 06B2 BBCD ACD2"
+ $"E204 B4F2 D3A1 06B4 E6B4 A2A1 AD54 C8E7"
+ $"B9FB C4FA CDAC D2E2 B1BE D0ED BFC9 D0AD"
+ $"D2E9 B5C4 CCF5 BFEE A3AC C7EB B0B4 A1B0"
+ $"CDAC D2E2 A1B1 C0B4 B0B2 D7B0 B4CB C8ED"
+ $"BCFE A1A3 C8E7 B9FB C4FA B2BB CDAC D2E2"
+ $"A3AC C7EB B0B4 A1B0 B2BB CDAC D2E2 A1B1"
+ $"A1A3"
+};
+
+data 'STR#' (5011, "Traditional Chinese") {
+ $"0006 1354 7261 6469 7469 6F6E 616C 2043"
+ $"6869 6E65 7365 04A6 50B7 4E06 A4A3 A650"
+ $"B74E 04A6 43A6 4C06 C078 A673 A14B 50A6"
+ $"70AA 47B1 7AA6 50B7 4EA5 BBB3 5CA5 69C3"
+ $"D2B8 CCAA BAB1 F8B4 DAA1 41BD D0AB F6A1"
+ $"A7A6 50B7 4EA1 A8A5 48A6 77B8 CBB3 6EC5"
+ $"E9A1 43A6 70AA 47A4 A3A6 50B7 4EA1 41BD"
+ $"D0AB F6A1 A7A4 A3A6 50B7 4EA1 A8A1 43"
+};
+
+data 'STR#' (5012, "Danish") {
+ $"0006 0544 616E 736B 0445 6E69 6705 5565"
+ $"6E69 6707 5564 736B 7269 760A 4172 6B69"
+ $"7665 722E 2E2E 9848 7669 7320 6475 2061"
+ $"6363 6570 7465 7265 7220 6265 7469 6E67"
+ $"656C 7365 726E 6520 6920 6C69 6365 6E73"
+ $"6166 7461 6C65 6E2C 2073 6B61 6C20 6475"
+ $"206B 6C69 6B6B 6520 708C 20D2 456E 6967"
+ $"D320 666F 7220 6174 2069 6E73 7461 6C6C"
+ $"6572 6520 736F 6674 7761 7265 6E2E 204B"
+ $"6C69 6B20 708C 20D2 5565 6E69 67D3 2066"
+ $"6F72 2061 7420 616E 6E75 6C6C 6572 6520"
+ $"696E 7374 616C 6C65 7269 6E67 656E 2E"
+};
+
+data 'STR#' (5013, "Finnish") {
+ $"0006 0553 756F 6D69 0848 7976 8A6B 7379"
+ $"6E0A 456E 2068 7976 8A6B 7379 0754 756C"
+ $"6F73 7461 0954 616C 6C65 6E6E 61C9 6F48"
+ $"7976 8A6B 7379 206C 6973 656E 7373 6973"
+ $"6F70 696D 756B 7365 6E20 6568 646F 7420"
+ $"6F73 6F69 7474 616D 616C 6C61 20D5 4879"
+ $"768A 6B73 79D5 2E20 4A6F 7320 6574 2068"
+ $"7976 8A6B 7379 2073 6F70 696D 756B 7365"
+ $"6E20 6568 746F 6A61 2C20 6F73 6F69 7461"
+ $"20D5 456E 2068 7976 8A6B 7379 D52E"
+};
+
+data 'STR#' (5014, "French Canadian") {
+ $"0006 1146 7261 6E8D 6169 7320 6361 6E61"
+ $"6469 656E 0841 6363 6570 7465 7207 5265"
+ $"6675 7365 7208 496D 7072 696D 6572 0E45"
+ $"6E72 6567 6973 7472 6572 2E2E 2EBA 5369"
+ $"2076 6F75 7320 6163 6365 7074 657A 206C"
+ $"6573 2074 6572 6D65 7320 6465 206C 6120"
+ $"7072 8E73 656E 7465 206C 6963 656E 6365"
+ $"2C20 636C 6971 7565 7A20 7375 7220 2241"
+ $"6363 6570 7465 7222 2061 6669 6E20 6427"
+ $"696E 7374 616C 6C65 7220 6C65 206C 6F67"
+ $"6963 6965 6C2E 2053 6920 766F 7573 206E"
+ $"2790 7465 7320 7061 7320 6427 6163 636F"
+ $"7264 2061 7665 6320 6C65 7320 7465 726D"
+ $"6573 2064 6520 6C61 206C 6963 656E 6365"
+ $"2C20 636C 6971 7565 7A20 7375 7220 2252"
+ $"6566 7573 6572 222E"
+};
+
+data 'STR#' (5015, "Korean") {
+ $"0006 064B 6F72 6561 6E04 B5BF C0C7 09B5"
+ $"BFC0 C720 BEC8 C7D4 06C7 C1B8 B0C6 AE07"
+ $"C0FA C0E5 2E2E 2E7E BBE7 BFEB 20B0 E8BE"
+ $"E0BC ADC0 C720 B3BB BFEB BFA1 20B5 BFC0"
+ $"C7C7 CFB8 E92C 2022 B5BF C0C7 2220 B4DC"
+ $"C3DF B8A6 20B4 ADB7 AF20 BCD2 C7C1 C6AE"
+ $"BFFE BEEE B8A6 20BC B3C4 A1C7 CFBD CABD"
+ $"C3BF C02E 20B5 BFC0 C7C7 CFC1 F620 BECA"
+ $"B4C2 B4D9 B8E9 2C20 22B5 BFC0 C720 BEC8"
+ $"C7D4 2220 B4DC C3DF B8A6 20B4 A9B8 A3BD"
+ $"CABD C3BF C02E"
+};
+
+data 'STR#' (5016, "Norwegian") {
+ $"0006 054E 6F72 736B 0445 6E69 6709 496B"
+ $"6B65 2065 6E69 6708 536B 7269 7620 7574"
+ $"0A41 726B 6976 6572 2E2E 2EA3 4876 6973"
+ $"2044 6520 6572 2065 6E69 6720 6920 6265"
+ $"7374 656D 6D65 6C73 656E 6520 6920 6465"
+ $"6E6E 6520 6C69 7365 6E73 6176 7461 6C65"
+ $"6E2C 206B 6C69 6B6B 6572 2044 6520 708C"
+ $"2022 456E 6967 222D 6B6E 6170 7065 6E20"
+ $"666F 7220 8C20 696E 7374 616C 6C65 7265"
+ $"2070 726F 6772 616D 7661 7265 6E2E 2048"
+ $"7669 7320 4465 2069 6B6B 6520 6572 2065"
+ $"6E69 672C 206B 6C69 6B6B 6572 2044 6520"
+ $"708C 2022 496B 6B65 2065 6E69 6722 2E"
+};
+
diff --git a/test/out/mac/__snapshots__/dmgTest.js.snap b/test/out/mac/__snapshots__/dmgTest.js.snap
index 950a389a0bb..ab0dde8ca35 100644
--- a/test/out/mac/__snapshots__/dmgTest.js.snap
+++ b/test/out/mac/__snapshots__/dmgTest.js.snap
@@ -24,6 +24,42 @@ Object {
}
`;
+exports[`license en 1`] = `
+Object {
+ "mac": Array [
+ Object {
+ "arch": 1,
+ "file": "Test App ßW-1.1.0.dmg",
+ "safeArtifactName": "TestApp-1.1.0.dmg",
+ },
+ ],
+}
+`;
+
+exports[`license ru 1`] = `
+Object {
+ "mac": Array [
+ Object {
+ "arch": 1,
+ "file": "Test App ßW-1.1.0.dmg",
+ "safeArtifactName": "TestApp-1.1.0.dmg",
+ },
+ ],
+}
+`;
+
+exports[`multi language license 1`] = `
+Object {
+ "mac": Array [
+ Object {
+ "arch": 1,
+ "file": "Test App ßW-1.1.0.dmg",
+ "safeArtifactName": "TestApp-1.1.0.dmg",
+ },
+ ],
+}
+`;
+
exports[`no Applications link 1`] = `
Array [
Object {
diff --git a/test/src/mac/dmgTest.ts b/test/src/mac/dmgTest.ts
index 3c1bb0cca0d..ce01dcfed77 100644
--- a/test/src/mac/dmgTest.ts
+++ b/test/src/mac/dmgTest.ts
@@ -2,7 +2,7 @@ import BluebirdPromise from "bluebird-lst"
import { Platform } from "electron-builder"
import { PlatformPackager } from "electron-builder/out/platformPackager"
import { attachAndExecute } from "electron-builder/out/targets/dmg"
-import { copy, remove } from "fs-extra-p"
+import { copy, remove, writeFile } from "fs-extra-p"
import * as path from "path"
import { assertThat } from "../helpers/fileAssert"
import { app, assertPack } from "../helpers/packTester"
@@ -148,4 +148,35 @@ test.ifAll.ifMac("disable dmg icon (light), bundleVersion", () => {
return true
},
})
-})
\ No newline at end of file
+})
+
+test.ifAll("multi language license", app({
+ targets: Platform.MAC.createTarget("dmg"),
+}, {
+ projectDirCreated: projectDir => {
+ return BluebirdPromise.all([
+ writeFile(path.join(projectDir, "build", "license_en.txt"), "Hi"),
+ writeFile(path.join(projectDir, "build", "license_ru.txt"), "Привет"),
+ ])
+ },
+}))
+
+test.ifAll.ifMac("license ru", app({
+ targets: Platform.MAC.createTarget("dmg"),
+}, {
+ projectDirCreated: projectDir => {
+ return BluebirdPromise.all([
+ writeFile(path.join(projectDir, "build", "license_ru.txt"), "Привет".repeat(12)),
+ ])
+ },
+}))
+
+test.ifAll.ifMac("license en", app({
+ targets: Platform.MAC.createTarget("dmg"),
+}, {
+ projectDirCreated: projectDir => {
+ return BluebirdPromise.all([
+ writeFile(path.join(projectDir, "build", "license_ru.txt"), "Hi\n".repeat(12)),
+ ])
+ },
+}))
\ No newline at end of file