tran

package module
v1.0.1 Latest Latest
Warning

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

Go to latest
Published: Oct 12, 2020 License: MIT Imports: 13 Imported by: 0

README

GO-TRAN (Command line Translator in Golang)

Installation

$ go get github.com/y-bash/go-tran
$ cd $GOPATH/src/github.com/y-bash/go-tran
$ go install ./...

Usage

Interactive interface
Translation
Changing Target Language
Finding ISO639-1 Language codes
Batch interface
Standard Input
Translate a File

License

This software is released under the MIT License, see LICENSE.

Author

y-bash

Documentation

Index

Constants

This section is empty.

Variables

This section is empty.

Functions

func CurrentLang

func CurrentLang() (code, name string)

func LookupLangCode added in v1.0.1

func LookupLangCode(s string) (code, name string, ok bool)

func LookupPlang

func LookupPlang(lang string) (code, name string, ok bool)

func Ptranslate

func Ptranslate(text, target string) (translated string, ok bool)

Types

type Endpoint added in v1.0.1

type Endpoint string

func DefaultAPI added in v1.0.1

func DefaultAPI() Endpoint

func NewAPI added in v1.0.1

func NewAPI(url string) Endpoint

func (Endpoint) CurrentLang added in v1.0.1

func (ep Endpoint) CurrentLang() (code, name string)

func (Endpoint) LangListContains added in v1.0.1

func (ep Endpoint) LangListContains(substr string) ISO639List

func (Endpoint) LookupLang added in v1.0.1

func (ep Endpoint) LookupLang(s string) (code, name string, ok bool)

func (Endpoint) Translate added in v1.0.1

func (ep Endpoint) Translate(text, source, target string) (string, error)

type ISO639

type ISO639 struct {
	Code string
	Name string
}

func (*ISO639) String

func (l *ISO639) String() string

type ISO639List

type ISO639List []*ISO639

func AllLangList added in v1.0.1

func AllLangList() ISO639List

func (ISO639List) String

func (a ISO639List) String() string

type TransData

type TransData struct {
	Code    int    `json:"code"`
	Text    string `json:"text"`
	Message string `json:"message"`
}

Directories

Path Synopsis
cmd

Jump to

Keyboard shortcuts

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