gotranslate

package module
v0.0.0-...-1570485 Latest Latest
Warning

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

Go to latest
Published: Apr 26, 2018 License: Apache-2.0 Imports: 8 Imported by: 0

README

gotranslate (forked)

Usage

  • import the gotranslate package
import (
	"github.com/artificerpi/gotranslate"
)
  • Example
// auto detecting from language type
gotranslate.QuickTranslate("Hello", language.Chinese)
// output: 你好

gotranslate.QuickTranslation("Hello", language.English, language.Chinese)
// output: 你好

Original Repo

eefret/gotranslate

Documentation

Overview

Copyright 2014 Kaissersoft Inc.

Licensed under the Apache License, Version 2.0 (the "License"); you may not use this file except in compliance with the License. You may obtain a copy of the License at

http://www.apache.org/licenses/LICENSE-2.0

Unless required by applicable law or agreed to in writing, software distributed under the License is distributed on an "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. See the License for the specific language governing permissions and limitations under the License.

This package is to help all gophers out there to translate texts with
google translate for free, hope it helps a lot of people

Index

Constants

This section is empty.

Variables

This section is empty.

Functions

func QuickTranslate

func QuickTranslate(text string, to language.Tag) string

QuickTranslate translates a single text given to langs with auto detecting from language

func QuickTranslation

func QuickTranslation(text string, from, to language.Tag) string

QuickTranslation translate a single string given from and to langs

Types

type Translator

type Translator struct {
	// contains filtered or unexported fields
}

Translator is a struct that contains an origin Lang and a result Lang and saves history of the queries made

func New

func New(from, to language.Tag) (*Translator, error)

New returns a Translator struct to ease translation operations need a source Lang and a target Lang

func (*Translator) QueryHistory

func (t *Translator) QueryHistory() []string

QueryHistory returns all strings submitted to Translator

func (*Translator) ResultsHistory

func (t *Translator) ResultsHistory() []string

ResultsHistory returns all strings obtained from Translator.Translate

func (*Translator) Translate

func (t *Translator) Translate(text string) string

Translate takes a string and make the translation over the created Struct

Jump to

Keyboard shortcuts

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