Author: toad
Date: 2007-05-10 00:09:05 +0000 (Thu, 10 May 2007)
New Revision: 13187

Modified:
   trunk/freenet/src/freenet/clients/http/FProxyToadlet.java
   trunk/freenet/src/freenet/clients/http/SimpleToadletServer.java
   trunk/freenet/src/freenet/clients/http/SymlinkerToadlet.java
   trunk/freenet/src/freenet/clients/http/bookmark/BookmarkManager.java
   trunk/freenet/src/freenet/config/BooleanOption.java
   trunk/freenet/src/freenet/config/IntOption.java
   trunk/freenet/src/freenet/config/LongOption.java
   trunk/freenet/src/freenet/config/ShortOption.java
   trunk/freenet/src/freenet/config/StringArrOption.java
   trunk/freenet/src/freenet/l10n/freenet.l10n.en.properties
   trunk/freenet/src/freenet/node/ConfigurablePersister.java
   trunk/freenet/src/freenet/node/Node.java
   trunk/freenet/src/freenet/node/NodeClientCore.java
   trunk/freenet/src/freenet/node/NodeIPDetector.java
   trunk/freenet/src/freenet/node/NodeStats.java
   trunk/freenet/src/freenet/node/TestnetHandler.java
   trunk/freenet/src/freenet/node/fcp/FCPServer.java
   trunk/freenet/src/freenet/node/updater/NodeUpdateManager.java
   trunk/freenet/src/freenet/oldplugins/plugin/PluginManager.java
   trunk/freenet/src/freenet/pluginmanager/PluginManager.java
   trunk/freenet/src/freenet/support/LoggerHook.java
Log:
L10n keys for most InvalidConfigValueException's, including those for all 
non-advanced options, and a few advanced options too (which non-dev users are 
likely to use, although we don't want to present them to newbies)

Modified: trunk/freenet/src/freenet/clients/http/FProxyToadlet.java
===================================================================
--- trunk/freenet/src/freenet/clients/http/FProxyToadlet.java   2007-05-09 
23:55:01 UTC (rev 13186)
+++ trunk/freenet/src/freenet/clients/http/FProxyToadlet.java   2007-05-10 
00:09:05 UTC (rev 13187)
@@ -619,7 +619,7 @@
                }catch (BindException e){
                        Logger.error(core,"Failed to start FProxy port already 
bound: isn't Freenet already running ?");
                        System.err.println("Failed to start FProxy port already 
bound: isn't Freenet already running ?");
-                       throw new InvalidConfigValueException("Can't bind 
fproxy on that port!");
+                       throw new 
InvalidConfigValueException(l10n("cantBindPort"));
                }catch (IOException ioe) {
                        Logger.error(core,"Failed to start FProxy: "+ioe, ioe);
                }

Modified: trunk/freenet/src/freenet/clients/http/SimpleToadletServer.java
===================================================================
--- trunk/freenet/src/freenet/clients/http/SimpleToadletServer.java     
2007-05-09 23:55:01 UTC (rev 13186)
+++ trunk/freenet/src/freenet/clients/http/SimpleToadletServer.java     
2007-05-10 00:09:05 UTC (rev 13187)
@@ -27,6 +27,7 @@
 import freenet.config.SubConfig;
 import freenet.io.AllowedHosts;
 import freenet.io.NetworkInterface;
+import freenet.l10n.L10n;
 import freenet.node.NodeClientCore;
 import freenet.support.Logger;
 import freenet.support.OOMHandler;
@@ -72,7 +73,7 @@

                public void set(int newPort) throws InvalidConfigValueException 
{
                        if(port != newPort)
-                               throw new InvalidConfigValueException("Cannot 
change FProxy port number on the fly");
+                               throw new 
InvalidConfigValueException(L10n.getString("cannotChangePortOnTheFly"));
                        // FIXME
                }
        }
@@ -89,7 +90,10 @@
                                        networkInterface.setBindTo(bindTo);
                                        SimpleToadletServer.this.bindTo = 
bindTo;
                                } catch (IOException e) {
-                                       throw new 
InvalidConfigValueException("could not change bind to! " + e.getMessage()); 
+                                       // This is an advanced option for 
reasons of reducing clutter,
+                                       // but it is expected to be used by 
regular users, not devs.
+                                       // So we translate the error messages.
+                                       throw new 
InvalidConfigValueException(l10n("couldNotChangeBindTo", "error", 
e.getLocalizedMessage())); 
                                }
                        }
                }
@@ -117,7 +121,7 @@

                public void set(String CSSName) throws 
InvalidConfigValueException {
                        if((CSSName.indexOf(':') != -1) || 
(CSSName.indexOf('/') != -1))
-                               throw new InvalidConfigValueException("CSS name 
must not contain slashes or colons!");
+                               throw new 
InvalidConfigValueException(l10n("illegalCSSName"));
                        cssName = CSSName;
                        pageMaker.setTheme(cssName);
                }
@@ -143,9 +147,9 @@
                        else {
                                File tmp = new File(val.trim());
                                if(!core.allowUploadFrom(tmp))
-                                       throw new 
InvalidConfigValueException("We can't let you set that setting: \"" + tmp + "\" 
isn't in a directory from which uploads are allowed!");                         
      
+                                       throw new 
InvalidConfigValueException(l10n("cssOverrideNotInUploads", "filename", 
tmp.toString()));
                                else if(!tmp.canRead() || !tmp.isFile())
-                                       throw new 
InvalidConfigValueException("We can't read the given file! (" + val + ')');
+                                       throw new 
InvalidConfigValueException(l10n("cssOverrideCantRead", "filename", 
tmp.toString()));
                                cssOverride = tmp.getAbsoluteFile();
                        }
                        pageMaker.setOverride(cssOverride);
@@ -454,4 +458,13 @@
        public boolean isAllowedFullAccess(InetAddress remoteAddr) {
                return this.allowedFullAccess.allowed(remoteAddr);
        }
+       
+       private static String l10n(String key, String pattern, String value) {
+               return L10n.getString("SimpleToadletServer."+key, pattern, 
value);
+       }
+
+       private static String l10n(String key) {
+               return L10n.getString("SimpleToadletServer."+key);
+       }
+
 }

Modified: trunk/freenet/src/freenet/clients/http/SymlinkerToadlet.java
===================================================================
--- trunk/freenet/src/freenet/clients/http/SymlinkerToadlet.java        
2007-05-09 23:55:01 UTC (rev 13186)
+++ trunk/freenet/src/freenet/clients/http/SymlinkerToadlet.java        
2007-05-10 00:09:05 UTC (rev 13187)
@@ -33,7 +33,7 @@
                        public void set(String[] val) throws 
InvalidConfigValueException {
                                //if(storeDir.equals(new File(val))) return;
                                // FIXME
-                               throw new InvalidConfigValueException("Cannot 
set the plugins that's loaded.");
+                               throw new 
InvalidConfigValueException(L10n.getString("PluginManager.cannotSetOnceLoaded"));
                        }
                });


