mirror of
https://github.com/andwati/zitadel.git
synced 2026-11-14 18:05:12 +00:00
fix: use a single translator for middleware (#10633)
# Which Problems Are Solved Comparing the v3 and v4 deployments we noticed an increase in memory usage. A first analysis revealed that it might be related to the (multiple) initialization of the `i18n.Translator`, partially related # How the Problems Are Solved Initialize the tranlator once (apart from the translator interceptor, which uses context / request specific information) and pass it to all necessary middleware. # Additional Changes Removed unnecessary error return parameter from the translator initialization. # Additional Context - noticed internally - backport to v4.x
This commit is contained in:
@@ -31,7 +31,7 @@ func init() {
|
||||
}
|
||||
}
|
||||
|
||||
func newBundle(ns Namespace, defaultLanguage language.Tag, allowedLanguages []language.Tag) (*i18n.Bundle, error) {
|
||||
func newBundle(ns Namespace, defaultLanguage language.Tag, allowedLanguages []language.Tag) *i18n.Bundle {
|
||||
bundle := i18n.NewBundle(defaultLanguage)
|
||||
|
||||
for lang, file := range translationMessages[ns] {
|
||||
@@ -41,7 +41,7 @@ func newBundle(ns Namespace, defaultLanguage language.Tag, allowedLanguages []la
|
||||
bundle.MustAddMessages(lang, file.Messages...)
|
||||
}
|
||||
|
||||
return bundle, nil
|
||||
return bundle
|
||||
}
|
||||
|
||||
func loadTranslationsFromNamespace(ns Namespace) {
|
||||
|
||||
Reference in New Issue
Block a user