ehr-i18n-plugin

0.0.6 • Public • Published

ehr-i18n-plugin

Install

使用 npm:

npm install --save-dev ehr-i18n-plugin

or using yarn:

yarn add ehr-i18n-plugin --dev

Use

共有两种办法执行 ehr-i18n-plugin

需要转换的文件路径 输出的文件路径是必填的

  1. 利用命令行
  • 执行翻译命令
  ehr-i18n-plugin -e [path] -o [path] -x [path] -l [localeNames]
  • 执行打包成 excel 命令
ehr-i18n-plugin -o [path] -p
  1. 在根目录下新建配置文件 ehr-i18n-plugin.config.js
module.exports = () => ({
  entry: "需要转换的文件路径",
  output: "输出的文件路径",
   //排除的文件(类型是数组) 
  exclude: [],
  //可以自定义随机字符串,第一个参数是当前文件的路径
  randomFuc: (filePath) => `${filePath.split('/').pop()}-${Math.random()}`,
  locales: 'zh_CN,pt_PT,en_US'
  // locales: ['zh_CN', 'pt_PT', 'en_US']
})

已办

  • [ ] 替换情况
    • js
      • [x] 对象中的中文字符串
      • [x] 方法中的中文传参
      • [x] 模板字符串(包含简单变量)
    • react
      • [x] react中的中文属性
      • [x] react中的中文内容
    • vue(待补充)
  • [ ] excel
    • [x] 翻译词条文件转换为 excel
  • [x] 替换后文件格式化(babel-generator还原的代码格式有很大的问题,由此引入 prettier 对生成的代码进行格式化)

Readme

Keywords

Package Sidebar

Install

npm i ehr-i18n-plugin

Weekly Downloads

1

Version

0.0.6

License

ISC

Unpacked Size

440 kB

Total Files

32

Last publish

Collaborators

  • itiswell