public class Messages extends Object
| Constructor and Description |
|---|
Messages()Create a messages instance using the global context |
| Modifier and Type | Method and Description |
|---|---|
String | _t(String key)lang in routerconsole.lang property, else current locale |
static String | _t(String key,
I2PAppContext ctx)Static translation method |
String | _t(String s,
Object o)translate a string with a parameter
This is a lot more expensive than getString(s, ctx), so use sparingly. |
String | _t(String s,
Object o1,
Object o2)translate a string with two parameters |
String | ngettext(String s,
String p,
int n)translate (ngettext) |
static String | ngettext(String s,
String p,
int n,
I2PAppContext ctx)translate (ngettext) |
public String _t(String key)
key - the translation keypublic static String _t(String key, I2PAppContext ctx)
key - the translation keyctx - the I2P app contextpublic String _t(String s, Object o)
s - string to be translated containing {0}
The {0} will be replaced by the parameter.
Single quotes must be doubled, i.e. ' -> '' in the string.o - parameter, not translated.
To translate parameter also, use _t("foo {0} bar", _t("baz"))
Do not double the single quotes in the parameter.
Use autoboxing to call with ints, longs, floats, etc.public String _t(String s, Object o1, Object o2)
s - string to be translated containing {0} and {1}o1 - first parametero2 - second parameterpublic String ngettext(String s, String p, int n)
s - the singular formp - the plural formn - the count for pluralizationpublic static String ngettext(String s, String p, int n, I2PAppContext ctx)
s - the singular formp - the plural formn - the count for pluralizationctx - the I2P app context