Modified: trunk/freenet/src/freenet/clients/http/bookmark/BookmarkManager.java
===================================================================
--- trunk/freenet/src/freenet/clients/http/bookmark/BookmarkManager.java        
2007-05-09 23:55:01 UTC (rev 13186)
+++ trunk/freenet/src/freenet/clients/http/bookmark/BookmarkManager.java        
2007-05-10 00:09:05 UTC (rev 13187)
@@ -13,6 +13,7 @@
 import freenet.config.SubConfig;
 import freenet.keys.FreenetURI;
 import freenet.keys.USK;
+import freenet.l10n.L10n;
 import freenet.node.NodeClientCore;
 import freenet.support.api.StringArrCallback;

@@ -138,8 +139,7 @@
                                                                
matcher.group(2), node.alerts), false);

                                        } else
-                                               throw new 
InvalidConfigValueException(
-                                                               "Malformed 
Bookmark");
+                                               throw new 
InvalidConfigValueException(l10n("malformedBookmark"));

                                } catch (MalformedURLException mue) {
                                        throw new 
InvalidConfigValueException(mue.getMessage());
@@ -194,6 +194,10 @@
                return true;
        }

+       public String l10n(String key) {
+               return L10n.getString("BookmarkManager."+key);
+       }
+
        public BookmarkCallback makeCB() {
                return new BookmarkCallback();
        }

Modified: trunk/freenet/src/freenet/config/BooleanOption.java
===================================================================
--- trunk/freenet/src/freenet/config/BooleanOption.java 2007-05-09 23:55:01 UTC 
(rev 13186)
+++ trunk/freenet/src/freenet/config/BooleanOption.java 2007-05-10 00:09:05 UTC 
(rev 13187)
@@ -3,6 +3,7 @@
  * http://www.gnu.org/ for further details of the GPL. */
 package freenet.config;

+import freenet.l10n.L10n;
 import freenet.support.api.BooleanCallback;

 public class BooleanOption extends Option {
@@ -33,7 +34,7 @@
                } else if(val.equalsIgnoreCase("false") || 
val.equalsIgnoreCase("no")) {
                        set(false);
                } else
-                       throw new OptionFormatException("Unrecognized boolean: 
"+val);
+                       throw new 
OptionFormatException(L10n.getString("BooleanOption.parseError", "val", val));
        }

        public void set(boolean b) throws InvalidConfigValueException {
@@ -51,7 +52,7 @@
                } else if(val.equalsIgnoreCase("false") || 
val.equalsIgnoreCase("no")) {
                        currentValue = false;
                } else
