mirror of
https://github.com/nezhahq/nezha.git
synced 2025-01-23 05:08:13 -05:00
24 lines
545 B
Go
24 lines
545 B
Go
package singleton
|
|
|
|
import (
|
|
"github.com/BurntSushi/toml"
|
|
"github.com/nicksnyder/go-i18n/v2/i18n"
|
|
"golang.org/x/text/language"
|
|
)
|
|
|
|
var Localizer *i18n.Localizer
|
|
|
|
func InitLocalizer() {
|
|
bundle := i18n.NewBundle(language.Chinese)
|
|
bundle.RegisterUnmarshalFunc("toml", toml.Unmarshal)
|
|
_, err := bundle.LoadMessageFile("resource/l10n/" + Conf.Language + ".toml")
|
|
if err != nil {
|
|
panic(err)
|
|
}
|
|
_, err = bundle.LoadMessageFile("resource/l10n/zh-CN.toml")
|
|
if err != nil {
|
|
panic(err)
|
|
}
|
|
Localizer = i18n.NewLocalizer(bundle, Conf.Language)
|
|
}
|