Author: juiceman
Date: 2008-12-28 02:49:24 +0000 (Sun, 28 Dec 2008)
New Revision: 24804
Modified:
trunk/freenet/src/freenet/clients/http/SimpleHelpToadlet.java
trunk/freenet/src/freenet/l10n/L10n.java
trunk/freenet/src/freenet/l10n/freenet.l10n.en.properties
Log:
Extend support for more html in L10n.
Modified: trunk/freenet/src/freenet/clients/http/SimpleHelpToadlet.java
===================================================================
--- trunk/freenet/src/freenet/clients/http/SimpleHelpToadlet.java
2008-12-27 13:59:05 UTC (rev 24803)
+++ trunk/freenet/src/freenet/clients/http/SimpleHelpToadlet.java
2008-12-28 02:49:24 UTC (rev 24804)
@@ -39,7 +39,7 @@
HTMLNode helpScreenBox =
contentNode.addChild(ctx.getPageMaker().getInfobox("infobox-content",
L10n.getString("SimpleHelpToadlet.connectivityTitle")));
HTMLNode helpScreenContent =
ctx.getPageMaker().getContentNode(helpScreenBox);
HTMLNode p = helpScreenContent.addChild("p");
- L10n.addL10nSubstitution(p,
"SimpleHelpToadlet.connectivityText", new String[] { "p", "/p", "bold", "/bold"
}, new String[] { "<p>", "</p>", "<b>", "</b>" });
+ L10n.addL10nHTML(p, "SimpleHelpToadlet.connectivityText");
this.writeHTMLReply(ctx, 200, "OK", pageNode.generate());
}
@@ -48,5 +48,9 @@
public String supportedMethods() {
return "GET";
}
+
+ String l10n(String key, String pattern, String value) {
+ return L10n.getString("SimpleHelpToadlet."+key, pattern, value);
+ }
}
Modified: trunk/freenet/src/freenet/l10n/L10n.java
===================================================================
--- trunk/freenet/src/freenet/l10n/L10n.java 2008-12-27 13:59:05 UTC (rev
24803)
+++ trunk/freenet/src/freenet/l10n/L10n.java 2008-12-28 02:49:24 UTC (rev
24804)
@@ -414,6 +414,12 @@
result = result.replaceAll("\\$\\{"+patterns[i]+"\\}",
quoteReplacement(values[i]));
node.addChild("%", result);
}
+
+ //Provide a way to handle most basic html tags without manually
including the search strings in addL10nSubstitution.
+ //I know it's ugly, but will only be used rarely. -Juiceman.
+ public static void addL10nHTML(HTMLNode node, String key){
+ addL10nSubstitution(node, key, new String[] { "p", "/p", "b",
"/b", "br", "hr", "pre", "/pre", "i", "/i", "ul", "/ul", "ol", "/ol", "li",
"center", "/center", "strike", "/strike", "blockquote", "/blockquote", "h1",
"/h1", "h2", "/h2", "h3", "/h3", "h4", "/h4", "h5", "/h5", "h6", "/h6",
"strong", "/strong" }, new String[] { "<p>", "</p>", "<b>", "</b>", "<br>",
"<hr>", "<pre>", "</pre>", "<i>", "</i>", "<ul>", "</ul>", "<ol>", "</ol>",
"<li>", "<center>", "</center>", "<strike>", "</strike>", "<blockquote>",
"</blockquote>", "<h1>", "</h1>", "<h2>", "</h2>", "<h3>", "</h3>", "<h4>",
"</h4>", "<h5>", "</h5>", "<h6>", "</h6>", "<strong>", "</strong>" });
+ }
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 2008-12-27
13:59:05 UTC (rev 24803)
+++ trunk/freenet/src/freenet/l10n/freenet.l10n.en.properties 2008-12-28
02:49:24 UTC (rev 24804)
@@ -1116,7 +1116,7 @@
SecurityLevels.userAlertExtro=You can change these settings on ${link}the
config page${/link}.
ShortOption.parseError=Cannot parse value as a string array: ${error}
ShortOption.parseError=The value specified can't be parsed as a 16-bit integer
: ${val}
-SimpleHelpToadlet.connectivityText=${bold}Testing.${/bold}${/p}${p}Test${p}
+SimpleHelpToadlet.connectivityText=${p}${b}Testing.${/b}${p}Test${hr}Blah blah
blah, etc etc etc
SimpleHelpToadlet.connectivityTitle=Connectivity
SimpleHelpToadlet.help=Help
SimpleToadletServer.advancedMode=Enable Advanced Mode?
_______________________________________________
cvs mailing list
[email protected]
http://emu.freenetproject.org/cgi-bin/mailman/listinfo/cvs