-                       throw new OptionFormatException("Unrecognized boolean: 
"+val);
+                       throw new 
OptionFormatException(L10n.getString("BooleanOption.parseError", "val", val));
        }

        public boolean isDefault() {

Modified: trunk/freenet/src/freenet/config/IntOption.java
===================================================================
--- trunk/freenet/src/freenet/config/IntOption.java     2007-05-09 23:55:01 UTC 
(rev 13186)
+++ trunk/freenet/src/freenet/config/IntOption.java     2007-05-10 00:09:05 UTC 
(rev 13187)
@@ -3,6 +3,7 @@
  * http://www.gnu.org/ for further details of the GPL. */
 package freenet.config;

+import freenet.l10n.L10n;
 import freenet.support.Fields;
 import freenet.support.api.IntCallback;

@@ -51,7 +52,7 @@
                try{
                        x = Fields.parseInt(val);
                } catch (NumberFormatException e) {
-                       throw new InvalidConfigValueException("The value 
specified can't be parsed : "+val);
+                       throw new 
InvalidConfigValueException(l10n("parseError", "val", val));
                }
                cb.set(x);
                cachedStringValue = val;
@@ -63,12 +64,16 @@
                try{
                        x = Fields.parseInt(val);
                } catch (NumberFormatException e) {
-                       throw new InvalidConfigValueException("The value 
specified can't be parsed : "+val);
+                       throw new 
InvalidConfigValueException(l10n("parseError", "val", val));
                }
                cachedStringValue = val;
                currentValue = x;
        }

+       private String l10n(String key, String pattern, String value) {
+               return L10n.getString("IntOption."+key, pattern, value);
+       }
+
        public String getValueString() {
                int val = getValue();
                if(cachedStringValue != null) return cachedStringValue;

Modified: trunk/freenet/src/freenet/config/LongOption.java
===================================================================
--- trunk/freenet/src/freenet/config/LongOption.java    2007-05-09 23:55:01 UTC 
(rev 13186)
+++ trunk/freenet/src/freenet/config/LongOption.java    2007-05-10 00:09:05 UTC 
(rev 13187)
@@ -3,6 +3,7 @@
  * http://www.gnu.org/ for further details of the GPL. */
 package freenet.config;

+import freenet.l10n.L10n;
 import freenet.support.Fields;
 import freenet.support.api.LongCallback;

@@ -51,7 +52,7 @@
                try{
                        x = Fields.parseLong(val);
                }catch (NumberFormatException e) {
-                       throw new InvalidConfigValueException("The value 
specified can't be parsed : "+val);
+                       throw new 
InvalidConfigValueException(l10n("parseError", "val", val));
                }
                cb.set(x);
                cachedStringValue = val;
@@ -71,12 +72,16 @@
                try{
                        x = Fields.parseLong(val);
                }catch (NumberFormatException e) {
-                       throw new InvalidConfigValueException("The value 
specified can't be parsed : "+val);
+                       throw new 
InvalidConfigValueException(l10n("parseError", "val", val));
                }
                cachedStringValue = val;
                currentValue = x;
        }

+       private String l10n(String key, String pattern, String value) {
+               return L10n.getString("LongOption."+key, pattern, value);
+       }
+
        public boolean isDefault() {
                getValue();
                return currentValue == defaultValue;

Modified: trunk/freenet/src/freenet/config/ShortOption.java
===================================================================
--- trunk/freenet/src/freenet/config/ShortOption.java   2007-05-09 23:55:01 UTC 
(rev 13186)
+++ trunk/freenet/src/freenet/config/ShortOption.java   2007-05-10 00:09:05 UTC 
(rev 13187)
@@ -1,5 +1,6 @@
 package freenet.config;

+import freenet.l10n.L10n;
 import freenet.support.Fields;
 import freenet.support.api.ShortCallback;

@@ -30,7 +31,7 @@
                try{
                        x= Fields.parseShort(val);
                } catch (NumberFormatException e) {
-                       throw new InvalidConfigValueException("The value 
specified can't be parsed : "+val);
+                       throw new 
InvalidConfigValueException(l10n("unrecognisedShort", "val", val));
                }
                cb.set(x);
                currentValue = x;
@@ -45,11 +46,15 @@
                try{
                        x = Fields.parseShort(val);
                } catch (NumberFormatException e) {
-                       throw new InvalidConfigValueException("The value 
specified can't be parsed : "+val);
+                       throw new 
InvalidConfigValueException(l10n("unrecognisedShort", "val", val));
                }
                currentValue = x;
        }

+       private String l10n(String key, String pattern, String value) {
+               return L10n.getString("ShortOption."+key, pattern, value);
+       }
+
        public boolean isDefault() {
                getValue();
                return currentValue == defaultValue;

Modified: trunk/freenet/src/freenet/config/StringArrOption.java
===================================================================
--- trunk/freenet/src/freenet/config/StringArrOption.java       2007-05-09 
23:55:01 UTC (rev 13186)
+++ trunk/freenet/src/freenet/config/StringArrOption.java       2007-05-10 
00:09:05 UTC (rev 13187)
@@ -2,6 +2,7 @@

 import java.util.Arrays;

+import freenet.l10n.L10n;
 import freenet.support.URLDecoder;
 import freenet.support.URLEncodedFormatException;
 import freenet.support.URLEncoder;
@@ -41,7 +42,7 @@
                try {
                        setValue(stringToArray(val));
                } catch (URLEncodedFormatException e) {
-                       throw new InvalidConfigValueException("Cannot parse 
value: "+e);
+                       throw new 
InvalidConfigValueException(l10n("parseError", "error", 
e.getLocalizedMessage()));
                }
        }

@@ -69,10 +70,14 @@
                try {
                        this.currentValue = stringToArray(val);
                } catch (URLEncodedFormatException e) {
-                       throw new InvalidConfigValueException("Cannot parse 
value: "+e);
+                       throw new 
InvalidConfigValueException(l10n("parseError", "error", 
e.getLocalizedMessage()));
                }
        }

+       private String l10n(String key, String pattern, String value) {
+               return L10n.getString("StringArrOption."+key, pattern, value);
+       }
+
        public static String arrayToString(String[] arr) {
                if (arr == null)
                        return null;

Modified: trunk/freenet/src/freenet/l10n/freenet.l10n.en.properties
===================================================================
--- trunk/freenet/src/freenet/l10n/freenet.l10n.en.properties   2007-05-09 
23:55:01 UTC (rev 13186)
+++ trunk/freenet/src/freenet/l10n/freenet.l10n.en.properties   2007-05-10 
00:09:05 UTC (rev 13187)
@@ -136,6 +136,7 @@
 BookmarkItem.bookmarkUpdatedWithLink=The bookmarked site 
${link}${name}${/link} has been updated to edition ${edition}.
 BookmarkItem.deleteBookmarkUpdateNotification=Delete notification
 BookmarkItem.unnamedBookmark=Unnamed Bookmark
+BookmarkManager.malformedBookmark=Malformed Bookmark
 ConfigToadlet.appliedTitle=Configuration Applied
 ConfigToadlet.appliedSuccess=Configuration changes were applied successfully.
 ConfigToadlet.appliedFailureTitle=Configuration Not Applied
@@ -279,6 +280,7 @@
 FProxyToadlet.stats=view statistics
 FProxyToadlet.translationTitle=Translation
 FProxyToadlet.translation=helper to translate the node's interface into your 
native language
+FProxyToadlet.cantBindPort=Can't bind fproxy on that port!
 LocalFileInsertToadlet.dirAccessDenied=You cannot browse this directory
 LocalFileInsertToadlet.listingTitle=Listing of ${path}
 LocalFileInsertToadlet.listing=Directory Listing: ${path}
@@ -561,10 +563,19 @@
 FcpServer.assumeDownloadDDAIsAllowedLong=Assume that download DDA is allowed ? 
if false, you have to issue a TestDDARequest before making any DDA access.
 FcpServer.assumeUploadDDAIsAllowed=Assume that upload DDA is allowed ?
 FcpServer.assumeUploadDDAIsAllowedLong=Assume that upload DDA is allowed ? if 
false, you have to issue a TestDDARequest before making any DDA access.
+FcpServer.downloadsFileIsDirectory=Invalid filename for downloads list: is a 
directory
+FcpServer.downloadsFileUnreadable=File exists but cannot be read
+FcpServer.downloadsFileParentDoesNotExist=Parent directory does not exist
+FcpServer.downloadsFileExistsCannotReadOrWrite=File exists but cannot read and 
write it
+FcpServer.downloadsFileDoesNotExistCannotCreate=File does not exist and cannot 
create it
+FcpServer.downloadsFileCanCreateCannotReadOrWrite=Created file but cannot read 
and write it
+FcpServer.cannotStartOrStopOnTheFly=Cannot start or stop the FCP server on the 
fly
+FcpServer.couldNotChangeBindTo=Could not change FCP bind address: ${error}.
 TestnetHandler.enable=Enable testnet mode? (DANGEROUS)
 TestnetHandler.enableLong=Whether to enable testnet mode (DANGEROUS!). Testnet 
mode eliminates your anonymity in exchange for greatly assisting the developers 
in debugging the node.
 TestnetHandler.port=Testnet port
 TestnetHandler.portLong=Testnet port number (-1 = listenPort+1000)
+TestnetHandler.cannotEnableDisableOnTheFly=On-line enable/disable of testnet 
mode impossible; restart the node and get new connections
 TextModeClientInterfaceServer.enabled=Enable TMCI
 TextModeClientInterfaceServer.enabledLong=Whether to enable the TMCI
 TextModeClientInterfaceServer.bindTo=IP address to bind to
@@ -628,8 +639,19 @@
 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.
+Node.bwlimitMustBePositive=Bandwidth limit must be positive
+Node.bandwidthLimitMustBePositiveOrMinusOne=Bandwidth limit must be positive 
or -1
+Node.invalidStoreSize=Store size must be at least 32MB
+Node.mustBePositive=Config value must be positive
+Node.storeMaxMemTooHigh=Giving more than 80% of your ram to BDB is probably 
not what you want to do!
+Node.errorApplyingConfig=Error while applying the new config : ${error}
+NodeStats.valueTooLow=This value is too low for that setting, increase it!
+NodeStats.mustBePercentValueNotFull=This value must be a percentage between 0 
and 99.
+NodeClientCore.couldNotFindOrCreateDir=Could not find or create directory
+NodeClientCore.movingTempDirOnTheFlyNotSupported=Moving temp directory on the 
fly not supported at present
 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.
+NodeIPDetector.unknownHostErrorInIPOverride=Unknown host: ${error}
 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
@@ -643,6 +665,10 @@
 NodeUpdateManager.updateFailedTitle=Update Failed!
 NodeUpdateManager.updateFailed=Update Failed: ${reason}
 NodeUpdateManager.updateCatastropheTitle=Catastrophic Update Failure!
+NodeUpdateManager.noUpdateWithoutWrapper=Cannot update because not running 
under wrapper
+NodeUpdateManager.invalidUpdateURI=Invalid update URI: ${error}
+NodeUpdateManager.invalidRevocationURI=Invalid revocation URI: ${error}
+NodeUpdateManager.invalidExtURI=Invalid ext URI: ${error}
 UpdateDeployContext.updateCatastrophe=CATASTROPHIC ERROR: Deleted ${old} but 
cannot rename ${new} to ${old} therefore THE NODE WILL NOT START! Please 
resolve the problem by renaming ${new} to ${old} manually.
 UpdateDeployContext.updateFailedNonStandardConfig=Not able to update because 
of non-standard config: written main=${main} ext=${ext} - should not happen! 
Report this to the devs, include your wrapper.conf.
 UpdateDeployContext.updateFailedCannotDeleteOldConfig=Cannot delete ${old} so 
cannot rename over it. Update failed.
@@ -653,6 +679,7 @@
 PluginManager.loadedPluginsLong=A list of plugins that are started when the 
node starts
 PluginManager.loadedOnStartup=Plugins to load on startup
 PluginManager.loadedOnStartupLong=Classpath, name and location for plugins to 
load when node starts up
+PluginManager.cannotSetOnceLoaded=Cannot set the plugins list once loaded
 RequestStarterGroup.scheduler=Priority policy of the scheduler
 RequestStarterGroup.schedulerLong=Set the priority policy scheme used by the 
scheduler.
 SimpleToadletServer.enabled=Enable FProxy?
@@ -661,6 +688,7 @@
 SimpleToadletServer.bindToLong=IP address to bind to
 SimpleToadletServer.port=FProxy port number
 SimpleToadletServer.portLong=FProxy port number
+SimpleToadletServer.cannotChangePortOnTheFly=Cannot change FProxy port number 
on the fly
 SimpleToadletServer.cssName=CSS Name
 SimpleToadletServer.cssNameLong=Name of the CSS FProxy should use
 SimpleToadletServer.advancedMode=Enable Advanced Mode?
@@ -675,6 +703,10 @@
 SimpleToadletServer.allowedFullAccessLong=Hosts granted full access (i.e. 
change config settings, restart, etc) to the node. WARNING: Be very careful who 
you give full fproxy access to!
 SimpleToadletServer.cssOverride=Override the CSS with a custom one (WARNING!)
 SimpleToadletServer.cssOverrideLong=That setting allows you to override the 
node's CSS with a custom file. WARNING: CSSes can be dangerous and won't be 
filtered! use at your own risks. (consider mailing devl at freenetproject to 
get it included in the main distribution ;) )
+SimpleToadletServer.couldNotChangeBindTo=Could not change FProxy bind address: 
${error}.
+SimpleToadletServer.illegalCSSName=CSS name must not contain slashes or colons!
+SimpleToadletServer.cssOverrideNotInUploads=We can't let you set that setting: 
"${filename} isn't in a directory from which uploads are allowed!
+SimpleToadletServer.cssOverrideCantRead=We cannot read the given CSS override 
file: ${filename}
 LogConfigHandler.enabled=Enable logging?
 LogConfigHandler.enabledLong=Set to false to completely disable logging
 LogConfigHandler.dirName=Logging directory
@@ -800,4 +832,12 @@
 UserAlertManager.alertsOnHomepage= | See them on ${link}the Freenet 
Homepage${/link}.
 PluginManager.pluginReqNewerJVMTitle=Later JVM required by plugin ${name}.
 PluginManager.pluginReqNewerJVM=The plugin ${name} seems to require a later 
JVM. Please install at least Sun java 1.5, or remove the plugin.
+LoggerHook.unrecognizedPriority=Unrecognised priority name: ${name}.
+BooleanOption.parseError=Unrecognized boolean: ${val} - try true or false
+IntOption.parseError=The value specified can't be parsed as a 32-bit integer : 
${val}
+LongOption.parseError=The value specified can't be parsed as a 64-bit integer 
: ${val}
+ShortOption.parseError=The value specified can't be parsed as a 16-bit integer 
: ${val}
+ShortOption.parseError=Cannot parse value as a string array: ${error}
+ConfigurablePersister.existsCannotReadWrite=File exists and cannot read/write 
it
+ConfigurablePersister.doesNotExistCannotCreate=File does not exist and cannot 
be created
 End
\ No newline at end of file

Modified: trunk/freenet/src/freenet/node/ConfigurablePersister.java
===================================================================
--- trunk/freenet/src/freenet/node/ConfigurablePersister.java   2007-05-09 
23:55:01 UTC (rev 13186)
+++ trunk/freenet/src/freenet/node/ConfigurablePersister.java   2007-05-10 
00:09:05 UTC (rev 13187)
@@ -5,6 +5,7 @@

 import freenet.config.InvalidConfigValueException;
 import freenet.config.SubConfig;
+import freenet.l10n.L10n;
 import freenet.node.Node.NodeInitException;
 import freenet.support.api.StringCallback;

@@ -39,26 +40,26 @@
                while(true) {
                        if(f.exists()) {
                                if(!(f.canRead() && f.canWrite()))
-                                       throw new 
InvalidConfigValueException("File exists and cannot read/write it");
+                                       throw new 
InvalidConfigValueException(l10n("existsCannotReadWrite"));
                                break;
                        } else {
                                try {
                                        f.createNewFile();
                                } catch (IOException e) {
-                                       throw new 
InvalidConfigValueException("File does not exist and cannot be created");
+                                       throw new 
InvalidConfigValueException(l10n("doesNotExistCannotCreate"));
                                }
                        }
                }
                while(true) {
                        if(tmp.exists()) {
                                if(!(tmp.canRead() && tmp.canWrite()))
-                                       throw new 
InvalidConfigValueException("File exists and cannot read/write it");
+                                       throw new 
InvalidConfigValueException(l10n("existsCannotReadWrite"));
                                break;
                        } else {
                                try {
                                        tmp.createNewFile();
                                } catch (IOException e) {
-                                       throw new 
InvalidConfigValueException("File does not exist and cannot be created");
+                                       throw new 
InvalidConfigValueException(l10n("doesNotExistCannotCreate"));
                                }
                        }
                }
@@ -69,4 +70,8 @@
                }
        }

+       private String l10n(String key) {
+               return L10n.getString("ConfigurablePersister."+key);
+       }
+
 }

Modified: trunk/freenet/src/freenet/node/Node.java
===================================================================
--- trunk/freenet/src/freenet/node/Node.java    2007-05-09 23:55:01 UTC (rev 
13186)
+++ trunk/freenet/src/freenet/node/Node.java    2007-05-10 00:09:05 UTC (rev 
13187)
@@ -136,6 +136,7 @@

                public void set(String val) throws InvalidConfigValueException {
                        if(val.equals(get())) return;
+                       // FIXME why not? Can't we use 
freenet.io.NetworkInterface like everywhere else, just adapt it for UDP?
                        throw new InvalidConfigValueException("Cannot be 
updated on the fly");
                }
        }
@@ -179,7 +180,7 @@
                        try {
                                L10n.setLanguage(val);
                        } catch (MissingResourceException e) {
-                               throw new 
InvalidConfigValueException(e.getMessage());
+                               throw new 
InvalidConfigValueException(e.getLocalizedMessage());
                        }
                }

@@ -876,7 +877,7 @@
                                                return outputBandwidthLimit;
                                        }
                                        public void set(int obwLimit) throws 
InvalidConfigValueException {
-                                               if(obwLimit <= 0) throw new 
InvalidConfigValueException("Bandwidth limit must be positive");
+                                               if(obwLimit <= 0) throw new 
InvalidConfigValueException(l10n("bwlimitMustBePositive"));
                                                synchronized(Node.this) {
                                                        outputBandwidthLimit = 
obwLimit;
                                                }
@@ -903,7 +904,7 @@
                                                                
inputLimitDefault = true;
                                                                ibwLimit = 
outputBandwidthLimit * 4;
                                                        } else {
-                                                               if(ibwLimit <= 
1) throw new InvalidConfigValueException("Bandwidth limit must be positive or 
-1");
+                                                               if(ibwLimit <= 
1) throw new 
InvalidConfigValueException(l10n("bandwidthLimitMustBePositiveOrMinusOne"));
                                                                
inputLimitDefault = false;
                                                        }
                                                }
@@ -983,7 +984,8 @@
                                        }
                                        public void set(String val) throws 
InvalidConfigValueException {
                                                if(nodeDir.equals(new 
File(val))) return;
-                                               // FIXME
+                                               // FIXME support it
+                                               // Don't translate the below as 
very few users will use it.
                                                throw new 
InvalidConfigValueException("Moving node directory on the fly not supported at 
present");
                                        }
                });
