Skip to content

Commit

Permalink
docs: 补充汉化
Browse files Browse the repository at this point in the history
  • Loading branch information
jaw52 committed Mar 7, 2023
1 parent 4d51dca commit f53212f
Show file tree
Hide file tree
Showing 2 changed files with 19 additions and 3 deletions.
16 changes: 13 additions & 3 deletions src/index.ts
Original file line number Diff line number Diff line change
Expand Up @@ -6,7 +6,7 @@ import locales from './utils/locales'
import { transformStart } from './transformStart'

const runTransform = async () => {
const { scanPath, isGitMv } = await prompts([
const { scanPath, isGitMv, lang = 'zh' } = await prompts([
{
type: 'select',
name: 'lang',
Expand Down Expand Up @@ -41,10 +41,20 @@ const runTransform = async () => {
const needTransformList = await transformStart(scanPath.trim(), isGitMv)

if (needTransformList.length > 0) {
consola.success(`Finish ${green('to jsx')}`)
consola.success(`${locales[lang].finish} ${green('to jsx')}`)

const { show = false } = await prompts({
name: 'show',
type: 'confirm',
message: `${locales[lang].show}?`,
initial: false,
}) as { show?: boolean }

if (show)
needTransformList.forEach(item => consola.log(item))
}
else {
consola.info('No files found to be migrated')
consola.info(locales[lang].noFiles)
}
}

Expand Down
6 changes: 6 additions & 0 deletions src/utils/locales.ts
Original file line number Diff line number Diff line change
@@ -1,10 +1,16 @@
export default {
zh: {
scanPath: '请指定需要扫描的文件夹',
show: '是否展示修改结果',
noFiles: '未发现有需要迁移的文件',
finish: '完成',
isGitMv: '是否使用Git mv方式进行批量修改后缀名(Git托管的项目推荐这种方式)',
},
en: {
scanPath: 'Please specify the folder to be scanned',
show: 'Display modification results',
noFiles: 'No files found to be migrated',
finish: 'Finish',
isGitMv: 'Whether to use Git mv method to batch modify suffix names (Git managed projects recommend this method)',
},
}

0 comments on commit f53212f

Please sign in to comment.