package main import ( "testing" _ "github.com/go-sql-driver/mysql" "github.com/iapologizewhenimwrong/Vestmore_GO/translator" "github.com/iapologizewhenimwrong/Vestmore_GO/utils/log" "github.com/nicksnyder/go-i18n/v2/i18n" "github.com/pelletier/go-toml/v2" "golang.org/x/text/language" ) func TestMain(t *testing.T) { // model.Models.SetSqlxDriver("mysql", "php:aFk3i4Dj#76!4sd@tcp(47.243.100.6:3306)/zunxinfinance?parseTime=true&charset=utf8mb4&timeout=10s") // model.Models.KillaraCustomerModel.Find(context.TODO()) main() } func TestCaseZero(t *testing.T) { // lang := language.Make("zh_cn") log.Println(language.Make("zh_cn")) log.Println(language.ParseAcceptLanguage("zh_cn")) tr := i18n.NewBundle(language.Chinese) tr.RegisterUnmarshalFunc("toml", toml.Unmarshal) tr.MustLoadMessageFile("./internal/i18n/zh_cn.toml") // accept := r.Header.Get("Accept-Language") // i18n.NewLocalizer() localizer := i18n.NewLocalizer(tr, "zh_cn") log.Println(localizer.Localize(&i18n.LocalizeConfig{ MessageID: "format_account_is_insufficient", TemplateData: map[string]any{ "CatalogCurrency": "USDT", }, })) } func TestTr(t *testing.T) { log.Println(translator.Localize("账号未注册", "zh_cn", nil)) }