Skip to content

Repository files navigation

auto-command

An efficiency tool to reduce copy and paste operations

Function

  • Support both command line interface and command usage
  • Automatic translation
    • Supports automatic generation of ant-design/pro-components (single file layer) internationalization files
    • Supports automatic generation of ant-design/ant-design-pro (directory level) internationalization files
    • Supports automatic generation of internationalization files for React Intl projects
  • Branch diff comparison and export diff file | git diff

automatic translation

Instructions

You have to configure the .autocmd.ts file

import{defineConfig}from'auto-command/lib';exportdefaultdefineConfig({translate: {// path (required): absolute or relative path to the locales fileoutDir: '/xxx/xxx/xxx/src/locales',// Whether to keep the previous translation unchanged (optional), enabled by defaultkeep: true,// type (optional): defaults to directory (antd-pro mode)type: 'dir',// Hook function (optional): custom outputhook: {filter: ()=>{},convertContent: {input: ()=>{},out: ()=>{}},handleData: ()=>{},},// Language conversion (optional): Convert from Chinese to English by default, the output file name is related to this configurationlanguage: {from: 'zh-CN',to: ['en-US'],},// Separator (optional): The default is -, if your file name is not separated by -, you need to configureseparator: '-',// Configure your .prettier.js file path (absolute path or relative path). After translation, the output file will be formatted with your configuration to avoid useless changesprettierPath: '/xxx/.prettierrc.js',// Translator type (optional): default youdaotranslatorType: 'youdao',// google translator configuration (optional): empty by defaultgoogle: {proxy: {host: '127.0.0.1',port: 7890,},},// youdao translator configuration (optional): there is a value by default, if the translation fails, the balance may be insufficient, please configureyoudao: {key: 'xxx',secret: 'xxx',},},});
$ npm i auto-command
$ npx ac
**** Please selectthe task to be performed **** (Use arrow keys)
git diff
❯ translate
or
$ npx ac -t=translate

achievement

  • 500 pieces of data translation in 4 seconds
  • 54 languages supported
  • Support configuration file prompts
  • Support for supplementary translations on already translated projects
  • Support custom delimiter
  • Support multiple translators: Google Translate (recommended abroad), Youdao Translator (recommended in China)

Branch diff comparison and export diff file

Instructions

$ npm i auto-command
$ npx ac
**** Please selectthe task to be performed **** (Use arrow keys)
❯ git diff
translate
or
$ npx ac -t=diff

In this way, you can compare two branches (by default, the current branch is compared with the master branch) and export the comparison result file

LICENSE

MIT

About

auto-command

Resources

Code of conduct

Contributing

Stars

8 stars

Watchers

1 watching

Forks

Releases

Packages

Used by

Contributors

Languages