i18nPackKit

package
v3.0.52 Latest Latest
Warning

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

Go to latest
Published: Apr 12, 2024 License: Apache-2.0 Imports: 8 Imported by: 0

Documentation

Index

Constants

This section is empty.

Variables

View Source
var (
	NotSetupError = errorKit.Newf("haven’t been set up correctly")
)

Functions

func Associate added in v3.0.21

func Associate(messageFile *i18n.MessageFile, languageCodes ...string) error

Associate 关联其他语言代码.

@param languageCode 语言代码,(1) 可参考: i18nKit/_info.md

(2) 大小写“不敏感”

func LoadMessageFile added in v3.0.20

func LoadMessageFile(path string) (*i18n.MessageFile, error)

func LoadMessageFileBytes added in v3.0.20

func LoadMessageFileBytes(content []byte, path string) (*i18n.MessageFile, error)

func Pack

func Pack(langs []string, code string, data interface{}, msgArgs ...interface{}) interface{}

func PackFully

func PackFully(langs []string, code, msg string, data interface{}, msgArgs ...interface{}) interface{}

func Seal

func Seal(langs []string, code string, data interface{}, msgArgs ...interface{}) (string, error)

func SealFully

func SealFully(langs []string, code, msg string, data interface{}, msgArgs ...interface{}) (string, error)

func SetUp

func SetUp(defaultLanguage language.Tag, maker BeanMaker)

Types

type BeanMaker

type BeanMaker func(code, msg string, data interface{}) interface{}

BeanMaker

@return (1) 返回值是一个结构体实例指针
		(2) 结构体建议加上json tag

Jump to

Keyboard shortcuts

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