@@ -1030,7 +1032,7 @@
                                        public void set(String val) throws 
InvalidConfigValueException {
                                                if(extraPeerDataDir.equals(new 
File(val))) return;
                                                // FIXME
-                                               throw new 
InvalidConfigValueException("Moving node directory on the fly not supported at 
present");
+                                               throw new 
InvalidConfigValueException("Moving extra peer data directory on the fly not 
supported at present");
                                        }
                });
                extraPeerDataDir = new 
File(nodeConfig.getString("extraPeerDataDir"));
@@ -1072,7 +1074,7 @@

                                        public void set(long storeSize) throws 
InvalidConfigValueException {
                                                if((storeSize < 0) || 
(storeSize < (32 * 1024 * 1024)))
-                                                       throw new 
InvalidConfigValueException("Invalid store size");
+                                                       throw new 
InvalidConfigValueException(l10n("invalidStoreSize"));
                                                long newMaxStoreKeys = 
storeSize / sizePerKey;
                                                if(newMaxStoreKeys == 
maxTotalKeys) return;
                                                // Update each datastore
@@ -1216,14 +1218,14 @@

                        public void set(long val) throws 
InvalidConfigValueException {
                                if(val < 0)
-                                       throw new 
InvalidConfigValueException("Negative or zero values not supported");
+                                       throw new 
InvalidConfigValueException(l10n("mustBePositive"));
                                else if(val > (80 * 
Runtime.getRuntime().maxMemory() / 100))
-                                       throw new 
InvalidConfigValueException("Giving more than 80% of your ram to BDB is 
probably not what you want to do!");
+                                       throw new 
InvalidConfigValueException(l10n("storeMaxMemTooHigh"));
                                envMutableConfig.setCacheSize(val);
                                try{
                                        
storeEnvironment.setMutableConfig(envMutableConfig);
                                } catch (DatabaseException e) {
-                                       throw new 
InvalidConfigValueException("Error while applying the new config : 
"+e.getMessage());
+                                       throw new 
InvalidConfigValueException(l10n("errorApplyingConfig", "error", 
e.getLocalizedMessage()));
                                }
                                databaseMaxMemory = val;
                        }

Modified: trunk/freenet/src/freenet/node/NodeClientCore.java
===================================================================
--- trunk/freenet/src/freenet/node/NodeClientCore.java  2007-05-09 23:55:01 UTC 
(rev 13186)
+++ trunk/freenet/src/freenet/node/NodeClientCore.java  2007-05-10 00:09:05 UTC 
(rev 13187)
@@ -38,6 +38,7 @@
 import freenet.keys.NodeCHK;
 import freenet.keys.SSKBlock;
 import freenet.keys.SSKVerifyException;
+import freenet.l10n.L10n;
 import freenet.node.Node.NodeInitException;
 import freenet.node.fcp.FCPServer;
 import freenet.node.useralerts.UserAlertManager;
@@ -146,7 +147,7 @@
                                        public void set(String val) throws 
InvalidConfigValueException {
                                                if(tempDir.equals(new 
File(val))) return;
                                                // FIXME
-                                               throw new 
InvalidConfigValueException("Moving temp directory on the fly not supported at 
present");
+                                               throw new 
InvalidConfigValueException(l10n("movingTempDirOnTheFlyNotSupported"));
                                        }
                });

@@ -199,7 +200,8 @@
                                        return;
                                File f = new File(val);
                                if(!((f.exists() && f.isDirectory()) || 
(f.mkdir()))) {
-                                       throw new 
InvalidConfigValueException("Could not find or create directory");
+                                       // Relatively commonly used, despite 
being advanced (i.e. not something we want to show to newbies). So translate it.
+                                       throw new 
InvalidConfigValueException(l10n("couldNotFindOrCreateDir"));
                                }
                                downloadDir = new File(val);
                        }
@@ -342,6 +344,10 @@

        }

