Tagged buttons and message on conf- Net,Service,Update,Client

update Translation
This commit is contained in:
walking
2009-10-26 02:21:15 +00:00
parent 9833743eb9
commit 935b69bc71
9 changed files with 949 additions and 319 deletions

View File

@ -14,7 +14,7 @@ public class ConfigClientsHelper extends HelperBase {
public String getForm1() {
StringBuilder buf = new StringBuilder(1024);
buf.append("<table>\n");
buf.append("<tr><th align=\"right\">Client</th><th>Run at Startup?</th><th>Start Now</th><th align=\"left\">Class and arguments</th></tr>\n");
buf.append("<tr><th align=\"right\">" + _("Client") + "</th><th>" + _("Run at Startup?") + "</th><th>" + _("Start Now") + "</th><th align=\"left\">" + _("Class and arguments") + "</th></tr>\n");
List clients = ClientAppConfig.getClientApps(_context);
for (int cur = 0; cur < clients.size(); cur++) {
@ -30,7 +30,7 @@ public class ConfigClientsHelper extends HelperBase {
public String getForm2() {
StringBuilder buf = new StringBuilder(1024);
buf.append("<table>\n");
buf.append("<tr><th align=\"right\">WebApp</th><th>Run at Startup?</th><th>Start Now</th><th align=\"left\">Description</th></tr>\n");
buf.append("<tr><th align=\"right\">" + _("WebApp") + "</th><th>" + _("Run at Startup?") + "</th><th>" + _("Start Now") + "</th><th align=\"left\">" + _("Description") + "</th></tr>\n");
Properties props = RouterConsoleRunner.webAppProperties();
Set keys = new TreeSet(props.keySet());
for (Iterator iter = keys.iterator(); iter.hasNext(); ) {
@ -63,7 +63,7 @@ public class ConfigClientsHelper extends HelperBase {
}
buf.append("/></td><td align=\"center\" width=\"15%\">");
if (!enabled) {
buf.append("<button type=\"submit\" name=\"action\" value=\"Start ").append(index).append("\" >Start<span class=hide> ").append(index).append("</span></button>");
buf.append("<button type=\"submit\" name=\"action\" value=\"Start ").append(index).append("\" >" + _("Start") + "<span class=hide> ").append(index).append("</span></button>");
}
buf.append("</td><td align=\"left\" width=\"50%\">").append(desc).append("</td></tr>\n");
}

View File

@ -44,7 +44,7 @@ public class ConfigNetHandler extends FormHandler {
@Override
protected void processForm() {
if (_saveRequested || ( (_action != null) && ("Save changes".equals(_action)) )) {
if (_saveRequested || ( (_action != null) && (_("Save changes").equals(_action)) )) {
saveChanges();
} else if (_recheckReachabilityRequested) {
recheckReachability();
@ -116,7 +116,7 @@ public class ConfigNetHandler extends FormHandler {
private void recheckReachability() {
_context.commSystem().recheckReachability();
addFormNotice("Rechecking router reachability...");
addFormNotice(_("Rechecking router reachability..."));
}
/**
@ -145,7 +145,7 @@ public class ConfigNetHandler extends FormHandler {
// Todo: Catch local IPs right here rather than complaining later
_context.router().setConfigSetting(UDPTransport.PROP_EXTERNAL_HOST, uhost);
if ((!oldUdp.equals(_udpAutoIP)) || (!oldUHost.equals(uhost))) {
addFormNotice("Updating IP address");
addFormNotice(_("Updating IP address"));
restartRequired = true;
}
}
@ -163,17 +163,17 @@ public class ConfigNetHandler extends FormHandler {
if ((!oldAutoHost.equals(_ntcpAutoIP)) || ! oldNHost.equalsIgnoreCase(_ntcpHostname)) {
if ("disabled".equals(_ntcpAutoIP)) {
addFormNotice("Disabling TCP completely");
addFormNotice(_("Disabling TCP completely"));
} else if ("false".equals(_ntcpAutoIP) && _ntcpHostname.length() > 0) {
// Todo: Catch local IPs right here rather than complaining later
_context.router().setConfigSetting(ConfigNetHelper.PROP_I2NP_NTCP_HOSTNAME, _ntcpHostname);
addFormNotice("Updating inbound TCP address to " + _ntcpHostname);
addFormNotice(_("Updating inbound TCP address to") + " " + _ntcpHostname);
} else {
_context.router().removeConfigSetting(ConfigNetHelper.PROP_I2NP_NTCP_HOSTNAME);
if ("false".equals(_ntcpAutoIP))
addFormNotice("Disabling inbound TCP");
addFormNotice(_("Disabling inbound TCP"));
else
addFormNotice("Updating inbound TCP address to auto"); // true or always
addFormNotice(_("Updating inbound TCP address to auto")); // true or always
}
_context.router().setConfigSetting(ConfigNetHelper.PROP_I2NP_NTCP_AUTO_IP, _ntcpAutoIP);
_context.router().setConfigSetting(TransportManager.PROP_ENABLE_NTCP, "" + !"disabled".equals(_ntcpAutoIP));
@ -182,10 +182,10 @@ public class ConfigNetHandler extends FormHandler {
if (oldAutoPort != _ntcpAutoPort || ! oldNPort.equals(_ntcpPort)) {
if (_ntcpPort.length() > 0 && !_ntcpAutoPort) {
_context.router().setConfigSetting(ConfigNetHelper.PROP_I2NP_NTCP_PORT, _ntcpPort);
addFormNotice("Updating inbound TCP port to " + _ntcpPort);
addFormNotice(_("Updating inbound TCP port to") + " " + _ntcpPort);
} else {
_context.router().removeConfigSetting(ConfigNetHelper.PROP_I2NP_NTCP_PORT);
addFormNotice("Updating inbound TCP port to auto");
addFormNotice(_("Updating inbound TCP port to auto"));
}
_context.router().setConfigSetting(ConfigNetHelper.PROP_I2NP_NTCP_AUTO_PORT, "" + _ntcpAutoPort);
restartRequired = true;
@ -197,7 +197,7 @@ public class ConfigNetHandler extends FormHandler {
if (!oldPort.equals(_udpPort)) {
_context.router().setConfigSetting(UDPTransport.PROP_INTERNAL_PORT, _udpPort);
_context.router().setConfigSetting(UDPTransport.PROP_EXTERNAL_PORT, _udpPort);
addFormNotice("Updating UDP port from " + oldPort + " to " + _udpPort);
addFormNotice(_("Updating UDP port from") + " " + oldPort + " " + _("to") + " " + _udpPort);
restartRequired = true;
}
}
@ -213,9 +213,9 @@ public class ConfigNetHandler extends FormHandler {
if (switchRequired) {
_context.router().setConfigSetting(PROP_HIDDEN, "" + _hiddenMode);
if (_hiddenMode)
addFormError("Gracefully restarting into Hidden Router Mode");
addFormError(_("Gracefully restarting into Hidden Router Mode"));
else
addFormError("Gracefully restarting to exit Hidden Router Mode");
addFormError(_("Gracefully restarting to exit Hidden Router Mode"));
}
_context.router().setConfigSetting(Router.PROP_DYNAMIC_KEYS, "" + _dynamicKeys);
@ -224,15 +224,15 @@ public class ConfigNetHandler extends FormHandler {
_upnp) {
// This is minor, don't set restartRequired
if (_upnp)
addFormNotice("Enabling UPnP, restart required to take effect");
addFormNotice(_("Enabling UPnP, restart required to take effect"));
else
addFormNotice("Disabling UPnP, restart required to take effect");
addFormNotice(_("Disabling UPnP, restart required to take effect"));
}
_context.router().setConfigSetting(TransportManager.PROP_ENABLE_UPNP, "" + _upnp);
if (_requireIntroductions) {
_context.router().setConfigSetting(UDPTransport.PROP_FORCE_INTRODUCERS, "true");
addFormNotice("Requiring SSU introduers");
addFormNotice(_("Requiring SSU introduers"));
} else {
_context.router().removeConfigSetting(UDPTransport.PROP_FORCE_INTRODUCERS);
}
@ -246,11 +246,11 @@ public class ConfigNetHandler extends FormHandler {
}
boolean saved = _context.router().saveConfig();
if ( (_action != null) && ("Save changes".equals(_action)) ) {
if ( (_action != null) && (_("Save changes").equals(_action)) ) {
if (saved)
addFormNotice("Configuration saved successfully");
addFormNotice(_("Configuration saved successfully"));
else
addFormNotice("Error saving the configuration (applied but not saved) - please see the error logs");
addFormNotice(_("Error saving the configuration (applied but not saved) - please see the error logs"));
}
if (switchRequired) {
@ -290,7 +290,7 @@ public class ConfigNetHandler extends FormHandler {
String old = _context.router().getConfigSetting(Router.PROP_BANDWIDTH_SHARE_PERCENTAGE);
if ( (old == null) || (!old.equalsIgnoreCase(_sharePct)) ) {
_context.router().setConfigSetting(Router.PROP_BANDWIDTH_SHARE_PERCENTAGE, _sharePct);
addFormNotice("Updating bandwidth share percentage");
addFormNotice(_("Updating bandwidth share percentage"));
updated = true;
}
}
@ -360,7 +360,7 @@ public class ConfigNetHandler extends FormHandler {
if (updated && !_ratesOnly) {
_context.bandwidthLimiter().reinitialize();
addFormNotice("Updated bandwidth limits");
addFormNotice(_("Updated bandwidth limits"));
}
}
}

View File

@ -50,36 +50,36 @@ public class ConfigServiceHandler extends FormHandler {
protected void processForm() {
if (_action == null) return;
if ("Shutdown gracefully".equals(_action)) {
if (_("Shutdown gracefully").equals(_action)) {
_context.addShutdownTask(new UpdateWrapperManagerTask(Router.EXIT_GRACEFUL));
_context.router().shutdownGracefully();
addFormNotice("Graceful shutdown initiated");
} else if ("Shutdown immediately".equals(_action)) {
addFormNotice(_("Graceful shutdown initiated"));
} else if (_("Shutdown immediately").equals(_action)) {
_context.addShutdownTask(new UpdateWrapperManagerTask(Router.EXIT_HARD));
_context.router().shutdown(Router.EXIT_HARD);
addFormNotice("Shutdown immediately! boom bye bye bad bwoy");
} else if ("Cancel graceful shutdown".equals(_action)) {
addFormNotice(_("Shutdown immediately! boom bye bye bad bwoy"));
} else if (_("Cancel graceful shutdown").equals(_action)) {
_context.router().cancelGracefulShutdown();
addFormNotice("Graceful shutdown cancelled");
} else if ("Graceful restart".equals(_action)) {
addFormNotice(_("Graceful shutdown cancelled"));
} else if (_("Graceful restart").equals(_action)) {
_context.addShutdownTask(new UpdateWrapperManagerTask(Router.EXIT_GRACEFUL_RESTART));
_context.router().shutdownGracefully(Router.EXIT_GRACEFUL_RESTART);
addFormNotice("Graceful restart requested");
} else if ("Hard restart".equals(_action)) {
addFormNotice(_("Graceful restart requested"));
} else if (_("Hard restart").equals(_action)) {
_context.addShutdownTask(new UpdateWrapperManagerTask(Router.EXIT_HARD_RESTART));
_context.router().shutdown(Router.EXIT_HARD_RESTART);
addFormNotice("Hard restart requested");
} else if ("Rekey and Restart".equals(_action)) {
addFormNotice("Rekeying after graceful restart");
addFormNotice(_("Hard restart requested"));
} else if (_("Rekey and Restart").equals(_action)) {
addFormNotice(_("Rekeying after graceful restart"));
_context.addShutdownTask(new UpdateWrapperManagerAndRekeyTask(Router.EXIT_GRACEFUL_RESTART));
_context.router().shutdownGracefully(Router.EXIT_GRACEFUL_RESTART);
} else if ("Rekey and Shutdown".equals(_action)) {
addFormNotice("Rekeying after graceful shutdown");
} else if (_("Rekey and Shutdown").equals(_action)) {
addFormNotice(_("Rekeying after graceful shutdown"));
_context.addShutdownTask(new UpdateWrapperManagerAndRekeyTask(Router.EXIT_GRACEFUL));
_context.router().shutdownGracefully(Router.EXIT_GRACEFUL);
} else if ("Run I2P on startup".equals(_action)) {
} else if (_("Run I2P on startup").equals(_action)) {
installService();
} else if ("Don't run I2P on startup".equals(_action)) {
} else if (_("Don't run I2P on startup").equals(_action)) {
uninstallService();
} else if ("Dump threads".equals(_action)) {
try {
@ -88,36 +88,36 @@ public class ConfigServiceHandler extends FormHandler {
addFormError("Warning: unable to contact the service manager - " + t.getMessage());
}
addFormNotice("Threads dumped to wrapper.log");
} else if ("Show systray icon".equals(_action)) {
} else if (_("Show systray icon").equals(_action)) {
try {
SysTray tray = SysTray.getInstance();
if (tray != null) {
tray.show();
addFormNotice("System tray icon enabled.");
addFormNotice(_("System tray icon enabled."));
} else {
addFormNotice("System tray icon feature not supported on this platform. Sorry!");
addFormNotice(_("System tray icon feature not supported on this platform. Sorry!"));
}
} catch (Throwable t) {
addFormError("Warning: unable to contact the systray manager - " + t.getMessage());
addFormError(_("Warning: unable to contact the systray manager") + " - " + t.getMessage());
}
} else if ("Hide systray icon".equals(_action)) {
} else if (_("Hide systray icon").equals(_action)) {
try {
SysTray tray = SysTray.getInstance();
if (tray != null) {
tray.hide();
addFormNotice("System tray icon disabled.");
addFormNotice(_("System tray icon disabled."));
} else {
addFormNotice("System tray icon feature not supported on this platform. Sorry!");
addFormNotice(_("System tray icon feature not supported on this platform. Sorry!"));
}
} catch (Throwable t) {
addFormError("Warning: unable to contact the systray manager - " + t.getMessage());
addFormError(_("Warning: unable to contact the systray manager") + " - " + t.getMessage());
}
} else if ("View console on startup".equals(_action)) {
} else if (_("View console on startup").equals(_action)) {
browseOnStartup(true);
addFormNotice("Console is to be shown on startup");
} else if ("Do not view console on startup".equals(_action)) {
addFormNotice(_("Console is to be shown on startup"));
} else if (_("Do not view console on startup").equals(_action)) {
browseOnStartup(false);
addFormNotice("Console is not to be shown on startup");
addFormNotice(_("Console is not to be shown on startup"));
} else {
//addFormNotice("Blah blah blah. whatever. I'm not going to " + _action);
}
@ -126,17 +126,17 @@ public class ConfigServiceHandler extends FormHandler {
private void installService() {
try {
Runtime.getRuntime().exec("install_i2p_service_winnt.bat");
addFormNotice("Service installed");
addFormNotice(_("Service installed"));
} catch (IOException ioe) {
addFormError("Warning: unable to install the service - " + ioe.getMessage());
addFormError(_("Warning: unable to install the service") + " - " + ioe.getMessage());
}
}
private void uninstallService() {
try {
Runtime.getRuntime().exec("uninstall_i2p_service_winnt.bat");
addFormNotice("Service removed");
addFormNotice(_("Service removed"));
} catch (IOException ioe) {
addFormError("Warning: unable to remove the service - " + ioe.getMessage());
addFormError(_("Warning: unable to remove the service") + " - " + ioe.getMessage());
}
}

View File

@ -51,25 +51,25 @@ public class ConfigUpdateHandler extends FormHandler {
@Override
protected void processForm() {
if (_action != null && _action.startsWith("Check")) {
if (_action != null && _action.equals(_("Check for updates"))) {
NewsFetcher fetcher = NewsFetcher.getInstance(I2PAppContext.getGlobalContext());
fetcher.fetchNews();
if (fetcher.shouldFetchUnsigned())
fetcher.fetchUnsignedHead();
if (fetcher.updateAvailable() || fetcher.unsignedUpdateAvailable()) {
if ( (_updatePolicy == null) || (!_updatePolicy.equals("notify")) )
addFormNotice("Update available, attempting to download now");
addFormNotice(_("Update available, attempting to download now"));
else
addFormNotice("Update available, click button on left to download");
addFormNotice(_("Update available, click button on left to download"));
} else
addFormNotice("No update available");
addFormNotice(_("No update available"));
}
if ( (_newsURL != null) && (_newsURL.length() > 0) ) {
String oldURL = ConfigUpdateHelper.getNewsURL(_context);
if ( (oldURL == null) || (!_newsURL.equals(oldURL)) ) {
_context.router().setConfigSetting(PROP_NEWS_URL, _newsURL);
addFormNotice("Updating news URL to " + _newsURL);
addFormNotice(_("Updating news URL to") + " " + _newsURL);
}
}
@ -77,7 +77,7 @@ public class ConfigUpdateHandler extends FormHandler {
String oldHost = _context.router().getConfigSetting(PROP_PROXY_HOST);
if ( (oldHost == null) || (!_proxyHost.equals(oldHost)) ) {
_context.router().setConfigSetting(PROP_PROXY_HOST, _proxyHost);
addFormNotice("Updating proxy host to " + _proxyHost);
addFormNotice(_("Updating proxy host to") + " " + _proxyHost);
}
}
@ -85,7 +85,7 @@ public class ConfigUpdateHandler extends FormHandler {
String oldPort = _context.router().getConfigSetting(PROP_PROXY_PORT);
if ( (oldPort == null) || (!_proxyPort.equals(oldPort)) ) {
_context.router().setConfigSetting(PROP_PROXY_PORT, _proxyPort);
addFormNotice("Updating proxy port to " + _proxyPort);
addFormNotice(_("Updating proxy port to") + " " + _proxyPort);
}
}
@ -98,14 +98,14 @@ public class ConfigUpdateHandler extends FormHandler {
try { oldFreq = Long.parseLong(oldFreqStr); } catch (NumberFormatException nfe) {}
if (_refreshFrequency != oldFreq) {
_context.router().setConfigSetting(PROP_REFRESH_FREQUENCY, ""+_refreshFrequency);
addFormNotice("Updating refresh frequency to " + DataHelper.formatDuration(_refreshFrequency));
addFormNotice(_("Updating refresh frequency to") + " " + DataHelper.formatDuration(_refreshFrequency));
}
if ( (_updatePolicy != null) && (_updatePolicy.length() > 0) ) {
String oldPolicy = _context.router().getConfigSetting(PROP_UPDATE_POLICY);
if ( (oldPolicy == null) || (!_updatePolicy.equals(oldPolicy)) ) {
_context.router().setConfigSetting(PROP_UPDATE_POLICY, _updatePolicy);
addFormNotice("Updating update policy to " + _updatePolicy);
addFormNotice(_("Updating update policy to") + " " + _updatePolicy);
}
}
@ -114,7 +114,7 @@ public class ConfigUpdateHandler extends FormHandler {
String oldURL = _context.router().getConfigSetting(PROP_UPDATE_URL);
if ( (oldURL == null) || (!_updateURL.equals(oldURL)) ) {
_context.router().setConfigSetting(PROP_UPDATE_URL, _updateURL);
addFormNotice("Updating update URLs.");
addFormNotice(_("Updating update URLs."));
}
}
@ -122,7 +122,7 @@ public class ConfigUpdateHandler extends FormHandler {
String oldKeys = new TrustedUpdate(_context).getTrustedKeysString();
if ( (oldKeys == null) || (!_trustedKeys.equals(oldKeys)) ) {
_context.router().setConfigSetting(PROP_TRUSTED_KEYS, _trustedKeys);
addFormNotice("Updating trusted keys.");
addFormNotice(_("Updating trusted keys."));
}
}
@ -130,7 +130,7 @@ public class ConfigUpdateHandler extends FormHandler {
String oldURL = _context.router().getConfigSetting(PROP_ZIP_URL);
if ( (oldURL == null) || (!_zipURL.equals(oldURL)) ) {
_context.router().setConfigSetting(PROP_ZIP_URL, _zipURL);
addFormNotice("Updating unsigned update URL to " + _zipURL);
addFormNotice(_("Updating unsigned update URL to") + " " + _zipURL);
}
}

View File

@ -72,9 +72,9 @@ public class ConfigUpdateHelper extends HelperBase {
buf.append("\" selected=\"true\"");
if (PERIODS[i] == -1)
buf.append("\">Never</option>\n");
buf.append("\">" + _("Never") + "</option>\n");
else
buf.append("\">Every ").append(DataHelper.formatDuration(PERIODS[i])).append("</option>\n");
buf.append("\">" + _("Every") + " ").append(DataHelper.formatDuration(PERIODS[i])).append("</option>\n");
}
buf.append("</select>\n");
return buf.toString();
@ -89,18 +89,18 @@ public class ConfigUpdateHelper extends HelperBase {
if ("notify".equals(policy))
buf.append("<option value=\"notify\" selected=\"true\">").append(_("Notify only")).append("</option>");
else
buf.append("<option value=\"notify\">Notify only</option>");
buf.append("<option value=\"notify\">" + _("Notify only") + "</option>");
if ("download".equals(policy))
buf.append("<option value=\"download\" selected=\"true\">Download and verify only</option>");
buf.append("<option value=\"download\" selected=\"true\">" + _("Download and verify only") + "</option>");
else
buf.append("<option value=\"download\">Download and verify only</option>");
buf.append("<option value=\"download\">" + _("Download and verify only") + "</option>");
if (System.getProperty("wrapper.version") != null) {
if ("install".equals(policy))
buf.append("<option value=\"install\" selected=\"true\">Download, verify, and restart</option>");
buf.append("<option value=\"install\" selected=\"true\">" + _("Download, verify, and restart") + "</option>");
else
buf.append("<option value=\"install\">Download, verify, and restart</option>");
buf.append("<option value=\"install\">" + _("Download, verify, and restart") + "</option>");
}
buf.append("</select>\n");