@huohua/huohua-plugin-locale
TypeScript icon, indicating that this package has built-in type declarations

0.1.0 • Public • Published

huohua-plugin-locale

huohua-plugin-locale

火花插件 国际化组件

Build Status NPM version Downloads Standard Version styled with prettier Conventional Commits


Features

插件国际化分两个部分

  • 软件界面国际化, 所有插件的界面文字需要在 /lang/zh-cn.json 文件中,打包时需要一并打入 dist 根目录. 在代码读取 zh-cn.json 时需要调用 Locale 组件 来获取正确的 json 语言包

    const uiDir = 'D:\\widget\\lang\\'
    // D:\\widget\\lang\\zh-cn.json
    const uiJson = Locale.getUIConfigPath(uiDir)
  • 插件生成的 json 数据国际化,插件生成的数据文件与界面国际化定义规则不同,插件生成默认命名规则时/xxx.json, 国际化时需要在文件名上追加编码 如 /xxx_en-US.json ,如果编码是 zh-cn 则默认会省略

    const path = 'D:\\widget\\data.json'
    // D:\\widget\\data_en-US.json
    const actual = Locale.getContentDataPath(path)

🔧 Installation

yarn add @huohua/huohua-plugin-locale

🎓 Guides

  • 生成的语言编码均为小写
  • 默认语言为 zh-cn, 各个插件需要判断文件是否存在

🥂 License

MIT as always

Readme

Keywords

Package Sidebar

Install

npm i @huohua/huohua-plugin-locale

Weekly Downloads

0

Version

0.1.0

License

MIT

Unpacked Size

34.5 kB

Total Files

30

Last publish

Collaborators

  • twinklej
  • fangchaoyang
  • zhangmingsheng
  • dyc6666
  • baozhiguo