fix(cli): fix failure to retrieve OS language (#851)
This commit is contained in:
parent
9c3899135b
commit
77da8a3470
@ -2,7 +2,7 @@ import type { Bundler, Langs, PromptResult } from './types.js'
|
||||
import { createRequire } from 'node:module'
|
||||
import process from 'node:process'
|
||||
import { cancel, confirm, group, select, text } from '@clack/prompts'
|
||||
import { osLocale } from 'os-locale'
|
||||
import osLocale from 'os-locale'
|
||||
import { bundlerOptions, deployOptions, DeployType, languageOptions, Mode } from './constants.js'
|
||||
import { setLang, t } from './translate.js'
|
||||
|
||||
@ -10,6 +10,15 @@ const require = createRequire(process.cwd())
|
||||
|
||||
const REG_DIR_CHAR = /[<>:"\\|?*[\]]/
|
||||
|
||||
/**
|
||||
* Prompt user for project configuration
|
||||
*
|
||||
* 提示用户输入项目配置
|
||||
*
|
||||
* @param mode - Operation mode (init or create) / 操作模式(初始化或创建)
|
||||
* @param root - Optional root directory path / 可选的根目录路径
|
||||
* @returns Resolved prompt result / 解析后的提示结果
|
||||
*/
|
||||
export async function prompt(mode: Mode, root?: string): Promise<PromptResult> {
|
||||
let hasTs = false
|
||||
if (mode === Mode.init) {
|
||||
@ -21,7 +30,7 @@ export async function prompt(mode: Mode, root?: string): Promise<PromptResult> {
|
||||
|
||||
const result: PromptResult = await group({
|
||||
displayLang: async () => {
|
||||
const locale = await osLocale()
|
||||
const locale = osLocale()
|
||||
|
||||
if (locale === 'zh-CN' || locale === 'zh-Hans') {
|
||||
setLang('zh-CN')
|
||||
|
||||
Loading…
x
Reference in New Issue
Block a user