i18nPackKit

package
v3.0.66 Latest Latest
Warning

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

Go to latest
Published: Apr 22, 2024 License: Apache-2.0 Imports: 7 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{}

Pack

@param langs 可以为空(包括nil)

func PackFully

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

PackFully

@param langs 可以为空(包括nil)

func Seal

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

Seal

@param langs 可以为空(包括nil)

func SealFully

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

SealFully

@param langs 可以为空(包括nil)

func SetUp

func SetUp(defaultLanguage language.Tag, maker BeanMaker)

SetUp

@param maker 可以为nil

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