GithubHelp home page GithubHelp logo

shell_translate's Introduction

使用于shell的翻译


  • 暂时封装了对百度翻译的api调用
  • 支持对管道输入与传参输入
    • 管道输入暂时仅支持 stdin

安装

  1. 克隆获取下载 translate.py 到您的设备 /usr/bin/translate.py
  2. 赋予执行权限 sudo chmod 744 /usr/bin/translate.py
  3. 将 以下内容添加到您的 ~/.bashrc
    # 百度的appid 与 key请通过https://fanyi-api.baidu.com/manage/developer 获取
    export SHELL_TRANSLATE_APPID="你的 APPID"
    export SHELL_TRANSLATE_KEY="你的密钥"
  4. 执行刷新 source ~/.bashrc

使用

  • 通过管道输入 echo "hello world" | translate.py
  • 通过传参输入 translate.py "hello world"
    $ echo "hello world" | translate.py
    hello world
    你好,世界
  • 翻译整个帮助
    $ docker -h | translate.py
    
    Usage:  docker [OPTIONS] COMMAND
    用法:docker[OPTIONS]COMMAND
      A self-sufficient runtime for containers
      容器的自给自足运行时
      Options:
      选项:
    ...

shell_translate's People

Contributors

ymcy avatar

Stargazers

 avatar

Watchers

 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.