Class LocaleUtils
java.lang.Object
org.forgerock.selfservice.stages.utils.LocaleUtils
Utility class for Locales.
- Since:
- 0.8.0
-
Method Summary
Modifier and TypeMethodDescriptionstatic StringgetTranslationFromLocaleMap(PreferredLocales preferredLocales, Map<Locale, String> translations) Using the user's preferred locales (for example, from the "Accept-Language" header in the HTTP context), select the most optimal (string) translation from the map.
-
Method Details
-
getTranslationFromLocaleMap
public static String getTranslationFromLocaleMap(PreferredLocales preferredLocales, Map<Locale, String> translations) Using the user's preferred locales (for example, from the "Accept-Language" header in the HTTP context), select the most optimal (string) translation from the map. If there is nothing acceptable, throw an exception.- Parameters:
preferredLocales- the preferred localestranslations- Map of locales to strings- Returns:
- the most appropriate string given the above
- Throws:
IllegalArgumentException- If an acceptable string cannot be found
-