Passport/pkg/i18n/bundle.go
2024-04-20 14:05:50 +08:00

17 lines
431 B
Go

package i18n
import (
jsoniter "github.com/json-iterator/go"
"github.com/nicksnyder/go-i18n/v2/i18n"
"golang.org/x/text/language"
)
var Bundle *i18n.Bundle
func InitInternationalization() {
Bundle = i18n.NewBundle(language.English)
Bundle.RegisterUnmarshalFunc("json", jsoniter.ConfigCompatibleWithStandardLibrary.Unmarshal)
Bundle.LoadMessageFileFS(FS, "locale.en.json")
Bundle.LoadMessageFileFS(FS, "locale.zh.json")
}