🏗️ 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

17
common/i18n/parse.go Normal file
View File

@@ -0,0 +1,17 @@
package i18n
import "golang.org/x/text/language"
func MatchCurrentLanguageTag(accept string, supportTags []language.Tag) language.Tag {
langTags, _, err := language.ParseAcceptLanguage(accept)
if err != nil {
langTags = []language.Tag{language.Chinese}
}
var matcher = language.NewMatcher(supportTags)
_, i, _ := matcher.Match(langTags...)
tag := supportTags[i]
if tag == language.Und {
tag = language.Chinese
}
return tag
}