multi-translate-shell

command module
v0.0.0-...-1074316 Latest Latest
Warning

This package is not in the latest version of its module.

Go to latest
Published: Nov 14, 2018 License: MIT Imports: 4 Imported by: 0

README

multi translation tool by golang

Demo

demo

Build

This service use Google Translation API.

You need signup GCP account, and enable the Cloud Translation API for your project. Read this article : https://cloud.google.com/translate/docs/quickstart-client-libraries.

export GOOGLE_APPLICATION_CREDENTIALS=/path/to/gcloud-auth.json

Install

go get -u github.com/tomoyamachi/multi-translate-shell

Package dependencies

$ go get github.com/marcusolsson/tui-go
$ go get cloud.google.com/go/translate
$ go get github.com/atotto/clipboard

Extending using languages

You can add languages to main.go and run go build. Here is usable ISO-639-1 code.

languages = []translator.TranslateLanguage{
    // {from language code, to language code}
	{"de", "en"},
	{"de", "ja"},
	...
}

Shortcut

  • Alt+Enter : Execute translate
  • Ctrl+v : Paste from clipboard
  • Ctrl+c or Esc : Kill this application
  • Ctrl+a : Jump to beginning of the line.
  • Ctrl+e : Go to end of the line.
  • Ctrl+k : Delete the line.

Attention

This library doesn't use any clever algorithm for word wrapping. The wrapping is actually very naive: whenever there is whitespace or an explicit linebreak. The goal of this library is for word wrapping CLI output, so the input is typically pretty well controlled human language. Because of this, the naive approach typically works just fine.

Documentation

The Go Gopher

There is no documentation for this package.

Directories

Path Synopsis

Jump to

Keyboard shortcuts

? : This menu
/ : Search site
f or F : Jump to
y or Y : Canonical URL