+       private static String l10n(String key) {
+               return L10n.getString("NodeClientCore."+key);
+       }
+
        protected synchronized void setDownloadAllowedDirs(String[] val) {
                int x = 0;
                downloadAllowedEverywhere = false;

Modified: trunk/freenet/src/freenet/node/NodeIPDetector.java
===================================================================
--- trunk/freenet/src/freenet/node/NodeIPDetector.java  2007-05-09 23:55:01 UTC 
(rev 13186)
+++ trunk/freenet/src/freenet/node/NodeIPDetector.java  2007-05-10 00:09:05 UTC 
(rev 13187)
@@ -243,6 +243,10 @@
                return L10n.getString("NodeIPDetector."+key);
        }

+       private String l10n(String key, String pattern, String value) {
+               return L10n.getString("NodeIPDetector."+key, pattern, value);
+       }
+
        Peer[] getPrimaryIPAddress() {
                if(lastIPAddress == null) return detectPrimaryIPAddress();
                return lastIPAddress;
@@ -325,7 +329,7 @@
                                try {
                                        addr = new FreenetInetAddress(val, 
false);
                                } catch (UnknownHostException e) {
-                                       throw new 
InvalidConfigValueException("Unknown host: "+e.getMessage());
+                                       throw new 
InvalidConfigValueException(l10n("unknownHostErrorInIPOverride", "error", 
e.getMessage()));
                                }
                                overrideIPAddress = addr;
                                lastIPAddress = null;

Modified: trunk/freenet/src/freenet/node/NodeStats.java
===================================================================
--- trunk/freenet/src/freenet/node/NodeStats.java       2007-05-09 23:55:01 UTC 
(rev 13186)
+++ trunk/freenet/src/freenet/node/NodeStats.java       2007-05-10 00:09:05 UTC 
(rev 13187)
@@ -10,6 +10,7 @@
 import freenet.crypt.RandomSource;
 import freenet.io.comm.DMT;
 import freenet.io.comm.IOStatisticCollector;
+import freenet.l10n.L10n;
 import freenet.node.Node.NodeInitException;
 import freenet.support.HTMLNode;
 import freenet.support.Logger;
@@ -190,7 +191,7 @@
                                        public void set(int val) throws 
InvalidConfigValueException {
                                                if(val == get()) return;
                                                if(val < 100)
-                                                       throw new 
InvalidConfigValueException("This value is too low for that setting, increase 
it!");
+                                                       throw new 
InvalidConfigValueException(l10n("valueTooLow"));
                                                threadLimit = val;
                                        }
                });
