Code Monkey home page Code Monkey logo

gt's Introduction

gt

The OpenAI GPT model allows for easy access to language translation from the command line with a personal touch.

Installation

You can install gt by running the following command in your terminal.

curl -fsSL https://raw.githubusercontent.com/fukumone/gt/main/install.sh | sh -

Or, please download the binary that is compatible with your OS from here.

Usage

1. API key configuration

Get your API key from OpenAI by setting the OPENAI_API_KEY environment variable.

Example: export OPENAI_API_KEY=xxxxx

For more information, visit the provided link.

2. Specifying the translation language

To set the language you want to translate, use the -l option in the options and specify the language.

For example, gt -t "Hello" -l Japanese

If there is no value, it will be translated into English by default.

You can also specify it by setting a value in the environment variable GT_LANGUAGE.

For example, export GT_LANGUAGE=Japanese && gt -t "Hello"

3. Execute

Try it out by opening the command line and typing gt -t "Hello!" -l Japanese

example

# Translated from English to French
$ gt -t "I love Tokyo greatly, it is wonderful to be here." -l French
# => J'aime Tokyo grandement, c'est merveilleux d'être ici.

# Translated from Spanish to Arabic
$ gt -t "Me gusta mucho Tokio; es maravilloso estar aquí." -l Arabic
# => الحب لطوكيو كثيرا؛ هو مدهش أن نكون هنا.

# Translated from Japanese to Italian
$ gt -t "私は東京がとても好きです。素晴らしいところです。" -l Italian
# => Mi piace molto Tokyo. È un posto meraviglioso.

# Translated from Mandarin to Portuguese
$ gt -t "我深深地爱上了东京,来到这里真是太美妙了。" -l Portuguese
# => Eu me apaixonei profundamente por Tóquio, e estar aqui é realmente maravilhoso.

Also, you can check the usage with the help command.

$ gt -t -help

Translates text

Usage: gt {translate|-t} [OPTIONS] <TEXT>

Arguments:
  <TEXT>  Text to translate

Options:
  -l, --language <LANGUAGE>  Language to use [default: English]
  -h, --help                 Print help

License

This project is open-sourced under the MIT license. See the License file for more information.

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.