Author: toad
Date: 2007-05-05 21:01:33 +0000 (Sat, 05 May 2007)
New Revision: 13158

Modified:
   trunk/freenet/src/freenet/clients/http/bookmark/BookmarkItem.java
   trunk/freenet/src/freenet/l10n/L10n.java
   trunk/freenet/src/freenet/l10n/freenet.l10n.en.properties
   trunk/freenet/src/freenet/node/IPDetectorPluginManager.java
   trunk/freenet/src/freenet/node/Node.java
   trunk/freenet/src/freenet/node/NodeIPDetector.java
   trunk/freenet/src/freenet/node/updater/NodeUpdaterManager.java
   trunk/freenet/src/freenet/node/useralerts/BuildOldAgeUserAlert.java
   trunk/freenet/src/freenet/node/useralerts/ExtOldAgeUserAlert.java
   trunk/freenet/src/freenet/node/useralerts/IPUndetectedUserAlert.java
   trunk/freenet/src/freenet/node/useralerts/MeaningfulNodeNameUserAlert.java
Log:
L10n keys for most UserAlert's. Not all yet, will do that soon.

Modified: trunk/freenet/src/freenet/clients/http/bookmark/BookmarkItem.java
===================================================================
--- trunk/freenet/src/freenet/clients/http/bookmark/BookmarkItem.java   
2007-05-05 19:40:40 UTC (rev 13157)
+++ trunk/freenet/src/freenet/clients/http/bookmark/BookmarkItem.java   
2007-05-05 21:01:33 UTC (rev 13158)
@@ -5,9 +5,11 @@

 import freenet.keys.FreenetURI;
 import freenet.keys.USK;
+import freenet.l10n.L10n;
 import freenet.node.NodeClientCore;
 import freenet.node.useralerts.UserAlert;
 import freenet.node.useralerts.UserAlertManager;
+import freenet.support.HTMLEncoder;
 import freenet.support.HTMLNode;

 import java.net.MalformedURLException;
@@ -47,21 +49,18 @@
                }

                public String getTitle() {
-                       return "Bookmark updated: " + name;
+                       return l10n("bookmarkUpdatedTitle", "name", name);
                }

                public String getText() {
-                       return "The bookmarked site " + name
-                                       + " has been updated to edition "
-                                       + key.getSuggestedEdition();
+                       return l10n("bookmarkUpdated", new String[] { "name", 
"edition" },
+                                       new String[] { name, 
Long.toString(key.getSuggestedEdition()) });
                }

                public HTMLNode getHTMLText() {
                        HTMLNode n = new HTMLNode("div");
-                       n.addChild("#", "The bookmarked site ");
-                       n.addChild("a", "href", '/' + 
key.toString()).addChild("#", name);
-                       n.addChild("#", " has been updated to edition "
-                                       + key.getSuggestedEdition() + ".");
+                       L10n.addL10nSubstitution(n, "bookmarkUpdatedWithLink", 
new String[] { "link", "/link", "name", "edition" },
+                                       new String[] { "<a 
href=\""+key.toString()+"\">", "</a>", HTMLEncoder.encode(name), 
Long.toString(key.getSuggestedEdition()) });
                        return n;
                }

@@ -82,7 +81,7 @@
                }

                public String dismissButtonText() {
-                       return "Delete notification";
+                       return l10n("deleteBookmarkUpdateNotification");
                }

                public boolean shouldUnregisterOnDismiss() {
@@ -100,6 +99,18 @@
                alerts.unregister(alert);
        }

+       private String l10n(String key) {
+               return L10n.getString("BookmarkItem."+key);
+       }
+
+       private  String l10n(String key, String pattern, String value) {
+               return L10n.getString("BookmarkItem."+key, new String[] { 
pattern }, new String[] { value });
+       }
+
+       private String l10n(String key, String[] patterns, String[] values) {
+               return L10n.getString("BookmarkItem."+key, patterns, values);
+       }
+
        private synchronized void enableBookmark() {
                if (updated)
                        return;

Modified: trunk/freenet/src/freenet/l10n/L10n.java
===================================================================
--- trunk/freenet/src/freenet/l10n/L10n.java    2007-05-05 19:40:40 UTC (rev 
13157)
+++ trunk/freenet/src/freenet/l10n/L10n.java    2007-05-05 21:01:33 UTC (rev 
13158)
@@ -367,4 +367,8 @@
                node.addChild("%", result);
        }

+       public static String getString(String key, String pattern, String 
value) {
+               return getString(key, new String[] { pattern }, new String[] { 
value }); // FIXME code efficiently!
+       }
+
 }

Modified: trunk/freenet/src/freenet/l10n/freenet.l10n.en.properties
===================================================================
--- trunk/freenet/src/freenet/l10n/freenet.l10n.en.properties   2007-05-05 
19:40:40 UTC (rev 13157)
+++ trunk/freenet/src/freenet/l10n/freenet.l10n.en.properties   2007-05-05 
21:01:33 UTC (rev 13158)
@@ -131,6 +131,10 @@
 BookmarkEditorToadlet.invalidKeyTitle=Invalid Key
 BookmarkEditorToadlet.invalidKeyWithReason=Invalid Freenet key.
 BookmarkEditorToadlet.save=Save
