GithubHelp home page GithubHelp logo

vue-i18n-cli's Introduction

code style: prettier

i18n(Internationalization),即国际化,在现在业务开发中是很常见的需求。一般在选择对应前端开发框架的i18n库(比如vue i18nreact-i18next)、编辑器插件的辅助(比如vscode 插件 i18n Ally)后,就可以上手开发了。然而这个过程并不轻松,在代码文件找文案、为文案生成key标识、写入翻译文件、替换源代码、和业务开发流程的分割等,都导致这是一件非常头疼的事情。

参考 alibaba/kiwi/kiwi-cli,深挖vue2.x项目场景的落地,开发了Node命令行工具vue-i18n-extract,由它来负责上述的繁琐过程。优点在于场景覆盖全,经过实际生产项目检验。

注意,vue-i18n-extract基于项目原始文案是中文文案。

功能

自动化提取:

  • 一键提取 Vue 2.x 项目中的中文,自动生成key,写入翻译json文件,在源代码替换;

导入导出:

  • 导出指定语种的待翻译文件,格式为.tsv
  • 导入指定语种的翻译完成文件,格式为.tsv

本地文案管理:

  • 输出项目中已不使用文案,支持自动化删除;
  • 输出存在未提取的中文文案的文件路径;

其他:

  • 支持多语言,不仅限于中英文;

使用上存在的问题:

  • 使用key替换源代码中的中文文案后,搜索中文文案所在位置麻烦,需要先通过文案找到key,再通过key定位具体位置;

使用说明

参见:这里!

vue-i18n-cli's People

Contributors

tttuntuntutu avatar

Stargazers

 avatar  avatar

Watchers

 avatar  avatar  avatar

Recommend Projects

  • React photo React

    A declarative, efficient, and flexible JavaScript library for building user interfaces.

  • Vue.js photo Vue.js

    🖖 Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.

  • Typescript photo Typescript

    TypeScript is a superset of JavaScript that compiles to clean JavaScript output.

  • TensorFlow photo TensorFlow

    An Open Source Machine Learning Framework for Everyone

  • Django photo Django

    The Web framework for perfectionists with deadlines.

  • D3 photo D3

    Bring data to life with SVG, Canvas and HTML. 📊📈🎉

Recommend Topics

  • javascript

    JavaScript (JS) is a lightweight interpreted programming language with first-class functions.

  • web

    Some thing interesting about web. New door for the world.

  • server

    A server is a program made to process requests and deliver data to clients.

  • Machine learning

    Machine learning is a way of modeling and interpreting data that allows a piece of software to respond intelligently.

  • Game

    Some thing interesting about game, make everyone happy.

Recommend Org

  • Facebook photo Facebook

    We are working to build community through open source technology. NB: members must have two-factor auth.

  • Microsoft photo Microsoft

    Open source projects and samples from Microsoft.

  • Google photo Google

    Google ❤️ Open Source for everyone.

  • D3 photo D3

    Data-Driven Documents codes.