|
||||||||||
PREV CLASS NEXT CLASS | FRAMES NO FRAMES | |||||||||
SUMMARY: NESTED | FIELD | CONSTR | METHOD | DETAIL: FIELD | CONSTR | METHOD |
java.lang.Objectnet.i2p.util.Translate
public abstract class Translate
Translate strings efficiently. We don't include an English or default ResourceBundle, we simply check for "en" and return the original string. Support real-time language changing with the routerconsole.lang property.
Field Summary | |
---|---|
static String |
PROP_LANG
|
Constructor Summary | |
---|---|
Translate()
|
Method Summary | |
---|---|
static void |
clearCache()
Clear the cache. |
static String |
getLanguage(I2PAppContext ctx)
|
static String |
getString(int n,
String s,
String p,
I2PAppContext ctx,
String bun)
Use GNU ngettext For .po file format see http://www.gnu.org/software/gettext/manual/gettext.html.gz#Translating-plural-forms |
static String |
getString(String key,
I2PAppContext ctx,
String bun)
lang in routerconsole.lang property, else current locale |
static String |
getString(String s,
Object o,
I2PAppContext ctx,
String bun)
translate a string with a parameter This is a lot more expensive than getString(s, ctx), so use sparingly. |
static String |
getString(String s,
Object o,
Object o2,
I2PAppContext ctx,
String bun)
for {0} and {1} |
Methods inherited from class java.lang.Object |
---|
clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait |
Field Detail |
---|
public static final String PROP_LANG
Constructor Detail |
---|
public Translate()
Method Detail |
---|
public static String getString(String key, I2PAppContext ctx, String bun)
public static String getString(String s, Object o, I2PAppContext ctx, String bun)
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 tranlslate parameter also, use _("foo {0} bar", _("baz"))
Do not double the single quotes in the parameter.
Use autoboxing to call with ints, longs, floats, etc.public static String getString(String s, Object o, Object o2, I2PAppContext ctx, String bun)
public static String getString(int n, String s, String p, I2PAppContext ctx, String bun)
n
- how manys
- singluar string, optionally with {0} e.g. "one tunnel"p
- plural string optionally with {0} e.g. "{0} tunnels"public static String getLanguage(I2PAppContext ctx)
public static void clearCache()
|
||||||||||
PREV CLASS NEXT CLASS | FRAMES NO FRAMES | |||||||||
SUMMARY: NESTED | FIELD | CONSTR | METHOD | DETAIL: FIELD | CONSTR | METHOD |