@@ -237,7 +238,7 @@
                                        public void set(long val) throws 
InvalidConfigValueException {
                                                if(val == get()) return;
                                                if(val < 0)
-                                                       throw new 
InvalidConfigValueException("This value is too low for that setting, increase 
it!");
+                                                       throw new 
InvalidConfigValueException(l10n("valueTooLow"));
                                                freeHeapBytesThreshold = val;
                                        }
                });
@@ -250,10 +251,8 @@
                                        }
                                        public void set(int val) throws 
InvalidConfigValueException {
                                                if(val == get()) return;
-                                               if(val < 0)
-                                                       throw new 
InvalidConfigValueException("This value is too low for that setting, increase 
it!");
-                                               if(val > 100)
-                                                       throw new 
InvalidConfigValueException("This value is too high for that setting, increase 
it!");
+                                               if(val < 0 || val >= 100)
+                                                       throw new 
InvalidConfigValueException(l10n("mustBePercentValueNotFull"));
                                                freeHeapPercentThreshold = val;
                                        }
                });
@@ -303,6 +302,10 @@
                        new TokenBucket(Math.max(ibwLimit*60, 32768*20), 
(int)((1000L*1000L*1000L) / (ibwLimit * 
FRACTION_OF_BANDWIDTH_USED_BY_REQUESTS)), 0);
        }

