di18n

package
v0.9.2 Latest Latest
Warning

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

Go to latest
Published: Jan 13, 2023 License: MIT Imports: 17 Imported by: 0

Documentation

Index

Constants

View Source
const (
	//语言定于,参考标准: ISO_639-1
	ZhCN = "zh-CN" //简体中文
	EN   = "en"    //英语
	JA   = "ja"    //日语
	DE   = "de"    //德语
)

Variables

This section is empty.

Functions

func LanguageCheck

func LanguageCheck(language, def string) string

func New

func New() *i18n

Types

type BaiduTranslator

type BaiduTranslator struct {
	AppID     string
	SecretKey string
}

BaiduTranslator 百度翻译开放平台信息

func (*BaiduTranslator) Translate

func (bi *BaiduTranslator) Translate(text, from, to string) (string, error)

Translate 翻译 传入需要翻译的语句

type ITranslator

type ITranslator interface {
	Translate(text, from, to string) (string, error)
}

func NewBaiduTranslator

func NewBaiduTranslator(appID, SecretKey string) ITranslator

func NewYoudaoTranslator

func NewYoudaoTranslator(appID, SecretKey string) ITranslator

type Result

type Result struct {
	Src string `json:"src"`
	Dst string `json:"dst"`
}

type YoudaoTranslator

type YoudaoTranslator struct {
	AppID     string
	SecretKey string
}

YoudaoTranslator 有道翻译开放平台信息

func (*YoudaoTranslator) Translate

func (bi *YoudaoTranslator) Translate(text, from, to string) (string, error)

Translate 翻译 传入需要翻译的语句

Jump to

Keyboard shortcuts

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