Class LocaleUtils
- java.lang.Object
-
- org.forgerock.selfservice.stages.utils.LocaleUtils
-
public final class LocaleUtils extends Object
Utility class for Locales.- Since:
- 0.8.0
-
-
Method Summary
All Methods Static Methods Concrete Methods Modifier and Type Method Description 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.
-
-
-
Method Detail
-
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
-
-