From 714a07f162005d4bce1805086c3fec8fc9542a65 Mon Sep 17 00:00:00 2001 From: Jan Dittberner Date: Fri, 1 Jan 2021 12:40:12 +0100 Subject: [PATCH] Translations for login form --- active.de.toml | 19 +++++++++++++++++++ active.en.toml | 13 +++++++++++++ common/services/i18n.go | 3 ++- idp/services/i18n.go | 19 +++++++++++++++++++ translate.de.toml | 21 ++++++++++++++++++--- 5 files changed, 71 insertions(+), 4 deletions(-) diff --git a/active.de.toml b/active.de.toml index 9dc347c..9553e99 100644 --- a/active.de.toml +++ b/active.de.toml @@ -18,6 +18,16 @@ other = "Dieses Feld wird benötigt." hash = "sha1-e5fd9aa24c9417e7332e6f25936ae2a6ec8f1524" other = "Unbekannter Fehler" +[FormLabelEmail] +description = "Label for an email form field" +hash = "sha1-ce1aa6771caccb8c901c6627e7ab5c554e9944da" +other = "E-Mail:" + +[FormLabelPassword] +description = "Label for a password form field" +hash = "sha1-a3c9deb12ea191bb380ea7ad076417b1fff14f28" +other = "Passwort:" + [IndexGreeting] hash = "sha1-d4a13058e497fa24143ea96d50d82b818455ef61" other = "Hallo {{ .User }}" @@ -42,10 +52,19 @@ other = "Die Anwendung {{ .client }} benötigt deine Einwilligu hash = "sha1-5e56a367cf99015bbe98488845541db00b7e04f6" other = "Ich erteile hiermit meine Einwilligung, dass die Anwendung die angefragten Berechtigungen erhalten darf." +[LabelLogin] +description = "Label for a login button" +hash = "sha1-ff00822024fca849fe0cef21237b57218e706852" +other = "Anmelden" + [LabelSubmit] hash = "sha1-2dacf65959849884a011f36f76a04eebea94c5ea" other = "Abschicken" +[LoginTitle] +hash = "sha1-4e5a2893bdcc7d239c1db72e4c4ffbe4bea73174" +other = "Anmeldung" + [LogoutLabel] description = "A label on a logout button or link" hash = "sha1-8acfdeb9a8286f00c8e5dd48471cfdc994807579" diff --git a/active.en.toml b/active.en.toml index 41c695c..77a08ed 100644 --- a/active.en.toml +++ b/active.en.toml @@ -10,6 +10,7 @@ IntroConsentMoreInformation = "You can find more information about {{ .c IntroConsentRequested = "The {{ .client }} application wants your consent for the requested set of permissions." LabelConsent = "I hereby agree that the application may get the requested permissions." LabelSubmit = "Submit" +LoginTitle = "Login" Scope-email-Description = "Access your primary email address." Scope-offline_access-Description = "Keep access to your information until you revoke the permission." Scope-openid-Description = "Request information about your identity." @@ -17,6 +18,18 @@ Scope-profile-Description = "Access your user profile information including your TitleRequestConsent = "Application requests your consent" WrongOrLockedUserOrInvalidPassword = "You entered an invalid username or password or your account has been locked." +[FormLabelEmail] +description = "Label for an email form field" +other = "Email:" + +[FormLabelPassword] +description = "Label for a password form field" +other = "Password:" + +[LabelLogin] +description = "Label for a login button" +other = "Login" + [LogoutLabel] description = "A label on a logout button or link" other = "Logout" diff --git a/common/services/i18n.go b/common/services/i18n.go index f7cfee5..1985ff2 100644 --- a/common/services/i18n.go +++ b/common/services/i18n.go @@ -38,7 +38,7 @@ func (m *MessageCatalog) LookupErrorMessage(tag string, field string, value inte m.logger.Infof("no specific error message %s", tag) message, ok = m.messages["unknown"] if !ok { - m.logger.Error("no default translation found") + m.logger.Warnf("no default translation found") return tag } } @@ -69,6 +69,7 @@ func (m *MessageCatalog) LookupMessage(id string, templateData map[string]interf } return translation } else { + m.logger.Warnf("no translation found for %s", id) return id } } diff --git a/idp/services/i18n.go b/idp/services/i18n.go index 6484a9c..6d682f3 100644 --- a/idp/services/i18n.go +++ b/idp/services/i18n.go @@ -70,5 +70,24 @@ func AddMessages(ctx context.Context) { ID: "WrongOrLockedUserOrInvalidPassword", Other: "You entered an invalid username or password or your account has been locked.", } + messages["LoginTitle"] = &i18n.Message{ + ID: "LoginTitle", + Other: "Login", + } + messages["LabelEmail"] = &i18n.Message{ + ID: "FormLabelEmail", + Description: "Label for an email form field", + Other: "Email:", + } + messages["LabelPassword"] = &i18n.Message{ + ID: "FormLabelPassword", + Description: "Label for a password form field", + Other: "Password:", + } + messages["LabelLogin"] = &i18n.Message{ + ID: "LabelLogin", + Description: "Label for a login button", + Other: "Login", + } services.GetMessageCatalog(ctx).AddMessages(messages) } diff --git a/translate.de.toml b/translate.de.toml index 45bc460..a983286 100644 --- a/translate.de.toml +++ b/translate.de.toml @@ -1,3 +1,18 @@ -[WrongOrLockedUserOrInvalidPassword] -hash = "sha1-87e0a0ac67c6c3a06bed184e10b22aae4d075b64" -other = "Du hast einen ungültigen Nutzernamen oder ein ungültiges Passwort eingegeben oder dein Benutzerkonto wurde gesperrt." +[FormLabelEmail] +description = "Label for an email form field" +hash = "sha1-ce1aa6771caccb8c901c6627e7ab5c554e9944da" +other = "E-Mail:" + +[FormLabelPassword] +description = "Label for a password form field" +hash = "sha1-a3c9deb12ea191bb380ea7ad076417b1fff14f28" +other = "Passwort:" + +[LabelLogin] +description = "Label for a login button" +hash = "sha1-ff00822024fca849fe0cef21237b57218e706852" +other = "Anmelden" + +[LoginTitle] +hash = "sha1-4e5a2893bdcc7d239c1db72e4c4ffbe4bea73174" +other = "Anmeldung"