diff --git a/bin/README.md b/bin/README.md index 02c2d63..b7a214e 100644 --- a/bin/README.md +++ b/bin/README.md @@ -211,6 +211,14 @@ Specify the system tray icon. This is only effective when the system tray is ena --system-tray-icon ``` +#### [installer-language] + +Set the Windows Installer language. Options include `zh-CN`, `ja-JP`, More at [Tauri Document](https://tauri.app/zh-cn/v1/guides/building/windows/#internationalization). Default is `en-US`. + +```shell +--installer-language +``` + #### [use-local-file] Enable recursive copying. When the URL is a local file path, enabling this option will copy the folder containing the file specified in the URL, as well as all sub-files, to the Pake static folder. This is disabled by default. diff --git a/bin/README_CN.md b/bin/README_CN.md index e7eccda..503ac1c 100644 --- a/bin/README_CN.md +++ b/bin/README_CN.md @@ -212,6 +212,14 @@ Linux,默认为 `all`。 --system-tray-icon ``` +#### [installer-language] + +设置 Windows 安装包语言。支持 `zh-CN`、`ja-JP`,更多在 [Tauri 文档](https://tauri.app/zh-cn/v1/guides/building/windows/#internationalization)。默认为 `en-US`。 + +```shell +--installer-language +``` + #### [use-local-file] 当 `url` 为本地文件路径时,如果启用此选项,则会递归地将 `url` 路径文件所在的文件夹及其所有子文件复 diff --git a/bin/cli.ts b/bin/cli.ts index f71ec3d..a3a4081 100644 --- a/bin/cli.ts +++ b/bin/cli.ts @@ -52,6 +52,9 @@ program .addOption( new Option('--system-tray-icon ', 'Custom system tray icon').default(DEFAULT.systemTrayIcon).hideHelp(), ) + .addOption( + new Option('--installer-language ', 'Installer language').default(DEFAULT.installerLanguage).hideHelp(), + ) .version(packageJson.version, '-v, --version', 'Output the current version') .action(async (url: string, options: PakeCliOptions) => { await checkUpdateTips(); diff --git a/bin/defaults.ts b/bin/defaults.ts index 564b2f1..9613b79 100644 --- a/bin/defaults.ts +++ b/bin/defaults.ts @@ -19,6 +19,7 @@ export const DEFAULT_PAKE_OPTIONS: PakeCliOptions = { debug: false, inject: [], safeDomain: [], + installerLanguage: 'en-US', }; // Just for cli development diff --git a/bin/helpers/merge.ts b/bin/helpers/merge.ts index 0e31984..a84a907 100644 --- a/bin/helpers/merge.ts +++ b/bin/helpers/merge.ts @@ -25,6 +25,7 @@ export async function mergeConfig(url: string, options: PakeAppOptions, tauriCon resizable = true, inject, safeDomain, + installerLanguage, } = options; const { platform } = process; @@ -44,6 +45,9 @@ export async function mergeConfig(url: string, options: PakeAppOptions, tauriCon tauriConf.package.productName = name; tauriConf.tauri.bundle.identifier = identifier; + if (platform == "win32") { + tauriConf.tauri.bundle.windows.wix.language[0] = installerLanguage; + } //Judge the type of URL, whether it is a file or a website. const pathExists = await fsExtra.pathExists(url); diff --git a/bin/types.ts b/bin/types.ts index 8a5a7f7..13a3a89 100644 --- a/bin/types.ts +++ b/bin/types.ts @@ -59,6 +59,9 @@ export interface PakeCliOptions { /* the domain that can use ipc or tauri javascript sdk */ safeDomain: string[]; + + // Installer language, valid for Windows users, default is en-US + installerLanguage: string; } export interface PakeAppOptions extends PakeCliOptions { diff --git a/dist/cli.js b/dist/cli.js index f9e4d4d..427acf9 100644 --- a/dist/cli.js +++ b/dist/cli.js @@ -476,7 +476,7 @@ async function combineFiles(files, output) { } async function mergeConfig(url, options, tauriConf) { - const { width, height, fullscreen, hideTitleBar, alwaysOnTop, disabledWebShortcuts, activationShortcut, userAgent, showSystemTray, systemTrayIcon, useLocalFile, identifier, name, resizable = true, inject, safeDomain, } = options; + const { width, height, fullscreen, hideTitleBar, alwaysOnTop, disabledWebShortcuts, activationShortcut, userAgent, showSystemTray, systemTrayIcon, useLocalFile, identifier, name, resizable = true, inject, safeDomain, installerLanguage, } = options; const { platform } = process; // Set Windows parameters. const tauriConfWindowOptions = { @@ -492,6 +492,9 @@ async function mergeConfig(url, options, tauriConf) { Object.assign(tauriConf.pake.windows[0], { url, ...tauriConfWindowOptions }); tauriConf.package.productName = name; tauriConf.tauri.bundle.identifier = identifier; + if (platform == "win32") { + tauriConf.tauri.bundle.windows.wix.language[0] = installerLanguage; + } //Judge the type of URL, whether it is a file or a website. const pathExists = await fsExtra.pathExists(url); if (pathExists) { @@ -845,6 +848,7 @@ const DEFAULT_PAKE_OPTIONS = { debug: false, inject: [], safeDomain: [], + installerLanguage: 'en-US', }; async function checkUpdateTips() { @@ -1041,6 +1045,7 @@ program .hideHelp()) .addOption(new Option('--show-system-tray', 'Show system tray in app').default(DEFAULT_PAKE_OPTIONS.showSystemTray).hideHelp()) .addOption(new Option('--system-tray-icon ', 'Custom system tray icon').default(DEFAULT_PAKE_OPTIONS.systemTrayIcon).hideHelp()) + .addOption(new Option('--installer-language ', 'Installer language').default(DEFAULT_PAKE_OPTIONS.installerLanguage).hideHelp()) .version(packageJson.version, '-v, --version', 'Output the current version') .action(async (url, options) => { await checkUpdateTips();