@FunctionalInterface public interface MessageProvider extends Serializable
LocalizationContext to localize messages according to a Locale.LocalizationContext| Modifier and Type | Interface and Description |
|---|---|
static interface |
MessageProvider.PropertiesMessageProviderBuilder
Builder to create
PropertiesMessageProvider instances |
| Modifier and Type | Field and Description |
|---|---|
static String |
DEFAULT_MESSAGE_ARGUMENT_PLACEHOLDER
Default argument placeholder for message localization
|
| Modifier and Type | Method and Description |
|---|---|
static MessageProvider.PropertiesMessageProviderBuilder |
fromProperties(String... basenames)
Builder to create a
MessageProvider which uses properties files as messages source. |
Optional<String> |
getMessage(Locale locale,
String code)
Get a localized message in given
locale for specified message code |
static final String DEFAULT_MESSAGE_ARGUMENT_PLACEHOLDER
Optional<String> getMessage(Locale locale, String code) throws Localizable.LocalizationException
locale for specified message codelocale - Localecode - Message codeLocalizable.LocalizationException - Error retrieving messagestatic MessageProvider.PropertiesMessageProviderBuilder fromProperties(String... basenames)
MessageProvider which uses properties files as messages source.
Properties files are resolved using configured basenames as prefix, and Locale language, country and
variant separated by an underscore as file name. Files must have .properties extension.
The basenames follow ResourceBundle conventions: essentially, a fully-qualified classpath
location. If it doesn't contain a package qualifier, it will be resolved from the classpath root. Note that the
JDK's standard ResourceBundle treats dots as package separators: This means that "test.messages" is equivalent to
"test/messages".
basenames - Basenames for resource locationsCopyright © 2019 The Holon Platform. All rights reserved.