Rename _() for translation to _t() for Java 9 compatibility (ticket #1456)

This commit is contained in:
dg2-new
2015-09-25 19:55:36 +00:00
parent 04690bed9f
commit 22b9876b68
227 changed files with 2930 additions and 2927 deletions

View File

@ -881,7 +881,7 @@ public class ConsoleUpdateManager implements UpdateManager, RouterApp {
break;
case PLUGIN:
msg = "<b>" + _("New plugin version {0} is available", newVersion) + "</b>";
msg = "<b>" + _t("New plugin version {0} is available", newVersion) + "</b>";
break;
default:
@ -961,11 +961,11 @@ public class ConsoleUpdateManager implements UpdateManager, RouterApp {
case PLUGIN:
if (!success) {
msg = _("Update check failed for plugin {0}", task.getID());
msg = _t("Update check failed for plugin {0}", task.getID());
_log.logAlways(Log.WARN, msg);
msg = "<b>" + msg + "</b>";
} else if (!newer) {
msg = "<b>" + _("No new version is available for plugin {0}", task.getID()) + "</b>";
msg = "<b>" + _t("No new version is available for plugin {0}", task.getID()) + "</b>";
}
/// else success.... message for that?
@ -989,7 +989,7 @@ public class ConsoleUpdateManager implements UpdateManager, RouterApp {
buf.append(_pct.format(pct));
}
buf.append("<br>\n");
buf.append(_("{0}B transferred", DataHelper.formatSize2(downloaded)));
buf.append(_t("{0}B transferred", DataHelper.formatSize2(downloaded)));
updateStatus(buf.toString());
}
@ -1048,9 +1048,9 @@ public class ConsoleUpdateManager implements UpdateManager, RouterApp {
String uri = task.getURI().toString();
if (uri.startsWith("file:") || task.getMethod() == FILE) {
uri = DataHelper.stripHTML(task.getURI().getPath());
buf.append(_("Install failed from {0}", uri));
buf.append(_t("Install failed from {0}", uri));
} else {
buf.append(_("Transfer failed from {0}", uri));
buf.append(_t("Transfer failed from {0}", uri));
}
if (reason != null && reason.length() > 0) {
buf.append("<br>");
@ -1325,7 +1325,7 @@ public class ConsoleUpdateManager implements UpdateManager, RouterApp {
*/
private boolean handleRouterFile(URI uri, String actualVersion, File f, boolean isSU3) {
String url = uri.toString();
updateStatus("<b>" + _("Update downloaded") + "</b>");
updateStatus("<b>" + _t("Update downloaded") + "</b>");
File to = new File(_context.getRouterDir(), Router.UPDATE_FILE);
String err;
// Process the file
@ -1369,7 +1369,7 @@ public class ConsoleUpdateManager implements UpdateManager, RouterApp {
if ("install".equals(policy)) {
_log.log(Log.CRIT, "Update was downloaded and verified, restarting to install it");
updateStatus("<b>" + _("Update verified") + "</b><br>" + _("Restarting"));
updateStatus("<b>" + _t("Update verified") + "</b><br>" + _t("Restarting"));
restart();
} else {
_log.logAlways(Log.WARN, "Update was downloaded and verified, will be installed at next restart");
@ -1378,7 +1378,7 @@ public class ConsoleUpdateManager implements UpdateManager, RouterApp {
}
} else {
_log.log(Log.CRIT, err + " from " + url);
updateStatus("<b>" + err + ' ' + _("from {0}", linkify(url)) + " </b>");
updateStatus("<b>" + err + ' ' + _t("from {0}", linkify(url)) + " </b>");
}
return err == null;
}
@ -1389,11 +1389,11 @@ public class ConsoleUpdateManager implements UpdateManager, RouterApp {
*/
private boolean handleUnsignedFile(URI uri, String lastmod, File updFile) {
if (FileUtil.verifyZip(updFile)) {
updateStatus("<b>" + _("Update downloaded") + "</b>");
updateStatus("<b>" + _t("Update downloaded") + "</b>");
} else {
updFile.delete();
String url = uri.toString();
updateStatus("<b>" + _("Unsigned update file from {0} is corrupt", url) + "</b>");
updateStatus("<b>" + _t("Unsigned update file from {0} is corrupt", url) + "</b>");
_log.log(Log.CRIT, "Corrupt zip file from " + url);
return false;
}
@ -1413,7 +1413,7 @@ public class ConsoleUpdateManager implements UpdateManager, RouterApp {
_context.router().saveConfig(NewsHelper.PROP_LAST_UPDATE_TIME, Long.toString(modtime));
if ("install".equals(policy)) {
_log.log(Log.CRIT, "Update was downloaded, restarting to install it");
updateStatus("<b>" + _("Update downloaded") + "</b><br>" + _("Restarting"));
updateStatus("<b>" + _t("Update downloaded") + "</b><br>" + _t("Restarting"));
restart();
} else {
_log.logAlways(Log.WARN, "Update was downloaded, will be installed at next restart");
@ -1422,7 +1422,7 @@ public class ConsoleUpdateManager implements UpdateManager, RouterApp {
}
} else {
_log.log(Log.CRIT, "Failed copy to " + to);
updateStatus("<b>" + _("Failed copy to {0}", to.getAbsolutePath()) + "</b>");
updateStatus("<b>" + _t("Failed copy to {0}", to.getAbsolutePath()) + "</b>");
}
return copied;
}
@ -1453,14 +1453,14 @@ public class ConsoleUpdateManager implements UpdateManager, RouterApp {
}
/** translate a string */
public String _(String s) {
public String _t(String s) {
return Messages.getString(s, _context);
}
/**
* translate a string with a parameter
*/
public String _(String s, Object o) {
public String _t(String s, Object o) {
return Messages.getString(s, o, _context);
}
@ -1468,7 +1468,7 @@ public class ConsoleUpdateManager implements UpdateManager, RouterApp {
* translate a string with parameters
* @since 0.9.9
*/
public String _(String s, Object o, Object o2) {
public String _t(String s, Object o, Object o2) {
return Messages.getString(s, o, o2, _context);
}

View File

@ -44,14 +44,14 @@ class DevSU3UpdateChecker extends UpdateRunner {
if (proxyPort == ConfigUpdateHandler.DEFAULT_PROXY_PORT_INT &&
proxyHost.equals(ConfigUpdateHandler.DEFAULT_PROXY_HOST) &&
_context.portMapper().getPort(PortMapper.SVC_HTTP_PROXY) < 0) {
String msg = _("HTTP client proxy tunnel must be running");
String msg = _t("HTTP client proxy tunnel must be running");
if (_log.shouldWarn())
_log.warn(msg);
updateStatus("<b>" + msg + "</b>");
_mgr.notifyCheckComplete(this, false, false);
return;
}
//updateStatus("<b>" + _("Checking for development build update") + "</b>");
//updateStatus("<b>" + _t("Checking for development build update") + "</b>");
_baos.reset();
try {
_get = new PartialEepGet(_context, proxyHost, proxyPort, _baos, _currentURI.toString(), TrustedUpdate.HEADER_BYTES);
@ -76,7 +76,7 @@ class DevSU3UpdateChecker extends UpdateRunner {
_mgr.notifyVersionAvailable(this, _currentURI, UpdateType.ROUTER_DEV_SU3, "", UpdateMethod.HTTP,
_urls, newVersion, RouterVersion.FULL_VERSION);
} else {
//updateStatus("<b>" + _("No new version found at {0}", linkify(url)) + "</b>");
//updateStatus("<b>" + _t("No new version found at {0}", linkify(url)) + "</b>");
if (_log.shouldWarn())
_log.warn("Found old version \"" + newVersion + "\" at " + url);
}

View File

@ -88,7 +88,7 @@ class DevSU3UpdateHandler implements Checker, Updater {
return null;
UpdateRunner update = new DevSU3UpdateRunner(_context, _mgr, updateSources);
// set status before thread to ensure UI feedback
_mgr.notifyProgress(update, "<b>" + _mgr._("Updating") + "</b>");
_mgr.notifyProgress(update, "<b>" + _mgr._t("Updating") + "</b>");
return update;
}
}

View File

@ -37,7 +37,7 @@ class DevSU3UpdateRunner extends UpdateRunner {
if (proxyPort == ConfigUpdateHandler.DEFAULT_PROXY_PORT_INT &&
proxyHost.equals(ConfigUpdateHandler.DEFAULT_PROXY_HOST) &&
_context.portMapper().getPort(PortMapper.SVC_HTTP_PROXY) < 0) {
String msg = _("HTTP client proxy tunnel must be running");
String msg = _t("HTTP client proxy tunnel must be running");
if (_log.shouldWarn())
_log.warn(msg);
updateStatus("<b>" + msg + "</b>");

View File

@ -215,13 +215,13 @@ class NewsFetcher extends UpdateRunner {
_log.debug("Found version: [" + ver + "]");
if (TrustedUpdate.needsUpdate(RouterVersion.VERSION, ver)) {
if (NewsHelper.isUpdateDisabled(_context)) {
String msg = _mgr._("In-network updates disabled. Check package manager.");
String msg = _mgr._t("In-network updates disabled. Check package manager.");
_log.logAlways(Log.WARN, "Cannot update to version " + ver + ": " + msg);
_mgr.notifyVersionConstraint(this, _currentURI, ROUTER_SIGNED, "", ver, msg);
return;
}
if (NewsHelper.isBaseReadonly(_context)) {
String msg = _mgr._("No write permission for I2P install directory.");
String msg = _mgr._t("No write permission for I2P install directory.");
_log.logAlways(Log.WARN, "Cannot update to version " + ver + ": " + msg);
_mgr.notifyVersionConstraint(this, _currentURI, ROUTER_SIGNED, "", ver, msg);
return;
@ -229,7 +229,7 @@ class NewsFetcher extends UpdateRunner {
String minRouter = args.get(MIN_VERSION_KEY);
if (minRouter != null) {
if (VersionComparator.comp(RouterVersion.VERSION, minRouter) < 0) {
String msg = _mgr._("You must first update to version {0}", minRouter);
String msg = _mgr._t("You must first update to version {0}", minRouter);
_log.logAlways(Log.WARN, "Cannot update to version " + ver + ": " + msg);
_mgr.notifyVersionConstraint(this, _currentURI, ROUTER_SIGNED, "", ver, msg);
return;
@ -239,7 +239,7 @@ class NewsFetcher extends UpdateRunner {
if (minJava != null) {
String ourJava = System.getProperty("java.version");
if (VersionComparator.comp(ourJava, minJava) < 0) {
String msg = _mgr._("Requires Java version {0} but installed Java version is {1}", minJava, ourJava);
String msg = _mgr._t("Requires Java version {0} but installed Java version is {1}", minJava, ourJava);
_log.logAlways(Log.WARN, "Cannot update to version " + ver + ": " + msg);
_mgr.notifyVersionConstraint(this, _currentURI, ROUTER_SIGNED, "", ver, msg);
return;

View File

@ -52,14 +52,14 @@ class PluginUpdateChecker extends UpdateRunner {
if (proxyPort == ConfigUpdateHandler.DEFAULT_PROXY_PORT_INT &&
proxyHost.equals(ConfigUpdateHandler.DEFAULT_PROXY_HOST) &&
_context.portMapper().getPort(PortMapper.SVC_HTTP_PROXY) < 0) {
String msg = _("HTTP client proxy tunnel must be running");
String msg = _t("HTTP client proxy tunnel must be running");
if (_log.shouldWarn())
_log.warn(msg);
updateStatus("<b>" + msg + "</b>");
_mgr.notifyCheckComplete(this, false, false);
return;
}
updateStatus("<b>" + _("Checking for update of plugin {0}", _appName) + "</b>");
updateStatus("<b>" + _t("Checking for update of plugin {0}", _appName) + "</b>");
_baos.reset();
try {
_get = new PartialEepGet(_context, proxyHost, proxyPort, _baos, _currentURI.toString(), TrustedUpdate.HEADER_BYTES);

View File

@ -54,7 +54,7 @@ class PluginUpdateHandler implements Checker, Updater {
}
if (oldVersion == null || updateSources == null) {
//updateStatus("<b>" + _("Cannot check, plugin {0} is not installed", appName) + "</b>");
//updateStatus("<b>" + _t("Cannot check, plugin {0} is not installed", appName) + "</b>");
return null;
}
@ -79,7 +79,7 @@ class PluginUpdateHandler implements Checker, Updater {
UpdateRunner update = new PluginUpdateRunner(_context, _mgr, updateSources, appName, oldVersion);
// set status before thread to ensure UI feedback
_mgr.notifyProgress(update, "<b>" + _mgr._("Updating") + "</b>");
_mgr.notifyProgress(update, "<b>" + _mgr._t("Updating") + "</b>");
return update;
}
}

View File

@ -87,15 +87,15 @@ class PluginUpdateRunner extends UpdateRunner {
// strip off file:// or just file:
String xpi2pfile = _uri.getPath();
if(xpi2pfile == null || xpi2pfile.length() == 0) {
statusDone("<b>" + _("Bad URL {0}", _xpi2pURL) + "</b>");
statusDone("<b>" + _t("Bad URL {0}", _xpi2pURL) + "</b>");
} else {
// copy the contents of from to _updateFile
long alreadyTransferred = (new File(xpi2pfile)).getAbsoluteFile().length();
if(FileUtil.copy((new File(xpi2pfile)).getAbsolutePath(), _updateFile, true, false)) {
updateStatus("<b>" + _("Attempting to install from file {0}", _xpi2pURL) + "</b>");
updateStatus("<b>" + _t("Attempting to install from file {0}", _xpi2pURL) + "</b>");
transferComplete(alreadyTransferred, alreadyTransferred, 0L, _xpi2pURL, _updateFile, false);
} else {
statusDone("<b>" + _("Failed to install from file {0}, copy failed.", _xpi2pURL) + "</b>");
statusDone("<b>" + _t("Failed to install from file {0}, copy failed.", _xpi2pURL) + "</b>");
}
}
} else {
@ -108,14 +108,14 @@ class PluginUpdateRunner extends UpdateRunner {
if (shouldProxy && proxyPort == ConfigUpdateHandler.DEFAULT_PROXY_PORT_INT &&
proxyHost.equals(ConfigUpdateHandler.DEFAULT_PROXY_HOST) &&
_context.portMapper().getPort(PortMapper.SVC_HTTP_PROXY) < 0) {
String msg = _("HTTP client proxy tunnel must be running");
String msg = _t("HTTP client proxy tunnel must be running");
if (_log.shouldWarn())
_log.warn(msg);
statusDone("<b>" + msg + "</b>");
_mgr.notifyTaskFailed(this, msg, null);
return;
}
updateStatus("<b>" + _("Downloading plugin from {0}", _xpi2pURL) + "</b>");
updateStatus("<b>" + _t("Downloading plugin from {0}", _xpi2pURL) + "</b>");
try {
if (shouldProxy)
// 10 retries!!
@ -136,12 +136,12 @@ class PluginUpdateRunner extends UpdateRunner {
@Override
public void transferComplete(long alreadyTransferred, long bytesTransferred, long bytesRemaining, String url, String outputFile, boolean notModified) {
updateStatus("<b>" + _("Plugin downloaded") + "</b>");
updateStatus("<b>" + _t("Plugin downloaded") + "</b>");
File f = new File(_updateFile);
File appDir = new SecureDirectory(_context.getConfigDir(), PLUGIN_DIR);
if ((!appDir.exists()) && (!appDir.mkdir())) {
f.delete();
statusDone("<b>" + _("Cannot create plugin directory {0}", appDir.getAbsolutePath()) + "</b>");
statusDone("<b>" + _t("Cannot create plugin directory {0}", appDir.getAbsolutePath()) + "</b>");
return;
}
boolean isSU3;
@ -186,7 +186,7 @@ class PluginUpdateRunner extends UpdateRunner {
// extract to a zip file whether the sig is good or not, so we can get the properties file
String err = up.migrateFile(f, to);
if (err != null) {
statusDone("<b>" + err + ' ' + _("from {0}", url) + " </b>");
statusDone("<b>" + err + ' ' + _t("from {0}", url) + " </b>");
f.delete();
to.delete();
return;
@ -202,7 +202,7 @@ class PluginUpdateRunner extends UpdateRunner {
f.delete();
to.delete();
//updateStatus("<b>" + "Plugin contains an invalid key" + ' ' + pubkey + ' ' + signer + "</b>");
statusDone("<b>" + _("Plugin from {0} contains an invalid key", url) + "</b>");
statusDone("<b>" + _t("Plugin from {0} contains an invalid key", url) + "</b>");
return;
}
SigningPublicKey spk;
@ -211,7 +211,7 @@ class PluginUpdateRunner extends UpdateRunner {
} catch (DataFormatException dfe) {
f.delete();
to.delete();
statusDone("<b>" + _("Plugin from {0} contains an invalid key", url) + "</b>");
statusDone("<b>" + _t("Plugin from {0} contains an invalid key", url) + "</b>");
return;
}
@ -244,7 +244,7 @@ class PluginUpdateRunner extends UpdateRunner {
_log.error("Failed to verify plugin signature, corrupt plugin or bad signature, signed by: " + signer);
else
_log.error("Plugin signer \"" + signer + "\" does not match existing signer in plugin.config file \"" + signingKeyName + "\"");
statusDone("<b>" + _("Plugin signature verification of {0} failed", url) + "</b>");
statusDone("<b>" + _t("Plugin signature verification of {0} failed", url) + "</b>");
return;
}
} else if (_context.getBooleanProperty(PROP_ALLOW_NEW_KEYS)) {
@ -254,7 +254,7 @@ class PluginUpdateRunner extends UpdateRunner {
f.delete();
to.delete();
_log.error("Bad key or key mismatch - Failed to add plugin key \"" + pubkey + "\" for plugin signer \"" + signer + "\"");
statusDone("<b>" + _("Plugin signature verification of {0} failed", url) + "</b>");
statusDone("<b>" + _t("Plugin signature verification of {0} failed", url) + "</b>");
return;
}
// ...and try the verify again
@ -268,7 +268,7 @@ class PluginUpdateRunner extends UpdateRunner {
else
// shouldn't happen
_log.error("Plugin signer \"" + signer + "\" does not match new signer in plugin.config file \"" + signingKeyName + "\"");
statusDone("<b>" + _("Plugin signature verification of {0} failed", url) + "</b>");
statusDone("<b>" + _t("Plugin signature verification of {0} failed", url) + "</b>");
return;
}
} else {
@ -277,7 +277,7 @@ class PluginUpdateRunner extends UpdateRunner {
to.delete();
_log.error("Untrusted plugin key \"" + pubkey + "\" for plugin signer \"" + signer + "\"");
// don't display signer, we're really checking the key not the signer name
statusDone("<b>" + _("Plugin not installed - signer is untrusted") + "</b>");
statusDone("<b>" + _t("Plugin not installed - signer is untrusted") + "</b>");
return;
}
@ -303,7 +303,7 @@ class PluginUpdateRunner extends UpdateRunner {
sudVersion = su3.getVersionString();
signingKeyName = su3.getSignerString();
} catch (IOException ioe) {
statusDone("<b>" + ioe + ' ' + _("from {0}", url) + " </b>");
statusDone("<b>" + ioe + ' ' + _t("from {0}", url) + " </b>");
f.delete();
to.delete();
return;
@ -315,7 +315,7 @@ class PluginUpdateRunner extends UpdateRunner {
if (signer == null || signer.length() <= 0) {
f.delete();
to.delete();
statusDone("<b>" + _("Plugin from {0} contains an invalid key", url) + "</b>");
statusDone("<b>" + _t("Plugin from {0} contains an invalid key", url) + "</b>");
return;
}
if (!signer.equals(signingKeyName)) {
@ -326,7 +326,7 @@ class PluginUpdateRunner extends UpdateRunner {
else
// shouldn't happen
_log.error("Plugin signer \"" + signer + "\" does not match new signer in plugin.config file \"" + signingKeyName + "\"");
statusDone("<b>" + _("Plugin signature verification of {0} failed", url) + "</b>");
statusDone("<b>" + _t("Plugin signature verification of {0} failed", url) + "</b>");
return;
}
processFinal(to, appDir, url, props, sudVersion, null, signer);
@ -342,7 +342,7 @@ class PluginUpdateRunner extends UpdateRunner {
f.delete();
to.delete();
FileUtil.rmdir(tempDir, false);
statusDone("<b>" + _("Plugin from {0} is corrupt", url) + "</b>");
statusDone("<b>" + _t("Plugin from {0} is corrupt", url) + "</b>");
return null;
}
File installProps = new File(tempDir, "plugin.config");
@ -352,7 +352,7 @@ class PluginUpdateRunner extends UpdateRunner {
} catch (IOException ioe) {
f.delete();
to.delete();
statusDone("<b>" + _("Plugin from {0} does not contain the required configuration file", url) + "</b>");
statusDone("<b>" + _t("Plugin from {0} does not contain the required configuration file", url) + "</b>");
return null;
} finally {
// we don't need this anymore, we will unzip again
@ -374,12 +374,12 @@ class PluginUpdateRunner extends UpdateRunner {
version.indexOf("<") >= 0 || version.indexOf(">") >= 0 ||
appName.startsWith(".") || appName.indexOf("/") >= 0 || appName.indexOf("\\") >= 0) {
to.delete();
statusDone("<b>" + _("Plugin from {0} has invalid name or version", url) + "</b>");
statusDone("<b>" + _t("Plugin from {0} has invalid name or version", url) + "</b>");
return;
}
if (!version.equals(sudVersion)) {
to.delete();
statusDone("<b>" + _("Plugin {0} has mismatched versions", appName) + "</b>");
statusDone("<b>" + _t("Plugin {0} has mismatched versions", appName) + "</b>");
return;
}
// set so notifyComplete() will work
@ -390,7 +390,7 @@ class PluginUpdateRunner extends UpdateRunner {
if (minVersion != null &&
VersionComparator.comp(CoreVersion.VERSION, minVersion) < 0) {
to.delete();
statusDone("<b>" + _("This plugin requires I2P version {0} or higher", minVersion) + "</b>");
statusDone("<b>" + _t("This plugin requires I2P version {0} or higher", minVersion) + "</b>");
return;
}
@ -398,7 +398,7 @@ class PluginUpdateRunner extends UpdateRunner {
if (minVersion != null &&
VersionComparator.comp(System.getProperty("java.version"), minVersion) < 0) {
to.delete();
statusDone("<b>" + _("This plugin requires Java version {0} or higher", minVersion) + "</b>");
statusDone("<b>" + _t("This plugin requires Java version {0} or higher", minVersion) + "</b>");
return;
}
@ -407,7 +407,7 @@ class PluginUpdateRunner extends UpdateRunner {
if (destDir.exists()) {
if (Boolean.valueOf(props.getProperty("install-only")).booleanValue()) {
to.delete();
statusDone("<b>" + _("Downloaded plugin is for new installs only, but the plugin is already installed", url) + "</b>");
statusDone("<b>" + _t("Downloaded plugin is for new installs only, but the plugin is already installed", url) + "</b>");
return;
}
// compare previous version
@ -417,7 +417,7 @@ class PluginUpdateRunner extends UpdateRunner {
DataHelper.loadProps(oldProps, oldPropFile);
} catch (IOException ioe) {
to.delete();
statusDone("<b>" + _("Installed plugin does not contain the required configuration file", url) + "</b>");
statusDone("<b>" + _t("Installed plugin does not contain the required configuration file", url) + "</b>");
return;
}
String oldPubkey = oldProps.getProperty("key");
@ -425,28 +425,28 @@ class PluginUpdateRunner extends UpdateRunner {
String oldAppName = oldProps.getProperty("name");
if ((pubkey != null && !pubkey.equals(oldPubkey)) || (!signer.equals(oldKeyName)) || (!appName.equals(oldAppName))) {
to.delete();
statusDone("<b>" + _("Signature of downloaded plugin does not match installed plugin") + "</b>");
statusDone("<b>" + _t("Signature of downloaded plugin does not match installed plugin") + "</b>");
return;
}
String oldVersion = oldProps.getProperty("version");
if (oldVersion == null ||
VersionComparator.comp(oldVersion, version) >= 0) {
to.delete();
statusDone("<b>" + _("Downloaded plugin version {0} is not newer than installed plugin", version) + "</b>");
statusDone("<b>" + _t("Downloaded plugin version {0} is not newer than installed plugin", version) + "</b>");
return;
}
minVersion = ConfigClientsHelper.stripHTML(props, "min-installed-version");
if (minVersion != null &&
VersionComparator.comp(minVersion, oldVersion) > 0) {
to.delete();
statusDone("<b>" + _("Plugin update requires installed plugin version {0} or higher", minVersion) + "</b>");
statusDone("<b>" + _t("Plugin update requires installed plugin version {0} or higher", minVersion) + "</b>");
return;
}
String maxVersion = ConfigClientsHelper.stripHTML(props, "max-installed-version");
if (maxVersion != null &&
VersionComparator.comp(maxVersion, oldVersion) < 0) {
to.delete();
statusDone("<b>" + _("Plugin update requires installed plugin version {0} or lower", maxVersion) + "</b>");
statusDone("<b>" + _t("Plugin update requires installed plugin version {0} or lower", maxVersion) + "</b>");
return;
}
oldVersion = LogsHelper.jettyVersion();
@ -454,14 +454,14 @@ class PluginUpdateRunner extends UpdateRunner {
if (minVersion != null &&
VersionComparator.comp(minVersion, oldVersion) > 0) {
to.delete();
statusDone("<b>" + _("Plugin requires Jetty version {0} or higher", minVersion) + "</b>");
statusDone("<b>" + _t("Plugin requires Jetty version {0} or higher", minVersion) + "</b>");
return;
}
maxVersion = ConfigClientsHelper.stripHTML(props, "max-jetty-version");
if (maxVersion != null &&
VersionComparator.comp(maxVersion, oldVersion) < 0) {
to.delete();
statusDone("<b>" + _("Plugin requires Jetty version {0} or lower", maxVersion) + "</b>");
statusDone("<b>" + _t("Plugin requires Jetty version {0} or lower", maxVersion) + "</b>");
return;
}
// do we defer extraction and installation?
@ -470,7 +470,7 @@ class PluginUpdateRunner extends UpdateRunner {
try {
if(!FileUtil.copy(to, (new SecureFile( new SecureFile(appDir.getCanonicalPath() +"/" + appName +"/"+ ZIP).getCanonicalPath())) , true, true)) {
to.delete();
statusDone("<b>" + _("Cannot copy plugin to directory {0}", destDir.getAbsolutePath()) + "</b>");
statusDone("<b>" + _t("Cannot copy plugin to directory {0}", destDir.getAbsolutePath()) + "</b>");
return;
}
} catch (Throwable t) {
@ -480,7 +480,7 @@ class PluginUpdateRunner extends UpdateRunner {
}
// we don't need the original file anymore.
to.delete();
statusDone("<b>" + _("Plugin will be installed on next restart.") + "</b>");
statusDone("<b>" + _t("Plugin will be installed on next restart.") + "</b>");
return;
}
if (PluginStarter.isPluginRunning(appName, _context)) {
@ -498,12 +498,12 @@ class PluginUpdateRunner extends UpdateRunner {
} else {
if (Boolean.valueOf(props.getProperty("update-only")).booleanValue()) {
to.delete();
statusDone("<b>" + _("Plugin is for upgrades only, but the plugin is not installed") + "</b>");
statusDone("<b>" + _t("Plugin is for upgrades only, but the plugin is not installed") + "</b>");
return;
}
if (!destDir.mkdir()) {
to.delete();
statusDone("<b>" + _("Cannot create plugin directory {0}", destDir.getAbsolutePath()) + "</b>");
statusDone("<b>" + _t("Cannot create plugin directory {0}", destDir.getAbsolutePath()) + "</b>");
return;
}
}
@ -511,14 +511,14 @@ class PluginUpdateRunner extends UpdateRunner {
// Finally, extract the zip to the plugin directory
if (!FileUtil.extractZip(to, destDir, Log.WARN)) {
to.delete();
statusDone("<b>" + _("Failed to install plugin in {0}", destDir.getAbsolutePath()) + "</b>");
statusDone("<b>" + _t("Failed to install plugin in {0}", destDir.getAbsolutePath()) + "</b>");
return;
}
_updated = true;
to.delete();
// install != update. Changing the user's settings like this is probabbly a bad idea.
if (Boolean.valueOf( props.getProperty("dont-start-at-install")).booleanValue()) {
statusDone("<b>" + _("Plugin {0} installed", appName) + "</b>");
statusDone("<b>" + _t("Plugin {0} installed", appName) + "</b>");
if(!update) {
Properties pluginProps = PluginStarter.pluginProperties();
pluginProps.setProperty(PluginStarter.PREFIX + appName + PluginStarter.ENABLED, "false");
@ -537,16 +537,16 @@ class PluginUpdateRunner extends UpdateRunner {
link = "<a target=\"_blank\" href=\"" + linkURL + "\"/>" + linkName + "</a>";
else
link = appName;
statusDone("<b>" + _("Plugin {0} installed and started", link) + "</b>");
statusDone("<b>" + _t("Plugin {0} installed and started", link) + "</b>");
}
else
statusDone("<b>" + _("Plugin {0} installed but failed to start, check logs", appName) + "</b>");
statusDone("<b>" + _t("Plugin {0} installed but failed to start, check logs", appName) + "</b>");
} catch (Throwable e) {
statusDone("<b>" + _("Plugin {0} installed but failed to start", appName) + ": " + e + "</b>");
statusDone("<b>" + _t("Plugin {0} installed but failed to start", appName) + ": " + e + "</b>");
_log.error("Error starting plugin " + appName, e);
}
} else {
statusDone("<b>" + _("Plugin {0} installed", appName) + "</b>");
statusDone("<b>" + _t("Plugin {0} installed", appName) + "</b>");
}
}
@ -554,7 +554,7 @@ class PluginUpdateRunner extends UpdateRunner {
public void transferFailed(String url, long bytesTransferred, long bytesRemaining, int currentAttempt) {
File f = new File(_updateFile);
f.delete();
statusDone("<b>" + _("Failed to download plugin from {0}", url) + "</b>");
statusDone("<b>" + _t("Failed to download plugin from {0}", url) + "</b>");
}
private void statusDone(String msg) {

View File

@ -59,14 +59,14 @@ class UnsignedUpdateChecker extends UpdateRunner {
if (proxyPort == ConfigUpdateHandler.DEFAULT_PROXY_PORT_INT &&
proxyHost.equals(ConfigUpdateHandler.DEFAULT_PROXY_HOST) &&
_context.portMapper().getPort(PortMapper.SVC_HTTP_PROXY) < 0) {
String msg = _("HTTP client proxy tunnel must be running");
String msg = _t("HTTP client proxy tunnel must be running");
if (_log.shouldWarn())
_log.warn(msg);
updateStatus("<b>" + msg + "</b>");
return false;
}
//updateStatus("<b>" + _("Checking for development build update") + "</b>");
//updateStatus("<b>" + _t("Checking for development build update") + "</b>");
try {
EepHead get = new EepHead(_context, proxyHost, proxyPort, 0, url);
if (get.fetch()) {

View File

@ -88,7 +88,7 @@ class UnsignedUpdateHandler implements Checker, Updater {
return null;
UpdateRunner update = new UnsignedUpdateRunner(_context, _mgr, updateSources);
// set status before thread to ensure UI feedback
_mgr.notifyProgress(update, "<b>" + _mgr._("Updating") + "</b>");
_mgr.notifyProgress(update, "<b>" + _mgr._t("Updating") + "</b>");
return update;
}
}

View File

@ -38,7 +38,7 @@ class UnsignedUpdateRunner extends UpdateRunner {
if (proxyPort == ConfigUpdateHandler.DEFAULT_PROXY_PORT_INT &&
proxyHost.equals(ConfigUpdateHandler.DEFAULT_PROXY_HOST) &&
_context.portMapper().getPort(PortMapper.SVC_HTTP_PROXY) < 0) {
String msg = _("HTTP client proxy tunnel must be running");
String msg = _t("HTTP client proxy tunnel must be running");
if (_log.shouldWarn())
_log.warn(msg);
updateStatus("<b>" + msg + "</b>");

View File

@ -49,7 +49,7 @@ class UpdateHandler implements Updater {
return null;
UpdateRunner update = new UpdateRunner(_context, _mgr, type, method, updateSources);
// set status before thread to ensure UI feedback
_mgr.notifyProgress(update, "<b>" + _mgr._("Updating") + "</b>");
_mgr.notifyProgress(update, "<b>" + _mgr._t("Updating") + "</b>");
return update;
}
}

View File

@ -152,7 +152,7 @@ class UpdateRunner extends I2PAppThread implements UpdateTask, EepGet.StatusList
if (proxyPort == ConfigUpdateHandler.DEFAULT_PROXY_PORT_INT &&
proxyHost.equals(ConfigUpdateHandler.DEFAULT_PROXY_HOST) &&
_context.portMapper().getPort(PortMapper.SVC_HTTP_PROXY) < 0) {
String msg = _("HTTP client proxy tunnel must be running");
String msg = _t("HTTP client proxy tunnel must be running");
if (_log.shouldWarn())
_log.warn(msg);
updateStatus("<b>" + msg + "</b>");
@ -199,7 +199,7 @@ class UpdateRunner extends I2PAppThread implements UpdateTask, EepGet.StatusList
continue;
}
updateStatus("<b>" + _("Updating from {0}", linkify(updateURL)) + "</b>");
updateStatus("<b>" + _t("Updating from {0}", linkify(updateURL)) + "</b>");
if (_log.shouldLog(Log.DEBUG))
_log.debug("Selected update URL: " + updateURL);
@ -259,7 +259,7 @@ class UpdateRunner extends I2PAppThread implements UpdateTask, EepGet.StatusList
if (_isPartial)
return;
long d = currentWrite + bytesTransferred;
String status = "<b>" + _("Updating") + "</b>";
String status = "<b>" + _t("Updating") + "</b>";
_mgr.notifyProgress(this, status, d, d + bytesRemaining);
}
@ -272,7 +272,7 @@ class UpdateRunner extends I2PAppThread implements UpdateTask, EepGet.StatusList
if (newer) {
_newVersion = newVersion;
} else {
updateStatus("<b>" + _("No new version found at {0}", linkify(url)) + "</b>");
updateStatus("<b>" + _t("No new version found at {0}", linkify(url)) + "</b>");
if (_log.shouldLog(Log.WARN))
_log.warn("Found old version \"" + newVersion + "\" at " + url);
}
@ -295,7 +295,7 @@ class UpdateRunner extends I2PAppThread implements UpdateTask, EepGet.StatusList
if (_log.shouldLog(Log.WARN))
_log.warn("Update from " + url + " did not download completely (" +
bytesRemaining + " remaining after " + currentAttempt + " tries)");
updateStatus("<b>" + _("Transfer failed from {0}", linkify(url)) + "</b>");
updateStatus("<b>" + _t("Transfer failed from {0}", linkify(url)) + "</b>");
_mgr.notifyAttemptFailed(this, url, null);
// update() will call notifyTaskFailed() after last URL
}
@ -313,15 +313,15 @@ class UpdateRunner extends I2PAppThread implements UpdateTask, EepGet.StatusList
}
/** translate a string */
protected String _(String s) {
return _mgr._(s);
protected String _t(String s) {
return _mgr._t(s);
}
/**
* translate a string with a parameter
*/
protected String _(String s, Object o) {
return _mgr._(s, o);
protected String _t(String s, Object o) {
return _mgr._t(s, o);
}
@Override