KEYCLOAK-2388

Localisation should fallback to english rather than display raw keys
This commit is contained in:
Stian Thorgersen 2016-01-25 16:27:04 +01:00
parent c55b91ed32
commit 4a698bc22a
27 changed files with 33 additions and 129 deletions

View file

@ -47,6 +47,7 @@ import org.keycloak.services.Urls;
import javax.ws.rs.GET;
import javax.ws.rs.Path;
import javax.ws.rs.Produces;
import javax.ws.rs.WebApplicationException;
import javax.ws.rs.core.Context;
import javax.ws.rs.core.HttpHeaders;
import javax.ws.rs.core.MediaType;
@ -317,23 +318,11 @@ public class AdminConsole {
@Path("messages.json")
@Produces(MediaType.APPLICATION_JSON)
public Properties getMessages(@QueryParam("lang") String lang) {
if (lang == null) {
logger.localeNotSpecified();
lang = "en";
}
try {
Properties msgs = getTheme().getMessages("admin-messages", Locale.forLanguageTag(lang));
if (msgs.isEmpty()) {
logger.msgBundleNotFound(lang);
msgs = getTheme().getMessages("admin-messages", Locale.ENGLISH);
}
if (msgs.isEmpty()) logger.msgBundleNotFoundForEn();
return msgs;
Locale locale = lang != null ? Locale.forLanguageTag(lang) : Locale.ENGLISH;
return getTheme().getMessages("admin-messages", locale);
} catch (IOException e) {
throw new RuntimeException(e);
throw new WebApplicationException("Failed to load message bundle", e);
}
}
}

View file

