public class NlsMessagePlain extends Object implements NlsMessage
NlsMessage
that only returns the message
given at construction
and never has any arguments
.Modifier and Type | Field and Description |
---|---|
private String |
message |
private static long |
serialVersionUID
UID for serialization.
|
LOCALIZATION_FAILURE_PREFIX
KEY_ANNOTATION, KEY_ARGUMENT, KEY_CAPACITY, KEY_CONTAINER, KEY_DEFAULT, KEY_DIRECTORY, KEY_ERROR, KEY_EXISTING, KEY_EXPECTED, KEY_FILE, KEY_FUNCTION, KEY_ID, KEY_KEY, KEY_LOCATION, KEY_MAX, KEY_MIN, KEY_MODE, KEY_NAME, KEY_OBJECT, KEY_OPERAND, KEY_OPERATION, KEY_OPTION, KEY_PATH, KEY_PROPERTY, KEY_QUERY, KEY_RESOURCE, KEY_SIZE, KEY_SOURCE, KEY_TARGET_TYPE, KEY_TITLE, KEY_TYPE, KEY_URI, KEY_USER, KEY_VALUE
Modifier | Constructor and Description |
---|---|
protected |
NlsMessagePlain()
The constructor for de-serialization in GWT.
|
|
NlsMessagePlain(String message)
The constructor.
|
Modifier and Type | Method and Description |
---|---|
Object |
getArgument(int index)
Deprecated.
|
Object |
getArgument(String key)
This method gets the language independent argument for the given
key . |
int |
getArgumentCount()
Deprecated.
|
String |
getInternationalizedMessage()
This method gets the internationalized message that can be
translated to a native language. |
String |
getLocalizedMessage()
|
String |
getLocalizedMessage(Locale locale)
This method gets the message localized to the given
Locale as string. |
void |
getLocalizedMessage(Locale locale,
Appendable buffer)
This method writes the localized message to the given
buffer . |
String |
getLocalizedMessage(Locale locale,
NlsTemplateResolver resolver)
This method gets the localized message as string.
|
void |
getLocalizedMessage(Locale locale,
NlsTemplateResolver resolver,
Appendable buffer)
This method writes the localized message to the given
buffer . |
String |
getMessage()
This method gets the untranslated message (default language should be English) with arguments filled in.
|
NlsMessage |
toNlsMessage()
This method is the equivalent to
Object.toString() with native language support. |
String |
toString() |
private static final long serialVersionUID
private String message
getMessage()
protected NlsMessagePlain()
public NlsMessagePlain(String message)
message
- is the plain message to return for any locale without modification.public NlsMessage toNlsMessage()
Object.toString()
with native language support.toNlsMessage
in interface NlsObject
public String getInternationalizedMessage()
translated
to a native language. The language
independent arguments are filled into the message after the translation process. "Welcome {name}!"
and there is one argument that is the string
"Joelle"
. The final result will then be "Welcome Joelle!"
. If the message is
translated to German as "Willkommen {name}!"
the final result will be
"Willkommen Joelle!"
.getInternationalizedMessage
in interface NlsMessage
NlsMessage
,
NlsMessage.getArgument(String)
,
MessageFormat
@Deprecated public int getArgumentCount()
getArgumentCount
in interface NlsMessage
public Object getArgument(String key)
key
.getArgument
in interface NlsMessage
key
- is the name of the requested argument.null
if NOT defined.@Deprecated public Object getArgument(int index)
index
.getArgument
in interface NlsMessage
index
- is the index of the requested argument.public String getMessage()
NlsMessage.getLocalizedMessage(Locale)
instead of this method.getMessage
in interface NlsMessage
NlsMessage.getLocalizedMessage(Locale, NlsTemplateResolver)
public String getLocalizedMessage()
default
Locale
. NlsMessage.getLocalizedMessage(Locale)
instead.getLocalizedMessage
in interface NlsMessage
public String getLocalizedMessage(Locale locale)
Locale
as string. If this fails for whatever
reason, the untranslated
message will be returned as fallback.getLocalizedMessage
in interface NlsMessage
locale
- is the locale to translate to.net.sf.mmm.util.nls.api
public void getLocalizedMessage(Locale locale, Appendable buffer)
buffer
. template
that is provided via the given
resolver
. If this fails, the original message
will be
used. After translation is done, the language independent arguments will be filled in the translated
message string according to the given locale
.getLocalizedMessage
in interface NlsMessage
locale
- is the locale to translate to.buffer
- is the buffer where to write the message to.public String getLocalizedMessage(Locale locale, NlsTemplateResolver resolver)
getLocalizedMessage
in interface NlsMessage
locale
- is the locale to translate to.resolver
- is used to translate the message.NlsMessage.getLocalizedMessage(Locale, NlsTemplateResolver, Appendable)
public void getLocalizedMessage(Locale locale, NlsTemplateResolver resolver, Appendable buffer)
buffer
. template
that is provided via the given
resolver
. If this fails, the original message
will be
used. After translation is done, the language independent arguments will be filled in the translated
message string according to the given locale
.getLocalizedMessage
in interface NlsMessage
locale
- is the locale to translate to.resolver
- is used to resolve the template required to translate the
internationalized message
.buffer
- is the buffer where to write the message to.Copyright © 2001–2014 mmm-Team. All rights reserved.