Documentation
¶
Index ¶
Constants ¶
This section is empty.
Variables ¶
This section is empty.
Functions ¶
This section is empty.
Types ¶
type Config ¶
type Config struct {
Host string
URI string
AppID string
Secret string
APIKey string
FromLang string
ToLang string
HTTPProto string
}
Config 配置结构体(用于结构体方式初始化)
type Trans ¶
type Trans interface {
Translate(text string) (string, error)
TranslateWithResult(text string) (*TranslationResult, error)
Extract(result string) (*TranslationResult, error)
}
Trans 翻译接口
type TranslationResult ¶
type TranslationResult struct {
Source string `json:"src"` // 源文本
Target string `json:"dst"` // 翻译结果
}
TranslationResult 翻译结果结构体
type Translator ¶
type Translator = Trans
Translator 是 Trans 的向后兼容别名(v1.0.0 之前包名为 translator)。 推荐直接使用 trans.Trans / trans.New。
Click to show internal directories.
Click to hide internal directories.