i18n

package
v0.0.0-...-68b20d9 Latest Latest
Warning

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

Go to latest
Published: Nov 8, 2023 License: Apache-2.0 Imports: 10 Imported by: 0

Documentation

Index

Constants

View Source
const (
	AgentAlertNotify = "agentclient.alert.notify"
	AgentAlertWarn   = "agentclient.alert.warn"
	AgentAlertError  = "agentclient.alert.error"
	AgentAlertSystem = "agentclient.alert.system_alert"
	AgentAlertDriver = "agentclient.alert.driver_alert"

	LicenseAlertExpire = "agentclient.alert.license_alert"

	DefaultSuccess                       = "default.success"
	DefaultFail                          = "default.fail"
	LibraryUpgradeDownloadResp           = "library.upgrade_download"           // 驱动库下载结果
	ServiceRunStatusResp                 = "service.run_status"                 // 驱动实例运行结果
	AppServiceLibraryUpgradeDownloadResp = "appServiceLibrary.upgrade_download" //三方服务下载结果
	AppServiceRunStatusResp              = "appService.run_status"              // 三方服务实例运行结果
	AppServiceDeleteResp                 = "appService.delete"                  // 三方服务实例运行结果
	CloudInstanceLogResp                 = "cloudInstance.log_status"           // 云服务日志状态

)
View Source
const (
	ContentType     = "Content-Type"
	ContentTypeCBOR = "application/cbor"
	ContentTypeJSON = "application/json"
	ContentTypeYAML = "application/x-yaml"
	ContentTypeText = "text/plain"
	ContentTypeXML  = "application/xml"
	AcceptLanguage  = "Accept-Language"
)

Variables

This section is empty.

Functions

func GetLang

func GetLang(ctx context.Context) string

func I18nHandlerGin

func I18nHandlerGin() gin.HandlerFunc

I18nHandlerGin 设置语言

func Trans

func Trans(lang string, messageId string, params map[string]interface{}) string

常量的翻译 Trans("en", "device.name", nil)

func TransCode

func TransCode(ctx context.Context, code uint32, params map[string]interface{}) string

错误码的翻译 TransCode("en",10001, nil)

func TransCodeDefault

func TransCodeDefault(code uint32, params map[string]interface{}) string

TransCodeDefault 错误码转换, 用于告警显示, 只显示英文错误信息

Types

This section is empty.

Directories

Path Synopsis

Jump to

Keyboard shortcuts

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