public final class MessageLocalizer extends Object
LocalizableMessage or its dynamic
representation as StructValue.
Uses ResourceBundleProvider to locate resource bundle for
message localization (i.e. resolving the message key}.
Uses TemplateFormatter to format the message template.
| Constructor and Description |
|---|
MessageLocalizer(TemplateFormatter formatter,
ResourceBundleProvider bundleProvider,
Locale locale)
Constructor.
|
| Modifier and Type | Method and Description |
|---|---|
String |
localize(LocalizableMessage localizable)
Localizes a
LocalizableMessage for the locale used to
create this instance. |
String |
localize(LocalizableMessage localizable,
Locale locale)
Localizes a
LocalizableMessage for given target locale. |
String |
localize(StructValue localizable)
Localizes a dynamic (
StructValue) representation of
localizable message for the locale used to create this
instance. |
String |
localize(StructValue localizable,
Locale locale)
Localizes a dynamic (
StructValue) representation of
localizable message. |
public MessageLocalizer(TemplateFormatter formatter, ResourceBundleProvider bundleProvider, Locale locale)
formatter - formatter for message templatesbundleProvider - provider for message bundleslocale - target locale;IllegalArgumentException - if any of the parameters
is nullpublic String localize(LocalizableMessage localizable, Locale locale)
LocalizableMessage for given target locale.localizable - message to be localizedlocale - target localeIllegalArgumentException - if any of the parameters
is nullpublic String localize(LocalizableMessage localizable)
LocalizableMessage for the locale used to
create this instance.localize(LocalizableMessage, Locale)public String localize(StructValue localizable, Locale locale)
StructValue) representation of
localizable message.localizable - localizable messagelocale - target localeLocalizationException - if the specified localizable
doesn't have the expected structure for localizable messageIllegalArgumentException - if any of the parameters
is nullpublic String localize(StructValue localizable)
StructValue) representation of
localizable message for the locale used to create this
instance.localize(LocalizableMessage, Locale)Copyright © 2016. All Rights Reserved.