fix: footerText has no effect (#6297)

This commit is contained in:
Miguel Cabrerizo 2023-08-11 10:16:30 +02:00 committed by GitHub
parent b383892d36
commit 6ca789ad44
No known key found for this signature in database
GPG Key ID: 4AEE18F83AFDEB23

View File

@ -42,5 +42,11 @@ func (data *TemplateData) Translate(translator *i18n.Translator, msgType string,
data.Greeting = translator.Localize(fmt.Sprintf("%s.%s", msgType, domain.MessageGreeting), args, langs...)
data.Text = html.UnescapeString(translator.Localize(fmt.Sprintf("%s.%s", msgType, domain.MessageText), args, langs...))
data.ButtonText = translator.Localize(fmt.Sprintf("%s.%s", msgType, domain.MessageButtonText), args, langs...)
data.FooterText = translator.Localize(fmt.Sprintf("%s.%s", msgType, domain.MessageFooterText), args, langs...)
// Footer text is neither included in i18n files nor defaults.yaml
footerText := fmt.Sprintf("%s.%s", msgType, domain.MessageFooterText)
data.FooterText = translator.Localize(footerText, args, langs...)
// translator returns the id of the string to be translated if no translation is found for that id
// we'll include the footer if we have a custom non-empty string and if the string doesn't include the
// id of the string that could not be translated example InitCode.Footer
data.IncludeFooter = len(data.FooterText) > 0 && data.FooterText != footerText
}