Vestmore_GO/server/app/main_test.go

44 lines
1.2 KiB
Go
Raw Permalink Normal View History

2024-04-07 10:12:24 +00:00
package main
2024-04-08 10:13:01 +00:00
import (
"testing"
_ "github.com/go-sql-driver/mysql"
2024-04-12 09:17:10 +00:00
"github.com/iapologizewhenimwrong/Vestmore_GO/translator"
2024-04-15 08:08:17 +00:00
"github.com/iapologizewhenimwrong/Vestmore_GO/utils/log"
2024-04-12 09:17:10 +00:00
"github.com/nicksnyder/go-i18n/v2/i18n"
"github.com/pelletier/go-toml/v2"
"golang.org/x/text/language"
2024-04-08 10:13:01 +00:00
)
2024-04-07 10:12:24 +00:00
func TestMain(t *testing.T) {
2024-04-09 05:38:29 +00:00
// 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())
2024-04-07 10:12:24 +00:00
main()
}
2024-04-10 06:58:19 +00:00
func TestCaseZero(t *testing.T) {
2024-04-12 09:17:10 +00:00
// 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))
2024-04-10 06:58:19 +00:00
}