@mango-scripts/i18n-scripts

2.0.2 • Public • Published

@mango-scripts/i18n-scripts

mango-i18n-system 自动国际化文案配置系统的辅助插件合集,用于下载语言包、转换vue文件等

NPM version Node version NPM Downloads License

安装

pnpm add @mango-scripts/i18n-scripts -D

注意:这是一个 纯ESM包

使用

在项目 package.jsonscripts 增加脚本命令

updateLocale

从国际化文案配置系统下载语言包文件并进行对比和梳理

{
  "scripts": {
    "updateLocale": "i18n-scripts updateLocale --address <url> --output <dirPath> --localeList <locale...>"
  }
}
Options:
  -a, --address <url>           国际化文案配置系统接口地址
  -o, --output <dirPath>        语言包的存放目录路径
  -l, --localeList [locale...]  需要下载的语言包列表

例如:

{
  "scripts": {
    "updateLocale": "i18n-scripts updateLocale --address http://xxx:5003/api/locale/get_locale_map --output ./src/locales/common/ --localeList zh-CN en-US id-ID"
  }
}

insertI18n

vue 文件添加 $t('xxx') 国际化 i18n 标识

{
  "scripts": {
    "insertI18n": "i18n-scripts insertI18n --input <dirPath> --output <dirPath> --localeModulesStr <string>"
  }
}
Options:
  -i, --input <dirPath>            输入目录路径
  -o, --output <dirPath>           输出目录路径
  -l, --localeModulesStr <string>  国际化文案模块字段

例如:

{
  "scripts": {
    "insertI18n": "i18n-scripts insertI18n --input ./src/source -output ./src/target -localeModulesStr 需求1"
  }
}

License

MIT

Package Sidebar

Install

npm i @mango-scripts/i18n-scripts

Weekly Downloads

42

Version

2.0.2

License

MIT

Unpacked Size

22.5 kB

Total Files

13

Last publish

Collaborators

  • albertlin0923