Package com.lokalized
Class DefaultStrings
java.lang.Object
com.lokalized.DefaultStrings
- All Implemented Interfaces:
Strings
Default implementation of a localized string provider.
It is recommended to use a single instance of this class across your entire application.
In multi-tenant systems like a web application where each user might have a different locale,
your localeSupplier
might return the locale specified by current request.
- Author:
- Mark Allen
-
Nested Class Summary
Modifier and TypeClassDescriptionstatic class
Builder used to construct instances ofDefaultStrings
.static enum
Strategies for handling localized string lookup failures. -
Method Summary
Modifier and TypeMethodDescriptionGets a localized string for the given key.Gets a localized string for the given key.Gets a localized string for the given key.Gets a localized string for the given key.Gets the strategy for handling string lookup failures.Gets the fallback language code.Gets the set of localized strings for each locale.
-
Method Details
-
get
Description copied from interface:Strings
Gets a localized string for the given key.If no localized string is available, the key is returned.
-
get
Description copied from interface:Strings
Gets a localized string for the given key.If no localized string is available, the key is returned.
-
get
Description copied from interface:Strings
Gets a localized string for the given key.If no localized string is available, the key is returned.
-
get
@Nonnull public String get(@Nonnull String key, @Nullable Map<String, Object> placeholders, @Nullable Locale locale) Description copied from interface:Strings
Gets a localized string for the given key.If no localized string is available, the key is returned.
-
getFallbackLanguageCode
Gets the fallback language code.- Returns:
- the fallback language code, not null
-
getLocalizedStringsByLocale
Gets the set of localized strings for each locale.- Returns:
- the set of localized strings for each locale, not null
-
getFailureMode
Gets the strategy for handling string lookup failures.- Returns:
- the strategy for handling string lookup failures, not null
-