+       protected String l10n(String key) {
+               return L10n.getString("NodeStats."+key);
+       }
+
        public void start() throws NodeInitException {
                nodePinger.start();
                persister.start();

Modified: trunk/freenet/src/freenet/node/TestnetHandler.java
===================================================================
--- trunk/freenet/src/freenet/node/TestnetHandler.java  2007-05-09 23:55:01 UTC 
(rev 13186)
+++ trunk/freenet/src/freenet/node/TestnetHandler.java  2007-05-10 00:09:05 UTC 
(rev 13187)
@@ -21,6 +21,7 @@
 import freenet.config.Config;
 import freenet.config.InvalidConfigValueException;
 import freenet.config.SubConfig;
+import freenet.l10n.L10n;
 import freenet.node.Node.NodeInitException;
 import freenet.support.FileLoggerHook;
 import freenet.support.Logger;
@@ -220,8 +221,7 @@

                public void set(boolean val) throws InvalidConfigValueException 
{
                        if(node.testnetEnabled == val) return;
-                       String msg = "On-line enable/disable of testnet mode 
impossible; restart the node and get new connections";
-                       throw new InvalidConfigValueException(msg);
+                       throw new 
InvalidConfigValueException(L10n.getString("TestnetHandler.cannotEnableDisableOnTheFly"));
                }

        }

Modified: trunk/freenet/src/freenet/node/fcp/FCPServer.java
===================================================================
--- trunk/freenet/src/freenet/node/fcp/FCPServer.java   2007-05-09 23:55:01 UTC 
(rev 13186)
+++ trunk/freenet/src/freenet/node/fcp/FCPServer.java   2007-05-10 00:09:05 UTC 
(rev 13187)
@@ -34,6 +34,7 @@
 import freenet.io.AllowedHosts;
 import freenet.io.NetworkInterface;
 import freenet.keys.FreenetURI;
+import freenet.l10n.L10n;
 import freenet.node.Node;
 import freenet.node.NodeClientCore;
 import freenet.node.RequestStarter;
@@ -206,7 +207,7 @@
 //TODO: Allow it
                public void set(boolean val) throws InvalidConfigValueException 
{
                        if(val != get()) {
-                               throw new InvalidConfigValueException("Cannot 
change the status of the FCP server on the fly");
+                               throw new 
InvalidConfigValueException(l10n("cannotStartOrStopOnTheFly"));
                        }
                }
        }
@@ -232,7 +233,10 @@
                                        
node.getFCPServer().networkInterface.setBindTo(val);
                                        node.getFCPServer().bindTo = val;
                                } catch (IOException e) {
-                                       throw new 
InvalidConfigValueException("could not change bind to!");
+                                       // This is an advanced option for 
reasons of reducing clutter,
+                                       // but it is expected to be used by 
regular users, not devs.
+                                       // So we translate the error messages.
+                                       throw new 
InvalidConfigValueException(l10n("couldNotChangeBindTo", "error", 
e.getLocalizedMessage()));
                                }
                        }
                }