+BookmarkItem.bookmarkUpdatedTitle=Bookmark Updated: ${name}
+BookmarkItem.bookmarkUpdated=The bookmarked site ${name} has been updated to 
edition ${edition}.
+BookmarkItem.bookmarkUpdatedWithLink=The bookmarked site 
${link}${name}${/link} has been updated to edition ${edition}.
+BookmarkItem.deleteBookmarkUpdateNotification=Delete notification
 ConfigToadlet.appliedTitle=Configuration Applied
 ConfigToadlet.appliedSuccess=Configuration changes were applied successfully.
 ConfigToadlet.appliedFailureTitle=Configuration Not Applied
@@ -567,6 +571,20 @@
 TextModeClientInterfaceServer.telnetPortNumberLong=Telnet port number
 TextModeClientInterfaceServer.enableInputOutput=Enable on stdout/stdin?
 TextModeClientInterfaceServer.enableInputOutputLong=Enable text mode client 
interface on standard input/output? (.enabled refers to providing a 
telnet-style server, this runs it over a socket)
+IPDetectorPluginManager.noConnectivityTitle=No UDP connectivity
+IPDetectorPluginManager.noConnectivity=Your internet connection does not 
appear to support UDP. Unless this detection is wrong, it is unlikely that 
Freenet will work on your computer at present.
+IPDetectorPluginManager.symmetricTitle=Symmetric firewall detected
+IPDetectorPluginManager.symmetric=Your internet connection appears to be 
behind a symmetric NAT or firewall. You will probably only be able to connect 
to users directly connected to the internet or behind restricted cone NATs.
+IPDetectorPluginManager.portRestrictedTitle=Port restricted cone NAT detected
+IPDetectorPluginManager.portRestricted=Your internet connection appears to be 
behind a port-restricted NAT (router). You will be able to connect to most 
other users, but not those behind symmetric NATs.
+IPDetectorPluginManager.restrictedTitle=Restricted cone NAT detected
+IPDetectorPluginManager.restricted=Your internet connection appears to be 
behind a "restricted cone" NAT (router). You should be able to connect to most 
other users.
+IPDetectorPluginManager.fullConeTitle=Full cone NAT detected
+IPDetectorPluginManager.fullCone=Your internet connection appears to be behind 
a "full cone" NAT (router). Congratulations, your node should be able to 
connect to any other Freenet node.
+IPDetectorPluginManager.directTitle=Direct internet connection detected
+IPDetectorPluginManager.direct=You appear to be directly connected to the 
internet. Congratulations, you should be able to connect to any other freenet 
node.
+IPDetectorPluginManager.suggestForwardPort= You may want to forward the port 
(UDP port number ${port}) manually. (See 
http://wiki.freenetproject.org/FirewallAndRouterIssues ).
+IPDetectorPluginManager.suggestForwardPortWithLink= You may want to 
${link}forward the port${/link} (UDP port number ${port}) manually (or you may 
already have done so, Freenet cannot easily detect this).
 Node.disablePHTLS=Disable probabilistic HTL
 Node.disablePHTLSLong=Disable probabilistic HTL (don't touch this unless you 
know what you are doing)
 Node.maxHTL=Maximum HTL
@@ -601,6 +619,13 @@
 Node.disableHangCheckersLong=Disable all hang checkers/watchdog functions. Set 
this if you are profiling Fred.
 Node.l10nLanguage=The language the node will use to display messages
 Node.l10nLanguageLong=This setting will change the language used to display 
messages. Keep in mind that some strings won't be translated until next node 
startup though.
+Node.buggyJVMWithLink=The JVM you are using (${version}) is known to be 
${link}buggy${/link}. It may produce OutOfMemoryError's when there is plenty of 
memory available. Please upgrade to at least Sun Java 1.4.2_13, 1.5.0_10 or 1.6 
(recommended).
+Node.buggyJVM=The JVM you are using (${version}) is known to be buggy. It may 
produce OutOfMemoryError's when there is plenty of memory available. Please 
upgrade to at least Sun Java 1.4.2_13, 1.5.0_10 or 1.6 (recommended). See 
http://bugs.sun.com/bugdatabase/view_bug.do?bug_id=4855795 .
+Node.buggyJVMTitle=Buggy JVM Warning
+Node.deadlockTitle=Deadlocking likely due to buggy JVM/kernel combination
+Node.deadlockWarning=WARNING: Your system appears to be running a Sun JVM with 
NPTL. This has been known to cause the node to freeze up due to the JVM losing 
a lock. Please disable NPTL if possible by setting the environment variable 
LD_ASSUME_KERNEL=2.4.1. Recent versions of the freenet installer should have 
this already; either reinstall, or edit run.sh 
(https://emu.freenetproject.org/svn/trunk/apps/installer/installclasspath/run.sh).
 On some systems you may need to install the pthreads libraries to make this 
work. Note that the node will try to automatically restart itself in the event 
of such a deadlock, but this is not be 100% reliable and will take time.
+NodeIPDetector.maybeSymmetricTitle=Connection problems
+NodeIPDetector.maybeSymmetric=It looks like your node may be behind a 
symmetric NAT. You may have connection problems: If you are behind a symmetric 
NAT you will probably only be able to connect to peers which are open to the 
internet.
 NodeUpdateManager.enabled=Check for, and download new versions
 NodeUpdateManager.enabledLong=Should your node automatically check for new 
versions of Freenet. If yes, new versions will be automatically detected and 
downloaded, but not necessarily installed. This setting resets itself always 
back to false unless the node runs within the wrapper.
 NodeUpdateManager.installNewVersions=Automatically install new versions
@@ -611,6 +636,9 @@
 NodeUpdateManager.revocationURILong=URI for the revocation key. If this is 
found the node will display its contents and disable the auto-updater.
 NodeUpdateManager.extURI=Where should the node look for updates to 
freenet-ext.jar?
 NodeUpdateManager.extURILong=Where should the node look for updates to 
freenet-ext.jar?
+NodeUpdateManager.updateFailedTitle=Update Failed!
+NodeUpdateManager.updateFailed=Update Failed: ${reason}
+NodeUpdateManager.updateCatastropheTitle=Catastrophic Update Failure!
 PluginManager.loadedPlugins=Plugins to load on start up
 PluginManager.loadedPluginsLong=A list of plugins that are started when the 
node starts
 PluginManager.loadedOnStartup=Plugins to load on startup
@@ -695,4 +723,18 @@
 NodeStat.freeHeapPercentThresholdLong=The node will try to keep it's free heap 
precentage (of max heap bytes allowed) above the threshold by refusing new 
requests
 NodeStat.statsPersister=File to store node statistics in
 NodeStat.statsPersisterLong=File to store node statistics in (not client 
statistics, and these are used to decide whether to accept requests so please 
don't delete)
+UserAlert.hide=Hide
+UserAlert.apply=Apply
+UserAlert.reset=Reset
+BuildOldAgeUserAlert.tooOldTitle=Build too old
+BuildOldAgeUserAlert.tooOld=This node's software is older than the oldest 
version (Build #${lastgood}) allowed by the newest peers we try to connect to.  
Please update your node as soon as possible as you will not be able to connect 
to peers labeled "TOO NEW" until you do. (Freenet may leave your node in the 
dust of the past if you don't upgrade.)
+ExtOldAgeUserAlert.extTooOldTitle=Freenet-ext too old
+ExtOldAgeUserAlert.extTooOld=Your freenet-ext.jar file seems to be outdated : 
we strongly advise you to update it using 
http://downloads.freenetproject.org/alpha/freenet-ext.jar.
+IPUndetectedUserAlert.unknownAddressTitle=Unknown external address
+IPUndetectedUserAlert.detecting=Freenet is currently attempting to detect your 
external IP address. If this takes more than a few minutes there is something 
wrong...
+IPUndetectedUserAlert.unknownAddress=Freenet was unable to determine your 
external IP address (or the IP address of your NAT or Firewall). You can still 
exchange references with other people, however this will only work if the other 
user is not behind a NAT or Firewall. As soon as you have connected to one 
other user in this way, Freenet will be able to determine your external IP 
address. You can determine your current IP address and tell your node with the 
'Temporary IP address hint' ${link}configuration parameter${/link}. Also, it 
would be a good idea to forward the port ${port} on your router for UDP to make 
it easy to connect to your node.
+IPUndetectedUserAlert.detectingWithConfigLink=Freenet is currently attempting 
to detect your external IP address. If this takes more than a few minutes there 
is something wrong and you can use the Temporary IP Address Hint 
${link}configuration parameter${/link}. Also, it would be a good idea to 
forward the port ${port} on your router for UDP to make it easier to connect to 
your node.
+IPUndetectedUserAlert.unknownAddressWithConfigLink=Freenet was unable to 
determine your external IP address (or the IP address of your NAT-device or 
firewall). You can still exchange references with other people, however this 
will only work if the other user is not behind a NAT-device or firewall. As 
soon as you have connected to one other user in this way, Freenet will be able 
to determine your external IP address. You can determine your current IP 
address and tell your node with the 'Temporary IP address hint' 
${link}configuration parameter${/link}. Also, it would be a good idea to 
forward the port ${port} on your router for UDP to make it easy to connect to 
your node.
+MeaningfulNodeNameUserAlert.noNodeNickTitle=Your node name isn't defined.
+MeaningfulNodeNameUserAlert.noNodeNick=It seems that your node doesn't know 
your nickname. Putting your e-mail address or IRC nickname here is generally 
speaking a good idea and helps your friends to identify your node (note that 
only your darknet peers listed on the friends page can see your node name, it 
will not be displayed to opennet peers).
 End

Modified: trunk/freenet/src/freenet/node/IPDetectorPluginManager.java
===================================================================
--- trunk/freenet/src/freenet/node/IPDetectorPluginManager.java 2007-05-05 
19:40:40 UTC (rev 13157)
+++ trunk/freenet/src/freenet/node/IPDetectorPluginManager.java 2007-05-05 
21:01:33 UTC (rev 13158)
@@ -7,6 +7,7 @@
 import java.util.Vector;

 import freenet.io.comm.Peer;
+import freenet.l10n.L10n;
 import freenet.node.useralerts.ProxyUserAlert;
 import freenet.node.useralerts.UserAlert;
 import freenet.pluginmanager.DetectedIP;
@@ -45,9 +46,8 @@
                        HTMLNode div = new HTMLNode("div");
                        div.addChild("#", text);
                        if(suggestPortForward) {
-                               div.addChild("#", " You may want to ");
-                               div.addChild("a", "href", 
"/?_CHECKED_HTTP_=http://wiki.freenetproject.org/FirewallAndRouterIssues";, 
"forward the port");
-                               div.addChild("#", " (UDP port number 
"+node.portNumber+") manually (or you may already have done so, Freenet cannot 
easily detect this).");
+                               L10n.addL10nSubstitution(div, 
"suggestForwardPortWithLink", new String[] { "link", "/link", "port" },
+                                               new String[] { "<a 
href=\"/?_CHECKED_HTTP_=http://wiki.freenetproject.org/FirewallAndRouterIssues\";>",
 "</a>", Integer.toString(node.portNumber) });
                        }
                        return div;
                }
@@ -60,7 +60,7 @@
                        if(!suggestPortForward) return text;
                        StringBuffer sb = new StringBuffer();
                        sb.append(text);
-                       sb.append(" You may want to forward the port (UDP port 
number "+node.portNumber+") manually. (See 
http://wiki.freenetproject.org/FirewallAndRouterIssues ).");
+                       sb.append(l10n("suggestForwardPort", "port", 
Integer.toString(node.portNumber)));
                        return sb.toString();
                }

@@ -109,29 +109,32 @@
                this.node = node;
                this.ticker = node.ps;
                this.detector = detector;
-               noConnectionAlert = new MyUserAlert("No UDP connectivity",
-                               "Your internet connection does not appear to 
support UDP. " +
-                               "Unless this detection is wrong, it is unlikely 
that Freenet will work on your computer at present.",
+               noConnectionAlert = new MyUserAlert( 
l10n("noConnectivityTitle"), l10n("noConnectivity"), 
                                true, UserAlert.ERROR);
-               symmetricAlert = new MyUserAlert("Symmetric firewall detected",
-                               "Your internet connection appears to be behind 
a symmetric NAT or firewall. " +
-                               "You will probably only be able to connect to 
users directly connected to the internet or behind " +
-                               "restricted cone NATs.", true, 
UserAlert.ERROR);                                
-               portRestrictedAlert = new MyUserAlert("Port restricted cone NAT 
detected",
-                               "Your internet connection appears to be behind 
a port-restricted NAT (router). "+
-                               "You will be able to connect to most other 
users, but not those behind symmetric NATs.", 
+               symmetricAlert = new MyUserAlert(l10n("symmetricTitle"), 
l10n("symmetric"), 
+                               true, UserAlert.ERROR);                         
+               portRestrictedAlert = new 
MyUserAlert(l10n("portRestrictedTitle"), l10n("portRestricted"), 
                                true, UserAlert.WARNING);
-               restrictedAlert = new MyUserAlert("Restricted cone NAT 
detected",
-                               "Your internet connection appears to be behind 
a \"restricted cone\" NAT (router). "+
-                               "You should be able to connect to most other 
users.", false, UserAlert.MINOR);
-               fullConeAlert = new MyUserAlert("Full cone NAT detected",
-                               "Your internet connection appears to be behind 
a \"full cone\" NAT (router). Congratulations, your node " +
-                               "should be able to connect to any other Freenet 
node.", false, UserAlert.MINOR);
-               connectedAlert = new MyUserAlert("Direct internet connection 
detected",
-                               "You appear to be directly connected to the 
internet. Congratulations, you should be able to connect "+
-                               "to any other freenet node.", false, 
UserAlert.MINOR);
+               restrictedAlert = new MyUserAlert(l10n("restrictedTitle"), 
l10n("restricted"), 
+                               false, UserAlert.MINOR);
+               fullConeAlert = new MyUserAlert(l10n("fullConeTitle"), 
l10n("fullCone"),
+                               false, UserAlert.MINOR);
+               connectedAlert = new MyUserAlert(l10n("directTitle"), 
l10n("direct"),
+                               false, UserAlert.MINOR);
        }

+       private String l10n(String key) {
+               return L10n.getString("IPDetectorPluginManager."+key);
+       }
+
+       public String l10n(String key, String pattern, String value) {
+               return L10n.getString("IPDetectorPluginManager."+key, new 
String[] { pattern }, new String[] { value });
+       }
+
+       public String l10n(String key, String[] patterns, String[] values) {
+               return L10n.getString("IPDetectorPluginManager."+key, patterns, 
values);
+       }
+
        /** Start the detector plugin manager. This includes running the 
plugin, if there
         * is one, and if it is necessary to do so. */
        void start() {

Modified: trunk/freenet/src/freenet/node/Node.java
===================================================================
--- trunk/freenet/src/freenet/node/Node.java    2007-05-05 19:40:40 UTC (rev 
13157)
+++ trunk/freenet/src/freenet/node/Node.java    2007-05-05 21:01:33 UTC (rev 
13158)
@@ -96,6 +96,7 @@
 import freenet.support.DoubleTokenBucket;
 import freenet.support.Fields;
 import freenet.support.FileLoggerHook;
+import freenet.support.HTMLEncoder;
 import freenet.support.HTMLNode;
 import freenet.support.HexUtil;
 import freenet.support.IllegalBase64Exception;
@@ -1368,16 +1369,6 @@
                System.out.println("Node constructor completed");
        }

-       static final String ERROR_SUN_NPTL = 
-               "WARNING: Your system appears to be running a Sun JVM with 
NPTL. " +
-               "This has been known to cause the node to freeze up due to the 
JVM losing a lock. " +
-               "Please disable NPTL if possible by setting the environment 
variable LD_ASSUME_KERNEL=2.4.1. " +
-               "Recent versions of the freenet installer should have this 
already; either reinstall, or edit " +
-               "run.sh 
(https://emu.freenetproject.org/svn/trunk/apps/installer/installclasspath/run.sh).
 " +
-               "On some systems you may need to install the pthreads libraries 
to make this work. " +
-               "Note that the node will try to automatically restart the node 
in the event of such a deadlock, " +
-               "but this will cause some disruption, and may not be 100% 
reliable.";
-       
        public void start(boolean noSwaps) throws NodeInitException {

                if(!noSwaps)
@@ -1505,9 +1496,10 @@

                                        public HTMLNode getHTMLText() {
                                                HTMLNode n = new 
HTMLNode("div");
-                                               n.addChild("#", "The JVM you 
are using ("+System.getProperty("java.vm.version")+") is known to be ");
-                                               n.addChild("a", "href", 
"/?_CHECKED_HTTP_=http://bugs.sun.com/bugdatabase/view_bug.do?bug_id=4855795";).addChild("#",
 "buggy");
-                                               n.addChild("#", ". It may 
produce OutOfMemoryError's when there is plenty of memory available. Please 
upgrade to at least Sun Java 1.4.2_13, 1.5.0_10 or 1.6 (recommended).");
+                                               L10n.addL10nSubstitution(n, 
"buggyJVMWithLink", 
+                                                               new String[] { 
"link", "/link", "version" },
+                                                               new String[] { 
"<a 
href=\"/?_CHECKED_HTTP_=http://bugs.sun.com/bugdatabase/view_bug.do?bug_id=4855795\";>",
 
+                                                               "</a>", 
HTMLEncoder.encode(System.getProperty("java.vm.version")) });
                                                return n;
                                        }

@@ -1516,12 +1508,11 @@
                                        }

                                        public String getText() {
-                                               return "The JVM you are using 
("+System.getProperty("java.vm.version")+") is known to be " +
-                                               "buggy. It may produce 
OutOfMemoryError's when there is plenty of memory available. Please upgrade to 
at least Sun Java 1.4.2_13, 1.5.0_10 or 1.6 (recommended). See 
http://bugs.sun.com/bugdatabase/view_bug.do?bug_id=4855795 .";
+                                               return l10n("buggyJVM", 
"version", System.getProperty("java.vm.version"));
                                        }

                                        public String getTitle() {
-                                               return "Buggy JVM Warning";
+                                               return l10n("buggyJVMTitle");
                                        }

                                        public boolean isValid() {
@@ -1550,6 +1541,9 @@

                        // If we are using the wrapper, we ignore:
                        // Any problem should be detected by the watchdog and 
the node will be restarted
+                       // FIXME we should only check this on x86 (x86-64 
doesn't have pthreads)
+                       // FIXME why only if not running the wrapper? It's 
worse with the wrapper of course... but if that's
+                       // the issue we should tell the user.
                        if(osName.equals("Linux") && jvmVendor.startsWith("Sun 
") && 
                                        ((osVersion.indexOf("nptl")!=-1) || 
osVersion.startsWith("2.6") || 
                                                        
osVersion.startsWith("2.7") || osVersion.startsWith("3."))
@@ -1566,8 +1560,8 @@
                                        assumeKernel = 
WrapperManager.getProperties().getProperty("set.LD_ASSUME_KERNEL");
                                }
                                if((assumeKernel == null) || 
(assumeKernel.length() == 0) || (!(assumeKernel.startsWith("2.2") || 
assumeKernel.startsWith("2.4")))) {
-                                       System.err.println(ERROR_SUN_NPTL);
-                                       Logger.error(this, ERROR_SUN_NPTL);
+                                       
System.err.println(l10n("deadlockWarning"));
+                                       Logger.error(this, 
l10n("deadlockWarning"));
                                        clientCore.alerts.register(new 
UserAlert() {

                                                public boolean userCanDismiss() 
{
@@ -1575,15 +1569,15 @@
                                                }

                                                public String getTitle() {
-                                                       return "Deadlocking 
likely due to buggy JVM/kernel combination";
+                                                       return 
l10n("deadlockTitle");
                                                }

                                                public String getText() {
-                                                       return ERROR_SUN_NPTL;
+                                                       return 
l10n("deadlockWarning");
                                                }

                                                public HTMLNode getHTMLText() {
-                                                       return new 
HTMLNode("div", ERROR_SUN_NPTL);
+                                                       return new 
HTMLNode("div", l10n("deadlockWarning"));
                                                }

                                                public short getPriorityClass() 
{
@@ -1618,6 +1612,14 @@

        }

+       private String l10n(String key) {
+               return L10n.getString("Node."+key);
+       }
+
+       private String l10n(String key, String pattern, String value) {
+               return L10n.getString("Node."+key, pattern, value);
+       }
+
        public SimpleFieldSet exportPrivateFieldSet() {
                SimpleFieldSet fs = exportPublicFieldSet(false);
                fs.put("dsaPrivKey", myPrivKey.asFieldSet());

Modified: trunk/freenet/src/freenet/node/NodeIPDetector.java
===================================================================
--- trunk/freenet/src/freenet/node/NodeIPDetector.java  2007-05-05 19:40:40 UTC 
(rev 13157)
+++ trunk/freenet/src/freenet/node/NodeIPDetector.java  2007-05-05 21:01:33 UTC 
(rev 13158)
@@ -12,6 +12,7 @@
 import freenet.io.comm.FreenetInetAddress;
 import freenet.io.comm.Peer;
 import freenet.io.comm.UdpSocketManager;
+import freenet.l10n.L10n;
 import freenet.node.useralerts.IPUndetectedUserAlert;
 import freenet.node.useralerts.SimpleUserAlert;
 import freenet.node.useralerts.UserAlert;
@@ -215,10 +216,8 @@

                                                                
if(ipDetectorManager != null && ipDetectorManager.isEmpty()) {
                                                                        
if(maybeSymmetricAlert == null) {
-                                                                               
maybeSymmetricAlert = new SimpleUserAlert(true, "Connection problems", 
-                                                                               
                "It looks like your node may be behind a symmetric NAT. You may 
have connection " +
-                                                                               
                "problems; if you are behind a symmetric NAT you will probably 
only be able to " +
-                                                                               
                "connect to peers which are open to the internet.", 
UserAlert.ERROR);
+                                                                               
maybeSymmetricAlert = new SimpleUserAlert(true, l10n("maybeSymmetricTitle"), 
+                                                                               
                l10n("maybeSymmetric"), UserAlert.ERROR);
                                                                        }
                                                                        
if(node.clientCore != null && node.clientCore.alerts != null)
                                                                                
node.clientCore.alerts.register(maybeSymmetricAlert);
@@ -240,6 +239,10 @@
                return addedValidIP;
        }

+       private String l10n(String key) {
+               return L10n.getString("NodeIPDetector."+key);
+       }
+
        Peer[] getPrimaryIPAddress() {
                if(lastIPAddress == null) return detectPrimaryIPAddress();
                return lastIPAddress;

Modified: trunk/freenet/src/freenet/node/updater/NodeUpdaterManager.java
===================================================================
--- trunk/freenet/src/freenet/node/updater/NodeUpdaterManager.java      
2007-05-05 19:40:40 UTC (rev 13157)
+++ trunk/freenet/src/freenet/node/updater/NodeUpdaterManager.java      
2007-05-05 21:01:33 UTC (rev 13158)
@@ -10,6 +10,7 @@
 import freenet.config.InvalidConfigValueException;
 import freenet.config.SubConfig;
 import freenet.keys.FreenetURI;
+import freenet.l10n.L10n;
 import freenet.node.Node;
 import freenet.node.NodeStarter;
 import freenet.node.Version;
@@ -478,7 +479,7 @@
                        return false;
                } catch (UpdateCatastropheException e) {
                        failUpdate(e.getMessage());
-                       node.clientCore.alerts.register(new 
SimpleUserAlert(false, "Catastrophic update failure", e.getMessage(), 
UserAlert.CRITICAL_ERROR));
+                       node.clientCore.alerts.register(new 
SimpleUserAlert(false, l10n("updateCatastropheTitle"), e.getMessage(), 
UserAlert.CRITICAL_ERROR));
                        return false;
                }

@@ -501,9 +502,17 @@
                Logger.error(this, "Update failed: "+reason);
                System.err.println("Update failed: "+reason);
                this.killUpdateAlerts();
-               node.clientCore.alerts.register(new SimpleUserAlert(true, 
"Update Failed!", "Update Failed: "+reason, UserAlert.ERROR));
+               node.clientCore.alerts.register(new SimpleUserAlert(true, 
l10n("updateFailedTitle"), l10n("updateFailed", "reason", reason), 
UserAlert.ERROR));
        }

+       private String l10n(String key) {
+               return L10n.getString("NodeUpdateManager."+key);
+       }
+
+       private String l10n(String key, String pattern, String value) {
+               return L10n.getString("NodeUpdateManager."+key, pattern, value);
+       }
+
        /**
         * Called when a new jar has been downloaded.
         * @param isExt If true, the new jar is the ext jar; if false, it is 
the main jar.

Modified: trunk/freenet/src/freenet/node/useralerts/BuildOldAgeUserAlert.java
===================================================================
--- trunk/freenet/src/freenet/node/useralerts/BuildOldAgeUserAlert.java 
2007-05-05 19:40:40 UTC (rev 13157)
+++ trunk/freenet/src/freenet/node/useralerts/BuildOldAgeUserAlert.java 
2007-05-05 21:01:33 UTC (rev 13158)
@@ -3,6 +3,7 @@
  * http://www.gnu.org/ for further details of the GPL. */
 package freenet.node.useralerts;

+import freenet.l10n.L10n;
 import freenet.support.HTMLNode;

 public class BuildOldAgeUserAlert implements UserAlert {
@@ -14,22 +15,26 @@
        }

        public String getTitle() {
-               return "Build too old";
+               return l10n("tooOldTitle");
        }

+       private String l10n(String key) {
+               return L10n.getString("BuildOldAgeUserAlert."+key);
+       }
+
+       private String l10n(String key, String pattern, String value) {
+               return L10n.getString("BuildOldAgeUserAlert."+key, pattern, 
value);
+       }
+
        public String getText() {
          if(lastGoodVersion == 0)
                  throw new IllegalArgumentException("Not valid");
-               String s;
-               s = "This node's software is older than the oldest version 
(Build #"+lastGoodVersion+") allowed by the newest peers we " +
-                               "try to connect to.  Please update your node as 
soon as possible as you will not be " +
-                               "able to connect to peers labeled \"TOO NEW\" 
until you do.  " +
-                               "(Freenet may leave your node in the dust of 
the past if you don't upgrade.)";
+               String s = l10n("tooOld", "lastgood", 
Integer.toString(lastGoodVersion));
                return s;
        }

        public HTMLNode getHTMLText() {
-               return new HTMLNode("div", "This node\u2019s software is older 
than the oldest version (Build #" + lastGoodVersion + ") allowed by the newest 
peers we try to connect to. Please update your node as soon as possible because 
you will not be able to connect to peers labelled \u201cTOO NEW\u201d until you 
do. (Freenet may leave your node in the dust of the past if you don\u2019t 
upgrade.");
+               return new HTMLNode("div", getText());
        }

        public short getPriorityClass() {
@@ -47,7 +52,7 @@
        }

        public String dismissButtonText(){
-               return "Hide";
+               return L10n.getString("UserAlert.hide");
        }

        public boolean shouldUnregisterOnDismiss() {

Modified: trunk/freenet/src/freenet/node/useralerts/ExtOldAgeUserAlert.java
===================================================================
--- trunk/freenet/src/freenet/node/useralerts/ExtOldAgeUserAlert.java   
2007-05-05 19:40:40 UTC (rev 13157)
+++ trunk/freenet/src/freenet/node/useralerts/ExtOldAgeUserAlert.java   
2007-05-05 21:01:33 UTC (rev 13158)
@@ -1,5 +1,6 @@
 package freenet.node.useralerts;

+import freenet.l10n.L10n;
 import freenet.support.HTMLNode;

 public class ExtOldAgeUserAlert implements UserAlert {
@@ -10,17 +11,19 @@
        }

        public String getTitle() {
-               return "Freenet-ext too old";
+               return l10n("extTooOldTitle");
        }

        public String getText() {
-               String s;
-               s = "Your freenet-ext.jar file seems to be outdated : we 
strongly advise you to update it using 
http://downloads.freenetproject.org/alpha/freenet-ext.jar.";;
-               return s;
+               return l10n("extTooOld");
        }

+       private String l10n(String key) {
+               return L10n.getString("ExtOldAgeUserAlert."+key);
+       }
+
        public HTMLNode getHTMLText() {
-               return new HTMLNode("div", "Your freenet-ext.jar file seems to 
be outdated: we strongly advise you to update it using 
http://downloads.freenetproject.org/alpha/freenet-ext.jar.";);
+               return new HTMLNode("div", getText());
        }

        public short getPriorityClass() {
@@ -36,7 +39,7 @@
        }

        public String dismissButtonText(){
-               return "Hide";
+               return L10n.getString("UserAlert.hide");
        }

        public boolean shouldUnregisterOnDismiss() {

Modified: trunk/freenet/src/freenet/node/useralerts/IPUndetectedUserAlert.java
===================================================================
--- trunk/freenet/src/freenet/node/useralerts/IPUndetectedUserAlert.java        
2007-05-05 19:40:40 UTC (rev 13157)
+++ trunk/freenet/src/freenet/node/useralerts/IPUndetectedUserAlert.java        
2007-05-05 21:01:33 UTC (rev 13158)
@@ -5,6 +5,7 @@

 import freenet.config.Option;
 import freenet.config.SubConfig;
+import freenet.l10n.L10n;
 import freenet.node.Node;
 import freenet.support.HTMLNode;

@@ -22,43 +23,40 @@
        }

        public String getTitle() {
-               return "Unknown external address";
+               return l10n("unknownAddressTitle");
        }

        public String getText() {
                if(node.ipDetector.isDetecting())
-                       return "Freenet is currently attempting to detect your 
external IP address. " +
-                                       "If this takes more than a few minutes 
there is something wrong...";
+                       return l10n("detecting");
                else
-                       return "Freenet was unable to determine your external 
IP address " +
-                               "(or the IP address of your NAT or Firewall). 
You can still exchange " +
-                               "references with other people, however this 
will only work if the other " +
-                               "user is not behind a NAT or Firewall. As soon 
as you have connected to " +
-                               "one other user in this way, Freenet will be 
able to determine your " +
-                               "external IP address. You can determine your 
current IP address and tell " +
-                               "your node with the 'Temporary IP address hint' 
configuration parameter. "+
-                               "Also, it would be a good idea to forward the 
port "+node.getPortNumber()+" on your router for UDP to make it easy to connect 
to your node.";
+                       return l10n("unknownAddress", "port", 
Integer.toString(node.getPortNumber()));
        }

+       private String l10n(String key) {
+               return L10n.getString("IPUndetectedUserAlert."+key);
+       }
+
+       private String l10n(String key, String pattern, String value) {
+               return L10n.getString("IPUndetectedUserAlert."+key, pattern, 
value);
+       }
+
        public HTMLNode getHTMLText() {
                SubConfig sc = node.config.get("node");
                Option o = sc.getOption("tempIPAddressHint");

                HTMLNode textNode = new HTMLNode("div");
-               if(node.ipDetector.isDetecting())
-                       textNode.addChild("#", "Freenet is currently attempting 
to detect your external IP address. If this takes more than a few minutes there 
is something wrong and you can use the Temporary IP Address Hint ");
-               else
-                       textNode.addChild("#", "Freenet was unable to determine 
your external IP address (or the IP address of your NAT-device or firewall). 
You can still exchange references with other people, however this will only 
work if the other user is not behind a NAT-device or firewall. As soon as you 
have connected to one other user in this way, Freenet will be able to determine 
your external IP address. You can determine your current IP address and tell 
your node with the \u201cTemporary IP Address Hint\u201d. Also, it would be a 
good idea to forward the port "+node.getPortNumber()+" on your router for UDP 
to make it easy to connect to your node.");
-               textNode.addChild("a", "href", "/config/", "configuration 
parameter");
-               textNode.addChild("#", ".");
+               L10n.addL10nSubstitution(textNode, 
node.ipDetector.isDetecting() ? "detectingWithConfigLink" : 
"unknownAddressWithConfigLink", 
+                               new String[] { "link", "/link", "port" }, 
+                               new String[] { "<a href=\"/config/\">", "</a>", 
Integer.toString(node.getPortNumber()) });
                HTMLNode formNode = textNode.addChild("form", new String[] { 
"action", "method" }, new String[] { "/config/", "post" });
                formNode.addChild("input", new String[] { "type", "name", 
"value" }, new String[] { "hidden", "formPassword", 
node.clientCore.formPassword });
                HTMLNode listNode = formNode.addChild("ul", "class", "config");
                HTMLNode itemNode = listNode.addChild("li");
                itemNode.addChild("span", "class", "configshortdesc", 
o.getShortDesc()).addChild("input", new String[] { "type", "name", "value" }, 
new String[] { "text", sc.getPrefix() + ".tempIPAddressHint", 
o.getValueString() });
                itemNode.addChild("span", "class", "configlongdesc", 
o.getLongDesc());
-               formNode.addChild("input", new String[] { "type", "value" }, 
new String[] { "submit", "Apply" });
-               formNode.addChild("input", new String[] { "type", "value" }, 
new String[] { "reset", "Reset" });
+               formNode.addChild("input", new String[] { "type", "value" }, 
new String[] { "submit", L10n.getString("UserAlert.apply") });
+               formNode.addChild("input", new String[] { "type", "value" }, 
new String[] { "reset", L10n.getString("UserAlert.apply") });
                return textNode;
        }

@@ -78,7 +76,7 @@
        }

        public String dismissButtonText(){
-               return "Hide";
+               return L10n.getString("UserAlert.hide");
        }

        public boolean shouldUnregisterOnDismiss() {

Modified: 
trunk/freenet/src/freenet/node/useralerts/MeaningfulNodeNameUserAlert.java
===================================================================
--- trunk/freenet/src/freenet/node/useralerts/MeaningfulNodeNameUserAlert.java  
2007-05-05 19:40:40 UTC (rev 13157)
+++ trunk/freenet/src/freenet/node/useralerts/MeaningfulNodeNameUserAlert.java  
2007-05-05 21:01:33 UTC (rev 13158)
@@ -5,6 +5,7 @@

 import freenet.config.Option;
 import freenet.config.SubConfig;
+import freenet.l10n.L10n;
 import freenet.node.Node;
 import freenet.support.HTMLNode;

@@ -21,17 +22,15 @@
        }

        public String getTitle() {
-               return "Your node name isn't defined";
+               return l10n("noNodeNickTitle");
        }

+       private String l10n(String key) {
+               return L10n.getString("MeaningfulNodeNameUserAlert."+key);
+       }
+
        public String getText() {
-               StringBuffer buf = new StringBuffer();
-               
-               buf.append("It seems that your node doesn't know your 
nickname." +
-               "Putting your e-mail address or IRC nickname here is generally 
speaking " +
-               "a good idea and helps your friends to identify your node.");
-               
-               return buf.toString();
+               return l10n("noNodeNick");
        }

        public HTMLNode getHTMLText() {
@@ -39,17 +38,16 @@
                Option o = sc.getOption("name");

                HTMLNode alertNode = new HTMLNode("div");
-               HTMLNode textNode = alertNode.addChild("div", "It seems that 
your node doesn\u2019t know your nickname.");
-               textNode.addChild("a", "href", "/config/", "Configuration 
Page");
-               textNode.addChild("#", ". Putting your e-mail address or IRC 
nickname there is generally speaking a good idea and helps your friends to 
identify your node.");
+               HTMLNode textNode = alertNode.addChild("div");
+               textNode.addChild(l10n("noNodeNick"));
                HTMLNode formNode = alertNode.addChild("form", new String[] { 
"action", "method" }, new String[] { "/config/", "post" });
                formNode.addChild("input", new String[] { "type", "name", 
"value" }, new String[] { "hidden", "formPassword", 
node.clientCore.formPassword });
                HTMLNode listNode = formNode.addChild("ul", "class", "config");
                HTMLNode itemNode = listNode.addChild("li");
                itemNode.addChild("span", "class", "configshortdesc", 
o.getShortDesc()).addChild("input", new String[] { "type", "name", "value" }, 
new String[] { "text", sc.getPrefix() + ".name", o.getValueString() });
                itemNode.addChild("span", "class", "configlongdesc", 
o.getLongDesc());
-               formNode.addChild("input", new String[] { "type", "value" }, 
new String[] { "submit", "Apply" });
-               formNode.addChild("input", new String[] { "type", "value" }, 
new String[] { "reset", "Reset" });
+               formNode.addChild("input", new String[] { "type", "value" }, 
new String[] { "submit", L10n.getString("UserAlert.apply") });
+               formNode.addChild("input", new String[] { "type", "value" }, 
new String[] { "reset", L10n.getString("UserAlert.apply") });

                return alertNode;
        }


Reply via email to