mirror of
https://github.com/zitadel/zitadel.git
synced 2025-01-10 13:23:40 +00:00
Merge branch 'main' into idp-post-callback
This commit is contained in:
commit
84a4a364c3
@ -64,10 +64,22 @@ func (t *Translator) SupportedLanguages() []language.Tag {
|
||||
return t.allowedLanguages
|
||||
}
|
||||
|
||||
// AddMessages adds messages to the translator for the given language tag.
|
||||
// If the tag is not in the allowed languages, the messages are not added.
|
||||
func (t *Translator) AddMessages(tag language.Tag, messages ...Message) error {
|
||||
if len(messages) == 0 {
|
||||
return nil
|
||||
}
|
||||
var isAllowed bool
|
||||
for _, allowed := range t.allowedLanguages {
|
||||
if allowed == tag {
|
||||
isAllowed = true
|
||||
break
|
||||
}
|
||||
}
|
||||
if !isAllowed {
|
||||
return nil
|
||||
}
|
||||
i18nMessages := make([]*i18n.Message, len(messages))
|
||||
for i, message := range messages {
|
||||
i18nMessages[i] = &i18n.Message{
|
||||
|
Loading…
x
Reference in New Issue
Block a user