xfanyibaidu

package
v0.3.11 Latest Latest
Warning

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

Go to latest
Published: May 11, 2024 License: BSD-3-Clause-Clear Imports: 5 Imported by: 0

Documentation

Overview

百度翻译

Index

Constants

This section is empty.

Variables

This section is empty.

Functions

func Regedit

func Regedit(c *Config)

配置项注入

c	待注入的配置项

func SwitchExceedStop

func SwitchExceedStop(c bool)

切换ExceedStop状态为传入状态

c	要切换成什么状态

func SwitchNowSize

func SwitchNowSize(c uint64)

设置当前字节量

c	当前已使用字节量

func Translate

func Translate(src, from, to string) ([]string, error)

通用文本翻译

src		待翻译的文本
from	来源语种
to		待翻译为的语种

func TranslateZh

func TranslateZh(src string) ([]string, error)

自动翻译为中文

src	待翻译的文本

Types

type AccountInfos

type AccountInfos struct {
	AppId      string `json:"appid"`       // 账户APPID
	FreeSize   uint64 `json:"free_size"`   // 免费字符量
	ExceedStop bool   `json:"exceed_stop"` // 超出免费字符量后是否停止翻译
	NowSize    uint64 `json:"now_size"`    // 当前已使用翻译字符量
}

当前账户详情信息【不含AppSec等敏感信息】

func Info

func Info() *AccountInfos

获取当前账户的详细信息

type Config

type Config struct {
	Domain     string // 百度翻译的域名前缀
	AppId      string // 百度开发者平台的AppId(需开通翻译功能)
	SecretKey  string // 百度开发者平台的密钥信息(需开通翻译功能)
	FreeSize   uint64 // 免费翻译的字符量
	ExceedStop bool   // 超出免费翻译字符量以后是否停止翻译

	NowFunc func(now uint64) // 已用字符量统计回调
	// contains filtered or unexported fields
}

配置项信息

Jump to

Keyboard shortcuts

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