Merge pull request #1603 from stianst/master

KEYCLOAK-1816
This commit is contained in:
Stian Thorgersen 2015-09-07 13:32:29 +02:00
commit 5c2fc1120b

View file

@ -18,8 +18,6 @@ public class LocaleHelper {
public static final String UI_LOCALES_PARAM = "ui_locales"; public static final String UI_LOCALES_PARAM = "ui_locales";
public static final String KC_LOCALE_PARAM = "kc_locale"; public static final String KC_LOCALE_PARAM = "kc_locale";
private final static Logger LOGGER = Logger.getLogger(LocaleHelper.class);
public static Locale getLocale(RealmModel realm, UserModel user) { public static Locale getLocale(RealmModel realm, UserModel user) {
return getLocale(realm, user, null, null); return getLocale(realm, user, null, null);
} }
@ -38,8 +36,6 @@ public class LocaleHelper {
user.setSingleAttribute(UserModel.LOCALE, locale.toLanguageTag()); user.setSingleAttribute(UserModel.LOCALE, locale.toLanguageTag());
} }
return locale; return locale;
}else{
LOGGER.infof("Locale %s is not supported.", localeString);
} }
} }
@ -52,8 +48,6 @@ public class LocaleHelper {
user.setSingleAttribute(UserModel.LOCALE, locale.toLanguageTag()); user.setSingleAttribute(UserModel.LOCALE, locale.toLanguageTag());
} }
return locale; return locale;
}else{
LOGGER.infof("Locale %s is not supported.", localeString);
} }
} }
@ -64,8 +58,6 @@ public class LocaleHelper {
if(locale != null){ if(locale != null){
return locale; return locale;
}else{
LOGGER.infof("Locale %s is not supported.", localeString);
} }
} }
@ -75,8 +67,6 @@ public class LocaleHelper {
Locale locale = findLocale(realm.getSupportedLocales(), localeString.split(" ")); Locale locale = findLocale(realm.getSupportedLocales(), localeString.split(" "));
if(locale != null){ if(locale != null){
return locale; return locale;
}else{
LOGGER.infof("Locale %s is not supported.", localeString);
} }
} }
@ -87,8 +77,6 @@ public class LocaleHelper {
Locale locale = findLocale(realm.getSupportedLocales(), localeString); Locale locale = findLocale(realm.getSupportedLocales(), localeString);
if(locale != null){ if(locale != null){
return locale; return locale;
}else{
LOGGER.infof("Locale %s is not supported.", localeString);
} }
} }
} }
@ -109,8 +97,6 @@ public class LocaleHelper {
builder.cookie(new NewCookie(LocaleHelper.LOCALE_COOKIE, locale.toLanguageTag(), path, null, null, 31536000, secure)); builder.cookie(new NewCookie(LocaleHelper.LOCALE_COOKIE, locale.toLanguageTag(), path, null, null, 31536000, secure));
} }
public static Locale findLocale(Set<String> supportedLocales, String ... localeStrings) { public static Locale findLocale(Set<String> supportedLocales, String ... localeStrings) {
for(String localeString : localeStrings){ for(String localeString : localeStrings){
Locale result = null; Locale result = null;