translate

package module
v0.0.0-...-9e14101 Latest Latest
Warning

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

Go to latest
Published: Mar 21, 2018 License: GPL-3.0 Imports: 10 Imported by: 0

README

CircleCI status Go Report Card

Installation

Using translate is easy. This command will install the translate executable

go get -u github.com/hankmartinez/translate/translate

Example from help

Multiple args are joined in a single phrase to translate

a simple cli for translation from google.

Usage:
   [flags]

Flags:
  -h, --help        help for this command
      --insecure    ignore certificate errors (os env property $TRANSLATE_INSECURE has priority, if present whatever the value is, 'insecure' is assigned to true)
      --sl string   source language (os env property $TRANSLATE_SL has priority) (default "en")
      --tl string   target language (os env property $TRANSLATE_TL has priority) (default "it")

      
translate Hello My Friend -> Ciao amico    
translate --tl ru Hello My Friend -> Привет мой друг

System 'Notify' (linux)

In conjunction with xsel you can set up a simple shell script called by keyboard shortcut

#!/bin/bash
SELECTION=$(xsel -o)
notify-send --icon=info "Translate: $SELECTION" "$(translate $SELECTION)"

The result:

sample

Documentation

Index

Constants

This section is empty.

Variables

This section is empty.

Functions

func Execute

func Execute()

Execute translate command

func Translate

func Translate(sl, tl, q string, httpClient *http.Client) (string, error)

Translate translates a source language 'sl' to target language 'tl' given a query 'q' If httpClient is nil http.DefaultClient will be used for requests

Types

This section is empty.

Directories

Path Synopsis

Jump to

Keyboard shortcuts

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