diff --git a/packages/scripts/src/commands/git-commit.ts b/packages/scripts/src/commands/git-commit.ts index 875ea969..66dc47c1 100644 --- a/packages/scripts/src/commands/git-commit.ts +++ b/packages/scripts/src/commands/git-commit.ts @@ -16,10 +16,12 @@ interface PromptObject { * * @param gitCommitTypes * @param gitCommitScopes + * @param lang */ export async function gitCommit( gitCommitTypes: CliOption['gitCommitTypes'], - gitCommitScopes: CliOption['gitCommitScopes'] + gitCommitScopes: CliOption['gitCommitScopes'], + lang?: string ) { const typesChoices = gitCommitTypes.map(([value, msg]) => { const nameWithSuffix = `${value}:`; @@ -41,19 +43,22 @@ export async function gitCommit( { name: 'types', type: 'select', - message: 'Please select a type', + message: lang === 'en-us' ? 'Please select a type' : '请选择提交类型', choices: typesChoices }, { name: 'scopes', type: 'select', - message: 'Please select a scope', + message: lang === 'en-us' ? 'Please select a scope' : '请选择提交范围', choices: scopesChoices }, { name: 'description', type: 'text', - message: `Please enter a description (add prefix ${yellow('!')} to indicate breaking change)` + message: + lang === 'en-us' + ? `Please enter a description (add prefix ${yellow('!')} to indicate breaking change)` + : '请输入描述信息(!开头表示破坏性改动)' } ]); diff --git a/packages/scripts/src/index.ts b/packages/scripts/src/index.ts index 909dda3d..028eee70 100755 --- a/packages/scripts/src/index.ts +++ b/packages/scripts/src/index.ts @@ -18,13 +18,22 @@ interface CommandArg { /** Generate changelog by total tags */ total?: boolean; /** - * The glob pattern of dirs to cleanup + * The glob pattern of dirs to clean up * * If not set, it will use the default value * * Multiple values use "," to separate them */ cleanupDir?: string; + + /** Support for different language prompts, and the default is en-us */ + lang?: string; +} + +/** 支持的语言 */ +enum SaCliLanguage { + Chinese = 'zh-cn', + English = 'en-us' } export async function setupCli() { @@ -44,6 +53,10 @@ export async function setupCli() { '-c, --cleanupDir