@@ -408,22 +412,45 @@

        private void checkFile(File f) throws InvalidConfigValueException {
                if(f.isDirectory()) 
-                       throw new InvalidConfigValueException("Invalid filename 
for downloads list: is a directory");
+                       throw new 
InvalidConfigValueException(l10n("downloadsFileIsDirectory"));
                if(f.isFile() && !(f.canRead() && f.canWrite()))
-                       throw new InvalidConfigValueException("File exists but 
cannot be read");
+                       throw new 
InvalidConfigValueException(l10n("downloadsFileUnreadable"));
                File parent = f.getParentFile();
                if((parent != null) && !parent.exists())
-                       throw new InvalidConfigValueException("Parent directory 
does not exist");
+                       throw new 
InvalidConfigValueException(l10n("downloadsFileParentDoesNotExist"));
                if(!f.exists()) {
                        try {
-                               if(!((f.createNewFile() || f.exists()) && 
(f.canRead() && f.canWrite())))
-                                       throw new 
InvalidConfigValueException("File does not exist, cannot create it and/or 
cannot read/write it");
+                               if(!f.createNewFile()) {
+                                       if(f.exists()) {
+                                               if(!(f.canRead() && 
f.canWrite())) {
+                                                       throw new 
InvalidConfigValueException(l10n("downloadsFileExistsCannotReadOrWrite"));
+                                               } // else ok
+                                       } else {
+                                               throw new 
InvalidConfigValueException(l10n("downloadsFileDoesNotExistCannotCreate"));
+                                       }
+                               } else {
+                                       if(!(f.canRead() && f.canWrite())) {
+                                               throw new 
InvalidConfigValueException(l10n("downloadsFileCanCreateCannotReadOrWrite"));
+                                       }
+                               }
                        } catch (IOException e) {
-                               throw new InvalidConfigValueException("File 
does not exist and cannot be created");
+                               throw new 
InvalidConfigValueException(l10n("downloadsFileDoesNotExistCannotCreate")+ " : 
"+e.getLocalizedMessage());
                        }
                }
        }

+       private static String l10n(String key) {
+               return L10n.getString("FcpServer."+key);
+       }
+       
+       private static String l10n(String key, String pattern, String value) {
+               return L10n.getString("FcpServer."+key, pattern, value);
+       }
+
+       private static String l10n(String key, String[] patterns, String[] 
values) {
+               return L10n.getString("FcpServer."+key, patterns, values);
+       }
+
        public void setPersistentDownloadsEnabled(boolean set) {
                synchronized(persistenceSync) {
                        if(enablePersistentDownloads == set) return;

Modified: trunk/freenet/src/freenet/node/updater/NodeUpdateManager.java
===================================================================
--- trunk/freenet/src/freenet/node/updater/NodeUpdateManager.java       
2007-05-09 23:55:01 UTC (rev 13186)
+++ trunk/freenet/src/freenet/node/updater/NodeUpdateManager.java       
2007-05-10 00:09:05 UTC (rev 13187)
@@ -106,7 +106,7 @@
         try {
                        updateURI = new 
FreenetURI(updaterConfig.getString("URI"));
                } catch (MalformedURLException e) {
-                       throw new InvalidConfigValueException("Invalid 
updateURI: "+e);
+                       throw new 
InvalidConfigValueException(l10n("invalidUpdateURI", "error", 
e.getLocalizedMessage()));
                }

                if(updateURI.lastMetaString() != null && 
updateURI.lastMetaString().length() == 0) {
@@ -127,7 +127,7 @@
         try {
                        revocationURI = new 
FreenetURI(updaterConfig.getString("revocationURI"));
                } catch (MalformedURLException e) {
-                       throw new InvalidConfigValueException("Invalid 
revocationURI: "+e);
+                       throw new 
InvalidConfigValueException(l10n("invalidRevocationURI", "error", 
e.getLocalizedMessage()));
                }

                if(revocationURI.lastMetaString() != null && 
revocationURI.lastMetaString().length() == 0) {
@@ -144,7 +144,7 @@
         try {
                        extURI = new 
FreenetURI(updaterConfig.getString("extURI"));
                } catch (MalformedURLException e) {
-                       throw new InvalidConfigValueException("Invalid extURI: 
"+e);
+                       throw new 
InvalidConfigValueException(l10n("invalidExtURI", "error", 
e.getLocalizedMessage()));
                }

         updaterConfig.finishedInitialization();
@@ -197,7 +197,7 @@
                        } else {
                                
if((!WrapperManager.isControlledByNativeWrapper()) || 
(NodeStarter.extBuildNumber == -1)) {
                                        Logger.error(this, "Cannot update 
because not running under wrapper");
-                                       throw new 
InvalidConfigValueException("Cannot update because not running under wrapper");
+                                       throw new 
InvalidConfigValueException(l10n("noUpdateWithoutWrapper"));
                                }
                                // Start it
                                mainUpdater = new NodeUpdater(this, updateURI, 
false, Version.buildNumber());
@@ -732,7 +732,7 @@
                        try {
                                uri = new FreenetURI(val);
                        } catch (MalformedURLException e) {
-                               throw new InvalidConfigValueException("Invalid 
key: "+val+" : "+e);
+                               throw new 
InvalidConfigValueException(l10n(isExt ? "invalidExtURI" : "invalidUpdateURI", 
"error", e.getLocalizedMessage()));
                        }
                        setURI(isExt, uri);
                }
@@ -750,7 +750,7 @@
                        try {
                                uri = new FreenetURI(val);
                        } catch (MalformedURLException e) {
-                               throw new InvalidConfigValueException("Invalid 
key: "+val+" : "+e);
+                               throw new 
InvalidConfigValueException(l10n("invalidRevocationURI", "error", 
e.getLocalizedMessage()));
                        }
                        setRevocationURI(uri);
                }

Modified: trunk/freenet/src/freenet/oldplugins/plugin/PluginManager.java
===================================================================
--- trunk/freenet/src/freenet/oldplugins/plugin/PluginManager.java      
2007-05-09 23:55:01 UTC (rev 13186)
+++ trunk/freenet/src/freenet/oldplugins/plugin/PluginManager.java      
2007-05-10 00:09:05 UTC (rev 13187)
@@ -11,6 +11,7 @@

 import freenet.config.InvalidConfigValueException;
 import freenet.config.SubConfig;
+import freenet.l10n.L10n;
 import freenet.node.Node;
 import freenet.node.NodeClientCore;
 import freenet.support.Logger;
@@ -81,7 +82,7 @@
                         *             is not valid
                         */
                        public void set(String[] val) throws 
InvalidConfigValueException {
-                               throw new InvalidConfigValueException("Not 
supported");
+                               throw new 
InvalidConfigValueException(L10n.getString("PluginManager.cannotSetOnceLoaded"));
                        };
                });


Modified: trunk/freenet/src/freenet/pluginmanager/PluginManager.java
===================================================================
--- trunk/freenet/src/freenet/pluginmanager/PluginManager.java  2007-05-09 
23:55:01 UTC (rev 13186)
+++ trunk/freenet/src/freenet/pluginmanager/PluginManager.java  2007-05-10 
00:09:05 UTC (rev 13187)
@@ -69,7 +69,7 @@
                                        public void set(String[] val) throws 
InvalidConfigValueException {
                                                //if(storeDir.equals(new 
File(val))) return;
                                                // FIXME
-                                               throw new 
InvalidConfigValueException("Cannot set the plugins that's loaded.");
+                                               throw new 
InvalidConfigValueException(L10n.getString("PluginManager.cannotSetOnceLoaded"));
                                        }
                });


Modified: trunk/freenet/src/freenet/support/LoggerHook.java
===================================================================
--- trunk/freenet/src/freenet/support/LoggerHook.java   2007-05-09 23:55:01 UTC 
(rev 13186)
+++ trunk/freenet/src/freenet/support/LoggerHook.java   2007-05-10 00:09:05 UTC 
(rev 13187)
@@ -3,6 +3,8 @@
 import java.util.StringTokenizer;
 import java.util.Vector;

+import freenet.l10n.L10n;
+
 public abstract class LoggerHook extends Logger {

        protected int threshold;
@@ -166,7 +168,7 @@
                else if (s.equalsIgnoreCase("debug"))
                        return Logger.DEBUG;
                else
-                       throw new InvalidThresholdException("Unrecognized 
priority: "+s);
+                       throw new 
InvalidThresholdException(L10n.getString("LoggerHook.unrecognisedPriority", 
"name", s));
                // return Logger.NORMAL;
        }



Reply via email to