🏗️ microservice fabric splitting

This commit is contained in:
2024-12-24 00:38:41 +08:00
parent 462e811742
commit 89d64336f5
311 changed files with 18384 additions and 2428 deletions

View File

@@ -0,0 +1,23 @@
package middleware
import (
"net/http"
"os"
"path/filepath"
"schisandra-album-cloud-microservices/common/i18n"
"golang.org/x/text/language"
)
func I18nMiddleware(next http.HandlerFunc) http.HandlerFunc {
cwd, err := os.Getwd()
if err != nil {
panic(err)
}
zhPath := filepath.Join(cwd, "/resources/language/", "active.zh.toml")
enPath := filepath.Join(cwd, "/resources/language/", "active.en.toml")
return i18n.NewI18nMiddleware([]language.Tag{
language.English,
language.Chinese,
}, []string{enPath, zhPath}).Handle(next)
}