Git Product home page Git Product logo

puppet-translator's Introduction

Puppet Translator

MIT License

A Google Translate Command Line Interface
https://www.npmjs.com/package/puppet-translator

Preface

This tool translates passed text via Google Translate.

This tool internally uses Google Chrome, so it should have been installed on your system. And you should also specify the path to the chrome. It can be done via a command line option or a environment variable PUPPET_TRANSLATOR_CHROME_BIN_PATH.

It is supposed that this tool will work on every environment as long as you can browse https://translate.google.com by Google Chrome.

Requirements

  • Node.js v7.6.0+

    • This script uses async/await.

Install

$ npm install -g puppet-translator

Usage

$ puppet-translator [options]

In this form, you must specify -x or --text option which represents the text to be translated.

Or you can pass piped input to translate.

$ somme-command-which-generates-text | puppet-translator [options]

To know more, please see Options and Examples below.

Options

  • -c, --chrome string

    Path to the Google Chrome, if you omit this option, a environment variable PUPPET_TRANSLATOR_CHROME_BIN_PATH will be used instead.

  • -f, --from string

    Language code of the input text or "auto" to autodetection
    (Default: "auto")

  • -t, --to string

    Language code of the output text
    (Default: "ja")

  • -x, --text string

    Target text to translate

  • -h, --help

    Show help

Examples

  • English to Japanese

      $ puppet-translator -f en -t ja -x Hello
      こんにちは
    
  • Japanese to English

      $ puppet-translator -f ja -t en -x こんにちは
      Hello
    
  • Auto-detected-language to Japanese (pipe)

      $ echo "Hello World" | puppet-translator -f auto -t ja
      こんにちは世界
    

PUPPET_TRANSLATOR_CHROME_BIN_PATH environment variable must be defined to point a Google Chrome binary before these commands.

Otherwise you should specify it in command line via -c / --chrome option.

LICENSE

MIT License

AUTHOR

msr1k [email protected] (https://github.com/msr1k)

CHANGELOG

v1.0.3 (2019-12-12)

  • Improve error output message.

v1.0.2 (2019-12-07)

  • Support piped input.

v1.0.1 (2019-12-07)

  • Add URI encoding to the given text.

v1.0.0 (2019-12-06)

  • First release.

puppet-translator's People

Contributors

msr1k 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.