public final class MessageLocalizer
extends java.lang.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,
java.util.Locale locale)
Constructor.
|
Modifier and Type | Method and Description |
---|---|
java.lang.String |
localize(LocalizableMessage localizable)
Localizes a
LocalizableMessage for the locale used to
create this instance. |
java.lang.String |
localize(LocalizableMessage localizable,
java.util.Locale locale)
Localizes a
LocalizableMessage for given target locale. |
java.lang.String |
localize(StructValue localizable)
Localizes a dynamic (
StructValue ) representation of
localizable message for the locale used to create this
instance. |
java.lang.String |
localize(StructValue localizable,
java.util.Locale locale)
Localizes a dynamic (
StructValue ) representation of
localizable message. |
public MessageLocalizer(TemplateFormatter formatter, ResourceBundleProvider bundleProvider, java.util.Locale locale)
formatter
- formatter for message templatesbundleProvider
- provider for message bundleslocale
- target locale;java.lang.IllegalArgumentException
- if any of the parameters
is null
public java.lang.String localize(LocalizableMessage localizable, java.util.Locale locale)
LocalizableMessage
for given target locale.localizable
- message to be localizedlocale
- target localejava.lang.IllegalArgumentException
- if any of the parameters
is null
public java.lang.String localize(LocalizableMessage localizable)
LocalizableMessage
for the locale used to
create this
instance.localize(LocalizableMessage, Locale)
public java.lang.String localize(StructValue localizable, java.util.Locale locale)
StructValue
) representation of
localizable message.localizable
- localizable messagelocale
- target localeLocalizationException
- if the specified localizable
doesn't have the expected structure for localizable messagejava.lang.IllegalArgumentException
- if any of the parameters
is null
public java.lang.String localize(StructValue localizable)
StructValue
) representation of
localizable message for the locale used to create this
instance.localize(LocalizableMessage, Locale)