Interface Strings
- All Superinterfaces:
LocaleMatcher
- All Known Implementing Classes:
DefaultStrings
Contract for localized string providers - given a key and optional placeholders, return a localized string.
Format is "You are missing {{requiredFieldCount}} required fields."
- Author:
- Mark Allen
-
Method Summary
Modifier and TypeMethodDescriptionGets a localized string for the given key.Gets a localized string for the given key.static DefaultStrings.BuilderwithFallbackLocale(Locale fallbackLocale) Vends aStringsinstance builder for the specified fallback locale.Methods inherited from interface com.lokalized.LocaleMatcher
bestMatchFor, bestMatchFor
-
Method Details
-
get
-
get
Gets a localized string for the given key.If no localized string is available, the key is returned.
- Parameters:
key- the localization key, not nullplaceholders- the placeholders to insert into the string, may be null- Returns:
- a localized string for the key, not null
-
withFallbackLocale
Vends aStringsinstance builder for the specified fallback locale.Strings strings = Strings.withFallbackLocale(Locale.forLanguageTag("en")) .localizedStringSupplier(() -> LocalizedStringLoader.loadFromClasspath("strings")) .localeSupplier(() -> Locale.forLanguageTag("en-GB")) .build();- Parameters:
fallbackLocale- the fallback locale, not null- Returns:
- a builder for a
Stringsinstance, not null
-