✨ Support setting the installer language
This commit is contained in:
3
bin/cli.ts
vendored
3
bin/cli.ts
vendored
@@ -52,6 +52,9 @@ program
|
||||
.addOption(
|
||||
new Option('--system-tray-icon <string>', 'Custom system tray icon').default(DEFAULT.systemTrayIcon).hideHelp(),
|
||||
)
|
||||
.addOption(
|
||||
new Option('--installer-language <string>', 'Installer language').default(DEFAULT.installerLanguage).hideHelp(),
|
||||
)
|
||||
.version(packageJson.version, '-v, --version', 'Output the current version')
|
||||
.action(async (url: string, options: PakeCliOptions) => {
|
||||
await checkUpdateTips();
|
||||
|
||||
1
bin/defaults.ts
vendored
1
bin/defaults.ts
vendored
@@ -19,6 +19,7 @@ export const DEFAULT_PAKE_OPTIONS: PakeCliOptions = {
|
||||
debug: false,
|
||||
inject: [],
|
||||
safeDomain: [],
|
||||
installerLanguage: 'en-US',
|
||||
};
|
||||
|
||||
// Just for cli development
|
||||
|
||||
2
bin/helpers/merge.ts
vendored
2
bin/helpers/merge.ts
vendored
@@ -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,7 @@ export async function mergeConfig(url: string, options: PakeAppOptions, tauriCon
|
||||
|
||||
tauriConf.package.productName = name;
|
||||
tauriConf.tauri.bundle.identifier = identifier;
|
||||
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);
|
||||
|
||||
3
bin/types.ts
vendored
3
bin/types.ts
vendored
@@ -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 {
|
||||
|
||||
5
dist/cli.js
vendored
5
dist/cli.js
vendored
@@ -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,7 @@ async function mergeConfig(url, options, tauriConf) {
|
||||
Object.assign(tauriConf.pake.windows[0], { url, ...tauriConfWindowOptions });
|
||||
tauriConf.package.productName = name;
|
||||
tauriConf.tauri.bundle.identifier = identifier;
|
||||
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 +846,7 @@ const DEFAULT_PAKE_OPTIONS = {
|
||||
debug: false,
|
||||
inject: [],
|
||||
safeDomain: [],
|
||||
installerLanguage: 'en-US',
|
||||
};
|
||||
|
||||
async function checkUpdateTips() {
|
||||
@@ -1041,6 +1043,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 <string>', 'Custom system tray icon').default(DEFAULT_PAKE_OPTIONS.systemTrayIcon).hideHelp())
|
||||
.addOption(new Option('--installer-language <string>', 'Installer language').default(DEFAULT_PAKE_OPTIONS.installerLanguage).hideHelp())
|
||||
.version(packageJson.version, '-v, --version', 'Output the current version')
|
||||
.action(async (url, options) => {
|
||||
await checkUpdateTips();
|
||||
|
||||
Reference in New Issue
Block a user