@ -235,6 +235,11 @@ public class ExtendingThemeManager implements ThemeProvider {
public Properties getMessages(String baseBundlename, Locale locale) throws IOException {
if (messages.get(baseBundlename) == null || messages.get(baseBundlename).get(locale) == null) {
Properties messages = new Properties();
if (!Locale.ENGLISH.equals(locale)) {
messages.putAll(getMessages(baseBundlename, Locale.ENGLISH));
}
ListIterator<Theme> itr = themes.listIterator(themes.size());
while (itr.hasPrevious()) {
Properties m = itr.previous().getMessages(baseBundlename, locale);

View file

@ -74,7 +74,7 @@ public class AccountPageTest {
Assert.assertEquals("English", accountUpdateProfilePage.getLanguageDropdownText());
accountUpdateProfilePage.openLanguage("German");
accountUpdateProfilePage.openLanguage("Deutsch");
Assert.assertEquals("Deutsch", accountUpdateProfilePage.getLanguageDropdownText());
accountUpdateProfilePage.openLanguage("English");

View file

@ -71,7 +71,7 @@ public class LoginPageTest {
loginPage.open();
Assert.assertEquals("English", loginPage.getLanguageDropdownText());
loginPage.openLanguage("German");
loginPage.openLanguage("Deutsch");
Assert.assertEquals("Deutsch", loginPage.getLanguageDropdownText());
loginPage.openLanguage("English");

View file

@ -144,12 +144,4 @@ invalidPasswordMinUpperCaseCharsMessage=Contrasenya incorrecta: ha de contenir a
invalidPasswordMinSpecialCharsMessage=Contrasenya incorrecta: ha de contenir almenys {0} car\u00E0cters especials.
invalidPasswordNotUsernameMessage=Contrasenya incorrecta: no pot ser igual al nom d''usuari.
invalidPasswordRegexPatternMessage=Contrasenya incorrecta: no compleix l''expressi\u00F3 regular.
invalidPasswordHistoryMessage=Contrasenya incorrecta: no pot ser igual a cap de les \u00FAltimes {0} contrasenyes.
locale_de=Deutsch
locale_en=English
locale_it=Italian
locale_pt-BR=Portugu\u00EAs (Brasil)
locale_fr=Fran\u00E7ais
locale_es=Espa\u00F1ol
locale_ca=Catal\u00E0
invalidPasswordHistoryMessage=Contrasenya incorrecta: no pot ser igual a cap de les \u00FAltimes {0} contrasenyes.

View file

@ -120,10 +120,4 @@ invalidPasswordMinUpperCaseCharsMessage=Ung\u00FCltiges Passwort\: muss mindeste
invalidPasswordMinSpecialCharsMessage=Ung\u00FCltiges Passwort\: muss mindestens {0} Spezialzeichen beinhalten.
invalidPasswordNotUsernameMessage=Ung\u00FCltiges Passwort\: darf nicht gleich sein wie Benutzername.
invalidPasswordRegexPatternMessage=Ung\u00FCltiges Passwort\: nicht Regex-Muster (n) entsprechen.
invalidPasswordHistoryMessage=Ung\u00FCltiges Passwort: darf nicht gleich einem der letzten {0} Passwortgeschichte.
locale_de=Deutsch
locale_en=English
locale_it=Italian
locale_pt-BR=Portugu\u00EAs (Brasil)
locale_fr=Fran\u00e7ais
invalidPasswordHistoryMessage=Ung\u00FCltiges Passwort: darf nicht gleich einem der letzten {0} Passwortgeschichte.

View file

@ -148,8 +148,10 @@ invalidPasswordNotUsernameMessage=Invalid password: must not be equal to the use
invalidPasswordRegexPatternMessage=Invalid password: fails to match regex pattern(s).
invalidPasswordHistoryMessage=Invalid password: must not be equal to any of last {0} passwords.
locale_de=German
locale_ca=Catal\u00E0
locale_de=Deutsch
locale_en=English
locale_es=Espa\u00F1ol
locale_fr=Fran\u00e7ais
locale_it=Italian
locale_pt-BR=Portugu\u00EAs (Brasil)
locale_fr=Fran\u00e7ais
locale_pt-BR=Portugu\u00EAs (Brasil)

View file

@ -144,12 +144,4 @@ invalidPasswordMinUpperCaseCharsMessage=Contrase\u00F1a incorrecta: debe contene
invalidPasswordMinSpecialCharsMessage=Contrase\u00F1a incorrecta: debe contener al menos {0} caracteres especiales.
invalidPasswordNotUsernameMessage=Contrase\u00F1a incorrecta: no puede ser igual al nombre de usuario.
invalidPasswordRegexPatternMessage=Contrase\u00F1a incorrecta: no cumple la expresi\u00F3n regular.
invalidPasswordHistoryMessage=Contrase\u00F1a incorrecta: no puede ser igual a ninguna de las \u00FAltimas {0} contrase\u00F1as.
locale_de=German
locale_en=English
locale_it=Italian
locale_pt-BR=Portugu\u00EAs (Brasil)
locale_fr=Fran\u00E7ais
locale_es=Espa\u00F1ol
locale_ca=Catal\u00E0
invalidPasswordHistoryMessage=Contrase\u00F1a incorrecta: no puede ser igual a ninguna de las \u00FAltimas {0} contrase\u00F1as.

View file

@ -149,11 +149,4 @@ invalidPasswordMinUpperCaseCharsMessage=Mot de passe invalide: doit contenir au
invalidPasswordMinSpecialCharsMessage=Mot de passe invalide: doit contenir au moins {0} caract\u00e8re(s) sp\u00e9ciaux.
invalidPasswordNotUsernameMessage=Mot de passe invalide: ne doit pas \u00eatre identique au nom d''utilisateur.
invalidPasswordRegexPatternMessage=Mot de passe invalide: ne valide pas l''expression rationnelle.
invalidPasswordHistoryMessage=Mot de passe invalide: ne doit pas \u00eatre \u00e9gal aux {0} derniers mot de passe.
locale_de=German
locale_en=English
locale_it=Italian
locale_pt-BR=Portugu\u00EAs (Brasil)
locale_fr=Fran\u00e7ais
locale_es=Espa\u00F1ol
invalidPasswordHistoryMessage=Mot de passe invalide: ne doit pas \u00eatre \u00e9gal aux {0} derniers mot de passe.

View file

@ -119,10 +119,4 @@ invalidPasswordMinUpperCaseCharsMessage=Password non valida: deve contenere alme
invalidPasswordMinSpecialCharsMessage=Password non valida: deve contenere almeno {0} caratteri speciali.
invalidPasswordNotUsernameMessage=Password non valida: non deve essere uguale allo username.
invalidPasswordRegexPatternMessage=Password non valida: fallito il match con una o piu'' espressioni regolari.
invalidPasswordHistoryMessage=Password non valida: non deve ssere uguale ad una delle ultime {0} password.
locale_de=German
locale_en=English
locale_it=Italian
locale_pt-BR=Portugu\u00EAs (Brasil)
locale_fr=Fran\u00e7ais
invalidPasswordHistoryMessage=Password non valida: non deve ssere uguale ad una delle ultime {0} password.

View file

@ -59,7 +59,6 @@ client_admin-cli=Admin CLI
client_realm-management=Gerenciamento de Realm
client_broker=Broker
requiredFields=Campos obrigat\u00F3rios
allFieldsRequired=Todos os campos s\u00E3o obrigat\u00F3rios
@ -146,10 +145,4 @@ invalidPasswordMinUpperCaseCharsMessage=Senha inv\u00E1lida\: deve conter pelo m
invalidPasswordMinSpecialCharsMessage=Senha inv\u00E1lida\: deve conter pelo menos {0} caractere(s) especial
invalidPasswordNotUsernameMessage=Senha inv\u00E1lida\: n\u00E3o deve ser igual ao nome de usu\u00E1rio
invalidPasswordRegexPatternMessage=Senha inv\u00E1lida\: n\u00E3o corresponde ao padr\u00E3o da express\u00E3o regular.
invalidPasswordHistoryMessage=Senha inv\u00E1lida\: n\u00E3o pode ser igual a qualquer uma das {0} \u00FAltimas senhas.
locale_de=Deutsch
locale_en=English
locale_it=Italian
locale_pt-BR=Portugu\u00EAs (BR)
locale_fr=Fran\u00E7ais
invalidPasswordHistoryMessage=Senha inv\u00E1lida\: n\u00E3o pode ser igual a qualquer uma das {0} \u00FAltimas senhas.

View file

@ -1 +1 @@
locales=ca,de,en,es,fr,it,pt_BR
locales=ca,de,en,es,fr,it,pt-BR

View file

@ -1,8 +0,0 @@
invalidPasswordMinLengthMessage=Senha inv\u00E1lida: comprimento m\u00EDnimo {0}.
invalidPasswordMinLowerCaseCharsMessage=Senha inv\u00E1lida: deve conter pelo menos {0} caractere(s) min\u00FAsculo.
invalidPasswordMinDigitsMessage=Senha inv\u00E1lida: deve conter pelo menos {0} n\u00FAmero(s).
invalidPasswordMinUpperCaseCharsMessage=Senha inv\u00E1lida: deve conter pelo menos {0} caractere(s) mai\u00FAsculo.
invalidPasswordMinSpecialCharsMessage=Senha inv\u00E1lida: deve conter pelo menos {0} caractere(s) especial.
invalidPasswordNotUsernameMessage=Senha inv\u00E1lida: n\u00E3o pode ser igual pelo nome de usu\u00E1rio.
invalidPasswordRegexPatternMessage=Senha inv\u00E1lida: n\u00E3o corresponde ao padr\u00E3o da express\u00E3o regular.
invalidPasswordHistoryMessage=Senha inv\u00E1lida: n\u00E3o pode ser igual a qualquer uma das {0} \u00FAltimas senhas.

View file

@ -1,2 +1,2 @@
import=common/keycloak
locales=ca,de,en,es,fr
locales=ca,de,en,es,fr,it,pt-BR

View file

@ -1 +1 @@
locales=ca,de,en,es,fr,it,pt_BR
locales=ca,de,en,es,fr,it,pt-BR

View file

@ -192,14 +192,6 @@ realmSupportsNoCredentialsMessage=El domini no suporta cap tipus de credencials.
identityProviderNotUniqueMessage=El domini suporta m\u00FAltiples prove\u00EFdors d''identitat. No s''ha pogut determinar el prove\u00EFdor d''identitat que hauria de ser utilitzat per identificar-se.
emailVerifiedMessage=El teu email ha estat verificat.
locale_de=German
locale_en=English
locale_it=Italian
locale_pt-BR=Portugu\u00EAs (Brasil)
locale_fr=Français
locale_es=Espa\u00F1ol
locale_ca=Catal\u00E0
backToApplication=&laquo; Torna a l''aplicaci\u00F3
missingParameterMessage=Par\u00E0metres que falten: {0}
clientNotFoundMessage=Client no trobat

View file

@ -191,11 +191,4 @@ invalidParameterMessage=Invalid parameter\: {0}
missingParameterMessage=Missing parameter\: {0}
clientNotFoundMessage=Client not found.
emailVerifiedMessage=Ihr E-Mail Adresse wurde erfolgreich verifiziert.
locale_de=Deutsch
locale_en=English
locale_it=Italian
locale_pt-BR=Portugu\u00EAs (Brasil)
locale_fr=Fran\u00e7ais
locale_es=Espa\u00F1ol
emailVerifiedMessage=Ihr E-Mail Adresse wurde erfolgreich verifiziert.

View file

@ -206,12 +206,14 @@ realmSupportsNoCredentialsMessage=Realm does not support any credential type.
identityProviderNotUniqueMessage=Realm supports multiple identity providers. Could not determine which identity provider should be used to authenticate with.
emailVerifiedMessage=Your email address has been verified.
locale_de=German
locale_ca=Catal\u00E0
locale_de=Deutsch
locale_en=English
locale_it=Italian
locale_pt-BR=Portugu\u00EAs (Brasil)
locale_fr=Fran\u00e7ais
locale_es=Espa\u00F1ol
locale_fr=Fran\u00e7ais
locale_it=Italian
locale_pt_BR=Portugu\u00EAs (Brasil)
locale_pt-BR=Portugu\u00EAs (Brasil)
backToApplication=&laquo; Back to Application
missingParameterMessage=Missing parameters\: {0}

View file

@ -192,14 +192,6 @@ realmSupportsNoCredentialsMessage=El dominio no soporta ning\u00FAn tipo de cred
identityProviderNotUniqueMessage=El dominio soporta m\u00FAltiples proveedores de identidad. No se pudo determinar el proveedor de identidad que deber\u00EDa ser utilizado para identificarse.
emailVerifiedMessage=Tu email ha sido verificado.
locale_de=German
locale_en=English
locale_it=Italian
locale_pt-BR=Portugu\u00EAs (Brasil)
locale_fr=Fran\u00C3\u00A7ais
locale_es=Espa\u00F1ol
locale_ca=Catal\u00E0
backToApplication=&laquo; Volver a la aplicaci\u00F3n
missingParameterMessage=Par\u00E1metros que faltan: {0}
clientNotFoundMessage=Cliente no encontrado

View file

@ -206,13 +206,6 @@ realmSupportsNoCredentialsMessage=Ce domaine ne supporte aucun type d''accr\u00e
identityProviderNotUniqueMessage=Ce domaine autorise plusieurs fournisseurs d''identit\u00e9. Impossible de d\u00e9terminer le fournisseur d''identit\u00e9 avec lequel s''authentifier.
emailVerifiedMessage=Votre courriel a \u00e9t\u00e9 v\u00e9rifi\u00e9.
locale_de=German
locale_en=English
locale_it=Italian
locale_pt-BR=Portugu\u00EAs (Brasil)
locale_fr=Fran\u00e7ais
locale_es=Espa\u00F1ol
backToApplication=&laquo; Revenir \u00e0 l''application
missingParameterMessage=Param\u00e8tres manquants\: {0}
clientNotFoundMessage=Client inconnu.

View file

@ -185,13 +185,6 @@ realmSupportsNoCredentialsMessage=Il Realm non supporta nessun tipo di credenzia
identityProviderNotUniqueMessage=Il Realm supporta piu'' di un identity provider. Non posso determinare quale identity provider con il quale autenticarti.
emailVerifiedMessage=Il tuo indirizzo email e'' stato verificato.
locale_de=German
locale_en=English
locale_it=Italian
locale_pt-BR=Portugu\u00EAs (Brasil)
locale_fr=Fran\u00e7ais
locale_es=Espa\u00F1ol
backToApplication=&laquo; Torna all''Applicazione
missingParameterMessage=Parametri Mancanti\: {0}
clientNotFoundMessage=Client non trovato.

View file

@ -206,13 +206,6 @@ realmSupportsNoCredentialsMessage=O realm n\u00E3o suporta qualquer tipo de cred
identityProviderNotUniqueMessage=O realm suporta m\u00FAltiplos provedores de identidade. N\u00E3o foi poss\u00EDvel determinar qual o provedor de identidade deve ser usado para se autenticar.
emailVerifiedMessage=O seu endere\u00E7o de e-mail foi confirmado.
locale_de=Deutsch
locale_en=English
locale_it=Italian
locale_pt-BR=Portugu\u00EAs (BR)
locale_fr=Fran\u00E7ais
locale_es=Espa\u00F1ol
backToApplication=&laquo; Voltar para o aplicativo
missingParameterMessage=Par\u00E2metros que faltam\: {0}
clientNotFoundMessage=Cliente n\u00E3o encontrado.

View file

@ -1 +1 @@
locales=ca,de,en,es,fr,it,pt_BR
locales=ca,de,en,es,fr,it,pt-BR