Package io.rocketbase.commons.util
Class LocaleFilter
java.lang.Object
io.rocketbase.commons.util.LocaleFilter
-
Constructor Summary
Constructors -
Method Summary
Modifier and TypeMethodDescriptionfindClosest(Locale filter, Map<Locale, T> values) findClosest(Locale filter, Map<Locale, T> values, Locale fallback) search within values for given locale and follows some rules to try to get the best fitting valuefindClosestOptional(Locale filter, Map<Locale, T> values) findClosestOptional(Locale filter, Map<Locale, T> values, Locale fallback) transformMapFilterByLanguage(Map<Locale, ?> values, Locale language)
-
Constructor Details
-
LocaleFilter
public LocaleFilter()
-
-
Method Details
-
findClosestOptional
-
findClosest
-
findClosestOptional
-
findClosest
public static <T> Map.Entry<Locale,T> findClosest(Locale filter, Map<Locale, T> values, Locale fallback) search within values for given locale and follows some rules to try to get the best fitting value- Parameters:
filter- locale you are searching for
when containing also country information - searches when no exact match found only by languagevalues- map of Locale valuesfallback- in case nothing found (filter as it is / just language) try to search again via fallback- Returns:
- entry with picked locale (in case it has been internally changed) and value of map
-
transformMapFilterByLanguage
-