i18n

package
v0.0.0-...-6bd982c Latest Latest
Warning

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

Go to latest
Published: Apr 9, 2024 License: MIT Imports: 10 Imported by: 0

Documentation

Index

Constants

View Source
const (
	MSG_WEBHOOK_VERSION        = "WEBHOOK_VERSION"
	MSG_SETUID_OR_SETGID_ERROR = "ERROR_SETUID_OR_SETGID"
	MSG_SERVER_IS_STARTING     = "SERVER_IS_STARTING"

	ERR_SERVER_LISTENING_PORT       = "ERRPR_SERVER_LISTENING_PORT"
	ERR_SERVER_LISTENING_PRIVILEGES = "ERRPR_SERVER_LISTENING_PRIVILEGES"
	ERR_SERVER_OPENING_LOG_FILE     = "ERROR_SERVER_OPENING_LOG_FILE"
	ERR_CREATING_PID_FILE           = "ERROR_CREATING_PID_FILE"
	ERR_COULD_NOT_LOAD_ANY_HOOKS    = "ERROR_COULD_NOT_LOAD_ANY_HOOKS"
)

Variables

View Source
var GLOBAL_LANG string
View Source
var GLOBAL_LOCALES map[string]WebHookLocalizer

Functions

func GetMessage

func GetMessage(messageID string) string

func InitLocaleByFiles

func InitLocaleByFiles(aliveLocales []WebHookLocales) (bundleMaps map[string]WebHookLocalizer)

func Println

func Println(messageID string, a ...any)

func SetGlobalLocale

func SetGlobalLocale(lang string)

func Sprintf

func Sprintf(messageID string, a ...any) string

Types

type WebHookLocales

type WebHookLocales struct {
	FileName string
	Name     string
	Content  []byte
}

func GetWebHookLocaleObject

func GetWebHookLocaleObject(fileName string, content []byte) (result WebHookLocales, err error)

func LoadLocaleFiles

func LoadLocaleFiles(localesDir string, webhookLocalesEmbed embed.FS) (aliveLocales []WebHookLocales)

get alive locales

type WebHookLocalizer

type WebHookLocalizer struct {
	FileName  string
	Name      string
	Bundle    *i18n.Bundle
	Localizer *i18n.Localizer
}

Jump to

Keyboard shortcuts

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