translate

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

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

Go to latest
Published: Mar 19, 2021 License: MIT Imports: 3 Imported by: 0

README

Installation

To install translate package you need to install Go and set your Go workspace first.

  1. The first need Go installed (version 1.12+ is required), then you can use the below Go command to install translate.
$ go get -u github.com/180909/translate
  1. Import it in your code
import "github.com/180909/translate"

Demo

$ cat example.go
package main

import (
	"fmt"
	"github.com/180909/translate"
)

func main() {
	str := translate.Translate("你好", 0)
	fmt.Print(str)
}
# run example.go
$ go run example.go

Translate

types function
0 Chinese to English
1 Chinese to Japanese
2 Chinese to Korean
3 Chinese to French
4 Chinese to Russian
5 Chinese to Spanish
6 English to Chinese
7 Japanese to Chinese
8 Korean to Chinese
9 French to Chinese
10 Russian to Chinese
11 Spanish to Chinese

Documentation

Index

Constants

This section is empty.

Variables

This section is empty.

Functions

func Translate

func Translate(str string, types int) string

Types

type Data

type Data struct {
	Type            string `json:"type"`
	ErrorCode       int    `json:"errorCode"`
	ElapsedTime     int    `json:"elapsedTime"`
	TranslateResult [][]struct {
		Src string `json:"src"`
		Tgt string `json:"tgt"`
	} `json:"translateResult"`
}

Jump to

Keyboard shortcuts

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