Constructor and Description |
---|
MessagesImpl(Locale locale,
PluralRule pluralRule,
ResourceBundle resources) |
Modifier and Type | Method and Description |
---|---|
String |
formatPluralString(double n,
String key,
Object... args)
Format the given localized message with possible plural forms
with a set of arguments.
|
String |
formatString(String key,
Object... args)
Format the given localized message with a set of arguments.
|
Enumeration<String> |
getKeys() |
Locale |
getLocale() |
PluralRule |
getPluralRule() |
String |
getPluralString(double n,
String key)
Find a localized message with possible plural forms.
|
String |
getString(String key) |
public MessagesImpl(Locale locale, PluralRule pluralRule, ResourceBundle resources)
public Locale getLocale()
public Enumeration<String> getKeys()
public PluralRule getPluralRule()
getPluralRule
in interface Messages
public String formatString(String key, Object... args)
Messages
String.format(i18n.getLocale(),i18n.getString(key),args)
formatString
in interface Messages
key
- The key to search for in the message catalog.args
- The argument to the format string.public String getPluralString(double n, String key)
Messages
<key>.<tag>
, if the associated PluralRule
return a non-null plural tag like one
or zero
.
If a message for these special keys is not found or
the plural rule return NullPointerException
, the unmodified key
is used to fetch the message.getPluralString
in interface Messages
n
- The plural denominator.key
- The key to search for in the message catalog.public String formatPluralString(double n, String key, Object... args)
Messages
String.format(i18n.getLocale(),i18n.getPluralString(n,key),args)
formatPluralString
in interface Messages
n
- The plural denominator.key
- The key to search for in the message catalog.args
- The argument to the format string.Copyright © 2016 Clazzes.org. All rights reserved.