add 2-param method, tag the java messages, fix the buttons, clean up add and create forms
This commit is contained in:
@ -76,6 +76,28 @@ public abstract class Translate {
|
||||
}
|
||||
}
|
||||
|
||||
/** for {0} and {1} */
|
||||
public static String getString(String s, Object o, Object o2, I2PAppContext ctx, String bun) {
|
||||
String lang = getLanguage(ctx);
|
||||
if (lang.equals(TEST_LANG))
|
||||
return TEST_STRING + '(' + o + ',' + o2 + ')' + TEST_STRING;
|
||||
String x = getString(s, ctx, bun);
|
||||
Object[] oArray = new Object[2];
|
||||
oArray[0] = o;
|
||||
oArray[1] = o2;
|
||||
try {
|
||||
MessageFormat fmt = new MessageFormat(x, new Locale(lang));
|
||||
return fmt.format(oArray, new StringBuffer(), null).toString();
|
||||
} catch (IllegalArgumentException iae) {
|
||||
System.err.println("Bad format: orig: \"" + s +
|
||||
"\" trans: \"" + x +
|
||||
"\" param1: \"" + o +
|
||||
"\" param2: \"" + o2 +
|
||||
"\" lang: " + lang);
|
||||
return "FIXME: " + x + ' ' + o + ',' + o2;
|
||||
}
|
||||
}
|
||||
|
||||
/** @return lang in routerconsole.lang property, else current locale */
|
||||
public static String getLanguage(I2PAppContext ctx) {
|
||||
String lang = ctx.getProperty(PROP_LANG);
|
||||
|
Reference in New Issue
Block a user