Author: toad
Date: 2007-04-27 23:15:27 +0000 (Fri, 27 Apr 2007)
New Revision: 13022

Modified:
   trunk/freenet/src/freenet/clients/http/LocalFileInsertToadlet.java
   trunk/freenet/src/freenet/l10n/freenet.l10n.en.properties
Log:
L10n keys for LocalFileInsertToadlet

Modified: trunk/freenet/src/freenet/clients/http/LocalFileInsertToadlet.java
===================================================================
--- trunk/freenet/src/freenet/clients/http/LocalFileInsertToadlet.java  
2007-04-27 23:02:50 UTC (rev 13021)
+++ trunk/freenet/src/freenet/clients/http/LocalFileInsertToadlet.java  
2007-04-27 23:15:27 UTC (rev 13022)
@@ -10,6 +10,7 @@
 import java.util.Comparator;

 import freenet.client.HighLevelSimpleClient;
+import freenet.l10n.L10n;
 import freenet.node.NodeClientCore;
 import freenet.support.HTMLNode;
 import freenet.support.URLEncoder;
@@ -50,19 +51,19 @@
                currentPath = new File(path).getCanonicalFile();

                if(!core.allowUploadFrom(currentPath)) {
-                       this.sendErrorPage(toadletContext, 403, "Forbidden", 
"You cannot browse this directory");
+                       sendErrorPage(toadletContext, 403, "Forbidden", 
l10n("dirAccessDenied"));
                        return;
                }

                PageMaker pageMaker = toadletContext.getPageMaker();

-               HTMLNode pageNode = pageMaker.getPageNode("Listing of " + 
currentPath.getAbsolutePath(), toadletContext);
+               HTMLNode pageNode = pageMaker.getPageNode(l10n("listingTitle", 
"path", currentPath.getAbsolutePath()), toadletContext);
                HTMLNode contentNode = pageMaker.getContentNode(pageNode);
                if(toadletContext.isAllowedFullAccess())
                        contentNode.addChild(core.alerts.createSummary());

                HTMLNode infoboxDiv = contentNode.addChild("div", "class", 
"infobox");
-               infoboxDiv.addChild("div", "class", "infobox-header", 
"Directory Listing: " + currentPath.getAbsolutePath());
+               infoboxDiv.addChild("div", "class", "infobox-header", 
l10n("listing", "path",  currentPath.getAbsolutePath()));
                HTMLNode listingDiv = infoboxDiv.addChild("div", "class", 
"infobox-content");

                if (currentPath.exists() && currentPath.isDirectory() && 
currentPath.canRead()) {
@@ -84,8 +85,8 @@
                        HTMLNode listingTable = listingDiv.addChild("table");
                        HTMLNode headerRow = listingTable.addChild("tr");
                        headerRow.addChild("th");
-                       headerRow.addChild("th", "File");
-                       headerRow.addChild("th", "Size");
+                       headerRow.addChild("th", l10n("fileHeader"));
+                       headerRow.addChild("th", l10n("sizeHeader"));
                        /* add filesystem roots (fsck windows) */
                        File[] roots = File.listRoots();
                        for (int rootIndex = 0, rootCount = roots.length; 
rootIndex < rootCount; rootIndex++) {
@@ -121,7 +122,7 @@
                                                HTMLNode cellNode = 
fileRow.addChild("td");
                                                HTMLNode formNode = 
toadletContext.addFormChild(cellNode, "/queue/", "insertLocalFileForm"); 
                                                formNode.addChild("input", new 
String[] { "type", "name", "value" }, new String[] { "hidden", "filename", 
currentFile.getAbsolutePath() });
-                                               formNode.addChild("input", new 
String[] { "type", "name", "value" }, new String[] { "submit", 
"insert-local-file", "Insert" });
+                                               formNode.addChild("input", new 
String[] { "type", "name", "value" }, new String[] { "submit", 
"insert-local-file", l10n("insert")});
                                                fileRow.addChild("td", 
currentFile.getName());
                                                fileRow.addChild("td", "class", 
"right-align", String.valueOf(currentFile.length()));
                                        } else {
@@ -132,16 +133,24 @@
                                }
                        }
                } else {
-                       listingDiv.addChild("#", "The directory \u201c" + 
currentPath.getAbsolutePath() + "\u201d can not be read.");
+                       listingDiv.addChild("#", l10n("dirCannotBeRead", 
"path", currentPath.getAbsolutePath()));
                        HTMLNode ulNode = listingDiv.addChild("ul");
-                       ulNode.addChild("li", "Check that the specified path 
does exist.");
-                       ulNode.addChild("li", "Check that the specified path is 
a directory.");
-                       ulNode.addChild("li", "Check that the specified path is 
readable by the user running the node.");
+                       ulNode.addChild("li", l10n("checkPathExist"));
+                       ulNode.addChild("li", l10n("checkPathIsDir"));
+                       ulNode.addChild("li", l10n("checkPathReadable"));
                }

                writeReply(toadletContext, 200, "text/html; charset=utf-8", 
"OK", pageNode.generate());
        }

+       private String l10n(String key, String pattern, String value) {
+               return L10n.getString(key, new String[] { pattern }, new 
String[] { value });
+       }
+
+       private String l10n(String msg) {
+               return L10n.getString("LocalFileInsertToadlet."+msg);
+       }
+
        /**
         * @see freenet.clients.http.Toadlet#supportedMethods()
         */

Modified: trunk/freenet/src/freenet/l10n/freenet.l10n.en.properties
===================================================================
--- trunk/freenet/src/freenet/l10n/freenet.l10n.en.properties   2007-04-27 
23:02:50 UTC (rev 13021)
+++ trunk/freenet/src/freenet/l10n/freenet.l10n.en.properties   2007-04-27 
23:15:27 UTC (rev 13022)
@@ -193,7 +193,16 @@
 FProxyToadlet.stats=view statistics
 FProxyToadlet.translationTitle=Translation
 FProxyToadlet.translation=helper to translate the node's interface into your 
native language
-QueueToadlet.priority=Priority
+LocalFileInsertToadlet.dirAccessDenied=You cannot browse this directory
+LocalFileInsertToadlet.listingTitle=Listing of ${path}
+LocalFileInsertToadlet.listing=Directory Listing: ${path}
+LocalFileInsertToadlet.fileHeader=File
+LocalFileInsertToadlet.sizeHeader=Size
+LocalFileInsertToadlet.insert=Insert
+LocalFileInsertToadlet.dirCannotBeRead=The directory "${path}" can not be read.
+LocalFileInsertToadlet.checkPathExist=Check that the specified path does exist.
+LocalFileInsertToadlet.checkPathIsDir=Check that the specified path is a 
directory.
+LocalFileInsertToadlet.checkPathReadable=Check that the specified path is 
readable by the user running the node.
 QueueToadlet.emergency=emergency
 QueueToadlet.veryhigh=very high
 QueueToadlet.high=high


Reply via email to