diff --git a/packages/electron-builder/src/options/winOptions.ts b/packages/electron-builder/src/options/winOptions.ts index bb180684ad6..86f4adb7406 100644 --- a/packages/electron-builder/src/options/winOptions.ts +++ b/packages/electron-builder/src/options/winOptions.ts @@ -349,4 +349,12 @@ export interface AppXOptions extends TargetSpecificOptions { * Describes the contents of the package. The Name attribute is case-sensitive. Corresponds to [Identity.Name](https://msdn.microsoft.com/en-us/library/windows/apps/br211441.aspx). */ readonly identityName?: string | null + + /** + * List of supported languages that will be listed in the Windows Store. + * The first entry (index 0) will be the default language. + * Defaults to en-US if omitted. + * See https://docs.microsoft.com/en-us/windows/uwp/globalizing/manage-language-and-region#specify-the-supported-languages-in-the-apps-manifest + */ + readonly languages?: Array | null } diff --git a/packages/electron-builder/src/targets/appx.ts b/packages/electron-builder/src/targets/appx.ts index a6733a37bc9..6fbbaaf67a0 100644 --- a/packages/electron-builder/src/targets/appx.ts +++ b/packages/electron-builder/src/targets/appx.ts @@ -19,6 +19,8 @@ const vendorAssetsForDefaultAssets: { [key: string]: string; } = { "Wide310x150Logo.png": "SampleAppx.310x150.png", } +const DEFAULT_RESOURCE_LANG = "en-US" + export default class AppXTarget extends Target { readonly options: AppXOptions = deepAssign({}, this.packager.platformSpecificBuildOptions, this.packager.config.appx) @@ -112,7 +114,7 @@ export default class AppXTarget extends Target { case "name": return appInfo.name - + case "identityName": return this.options.identityName || appInfo.name @@ -121,7 +123,7 @@ export default class AppXTarget extends Target { case "displayName": return this.options.displayName || appInfo.productName - + case "description": return appInfo.description || appInfo.productName @@ -145,10 +147,13 @@ export default class AppXTarget extends Target { case "splashScreen": return splashScreenTag(userAssets) - + case "arch": return arch === Arch.ia32 ? "x86" : "x64" + case "resourceLanguages": + return resourceLanguageTag(this.options.languages) + default: throw new Error(`Macro ${p1} is not defined`) } @@ -157,6 +162,14 @@ export default class AppXTarget extends Target { } } +// get the resource - language tag, see https://docs.microsoft.com/en-us/windows/uwp/globalizing/manage-language-and-region#specify-the-supported-languages-in-the-apps-manifest +function resourceLanguageTag(userLanguages: Array | null | undefined): string { + if (!userLanguages || userLanguages.length == 0) + return `` + else + return userLanguages.map(lang => ``).join("\n") +} + function lockScreenTag(userAssets: Array): string { if (isDefaultAssetIncluded(userAssets, "BadgeLogo.png")) { return '' @@ -205,4 +218,4 @@ export function quoteString(s: string): string { } return `"${s.replace(/"/g, '\\"')}"` -} \ No newline at end of file +} diff --git a/packages/electron-builder/templates/appx/appxmanifest.xml b/packages/electron-builder/templates/appx/appxmanifest.xml index ee02f6604fe..f5edccccc39 100644 --- a/packages/electron-builder/templates/appx/appxmanifest.xml +++ b/packages/electron-builder/templates/appx/appxmanifest.xml @@ -15,7 +15,7 @@ ${logo} - + ${resourceLanguages}