add i18n support

This commit is contained in:
landaiqing
2024-11-12 22:59:39 +08:00
parent 97ca3fc7b0
commit ae743ba8a6
62 changed files with 4468 additions and 2797 deletions

View File

@@ -1,7 +1,16 @@
package middleware
import "net/http"
import (
"net/http"
func I18nMiddleware(w http.ResponseWriter, r *http.Request) {
"golang.org/x/text/language"
"schisandra-album-cloud-microservices/common/i18n"
)
func I18nMiddleware(next http.HandlerFunc) http.HandlerFunc {
return i18n.NewI18nMiddleware([]language.Tag{
language.English,
language.Chinese,
}, []string{"../../resources/language/active.en.toml", "../../resources/language/active.zh.toml"}).Handle(next)
}