diff --git a/apps/susidns/src/css.css b/apps/susidns/src/css.css index 0ee2432d62a6c67a8b03eb49a7236680c12e4646..fae4f94a0bfb11ae7588e01ac1faed6a8d85e630 100644 --- a/apps/susidns/src/css.css +++ b/apps/susidns/src/css.css @@ -121,4 +121,32 @@ p.footer { font-size: 10pt !important; line-height: 160% !important; -moz-box-shadow: inset 0px 0px 1px 0px #002; -} \ No newline at end of file +} + +input[type=submit] { + border: 1px outset #999; + background: #ddf; + color: #001; + margin: 5px; + font: bold 8pt "Lucida Sans Unicode", "Bitstream Vera Sans", Verdana, Tahoma, Helvetica, sans-serif; + padding: 1px 2px; + text-decoration: none; + min-width: 110px; + border-radius: 4px; + -moz-border-radius: 4px; + -khtml-border-radius: 4px; + -moz-box-shadow: inset 0px 2px 8px 0px #fff; + color: #006; + opacity: 0.9; +} + + +input[type=submit]:hover { + background: #22a; + color: #fff; + border: 1px solid #f60; + opacity: 1.0; + -moz-box-shadow: inset 0px 0px 0px 1px #fff; + +} + diff --git a/apps/susidns/src/images/add.png b/apps/susidns/src/images/add.png deleted file mode 100644 index 8ea13225a551f454a71f088df341f880bbacf2e4..0000000000000000000000000000000000000000 Binary files a/apps/susidns/src/images/add.png and /dev/null differ diff --git a/apps/susidns/src/images/delete.png b/apps/susidns/src/images/delete.png deleted file mode 100644 index 736eaf24676b37173e09a874309258ff32194d33..0000000000000000000000000000000000000000 Binary files a/apps/susidns/src/images/delete.png and /dev/null differ diff --git a/apps/susidns/src/images/reload.png b/apps/susidns/src/images/reload.png deleted file mode 100644 index b0503ac5b3919a7c30f468d1d57f07de53314b2a..0000000000000000000000000000000000000000 Binary files a/apps/susidns/src/images/reload.png and /dev/null differ diff --git a/apps/susidns/src/images/save.png b/apps/susidns/src/images/save.png deleted file mode 100644 index 0743f3879efe9d0f876da3d7f505b06110c51d22..0000000000000000000000000000000000000000 Binary files a/apps/susidns/src/images/save.png and /dev/null differ diff --git a/apps/susidns/src/images/search.png b/apps/susidns/src/images/search.png deleted file mode 100644 index ce46f1d378e455b2ed5d0bc82afd12bcc3878425..0000000000000000000000000000000000000000 Binary files a/apps/susidns/src/images/search.png and /dev/null differ diff --git a/apps/susidns/src/java/src/i2p/susi/dns/AddressbookBean.java b/apps/susidns/src/java/src/i2p/susi/dns/AddressbookBean.java index 4036462bdcfba2f7aa72bcc02e8826ddf734e048..ce53d99d45be40a0a6feefa79654221a7176acc4 100644 --- a/apps/susidns/src/java/src/i2p/susi/dns/AddressbookBean.java +++ b/apps/susidns/src/java/src/i2p/susi/dns/AddressbookBean.java @@ -194,20 +194,27 @@ public class AddressbookBean // addressbook.jsp catches the case where the whole book is empty. String filterArg = ""; if( search != null && search.length() > 0 ) { - message = "Search "; + message = _("Search") + ' '; } if( filter != null && filter.length() > 0 ) { if( search != null && search.length() > 0 ) - message += "within "; - message += "Filtered list "; + message = _("Search within filtered list") + ' '; + else + message = _("Filtered list") + ' '; filterArg = "&filter=" + filter; } if (entries.length == 0) { - message += "- no matches"; + message += "- " + _("no matches") + '.'; } else if (getBeginInt() == 0 && getEndInt() == entries.length - 1) { if (message.length() == 0) - message = "Addressbook "; - message += "contains " + entries.length + " entries"; + message = _("Addressbook") + ' '; + if (entries.length <= 0) + message += _("contains no entries"); + else if (entries.length == 1) + message += _("contains 1 entry"); + else + message += _("contains {0} entries", entries.length); + message += '.'; } else { if (getBeginInt() > 0) { int newBegin = Math.max(0, getBeginInt() - DISPLAY_SIZE); @@ -216,7 +223,7 @@ public class AddressbookBean "&begin=" + newBegin + "&end=" + newEnd + "\">" + newBegin + '-' + newEnd + "</a> | "; } - message += "Showing " + getBegin() + '-' + getEnd() + " of " + entries.length; + message += _("Showing {0} of {1}", "" + getBegin() + '-' + getEnd(), entries.length); if (getEndInt() < entries.length - 1) { int newBegin = Math.min(entries.length - 1, getEndInt() + 1); int newEnd = Math.min(entries.length, getEndInt() + DISPLAY_SIZE); @@ -245,38 +252,43 @@ public class AddressbookBean if( action != null ) { if( lastSerial != null && serial != null && serial.compareTo( lastSerial ) == 0 ) { boolean changed = false; - if( action.compareToIgnoreCase( "add") == 0 ) { + int deleted = 0; + String name = null; + if (action.equals(_("Add"))) { if( addressbook != null && hostname != null && destination != null ) { addressbook.put( hostname, destination ); changed = true; - message += "Destination added.<br/>"; + message = _("Destination added."); + // clear search when adding + search = null; } - } - if( action.compareToIgnoreCase( "delete" ) == 0 ) { + } else if (action.equals(_("Delete"))) { Iterator it = deletionMarks.iterator(); - int deleted = 0; while( it.hasNext() ) { - String name = (String)it.next(); + name = (String)it.next(); addressbook.remove( name ); changed = true; deleted++; } if( changed ) { - message += "" + deleted + " destination(s) deleted.<br/>"; + if (deleted == 1) + message = _("Destination {0} deleted.", name); + else + message = _("{0} destinations deleted.", deleted); } } if( changed ) { try { save(); - message += "Addressbook saved.<br/>"; + message += "<br>" + _("Addressbook saved."); } catch (Exception e) { Debug.debug( e.getClass().getName() + ": " + e.getMessage() ); - message += "ERROR: Could not write addressbook file.<br/>"; + message += "<br>" + _("ERROR: Could not write addressbook file."); } } } else { - message = "Invalid form submission, probably because you used the 'back' or 'reload' button on your browser. Please resubmit."; + message = _("Invalid form submission, probably because you used the \"back\" or \"reload\" button on your browser. Please resubmit."); } } @@ -364,4 +376,19 @@ public class AddressbookBean endIndex = Integer.parseInt(s); } catch (NumberFormatException nfe) {} } + + /** translate */ + private static String _(String s) { + return Messages.getString(s); + } + + /** translate */ + private static String _(String s, Object o) { + return Messages.getString(s, o); + } + + /** translate */ + private static String _(String s, Object o, Object o2) { + return Messages.getString(s, o, o2); + } } diff --git a/apps/susidns/src/java/src/i2p/susi/dns/ConfigBean.java b/apps/susidns/src/java/src/i2p/susi/dns/ConfigBean.java index 7dad7a25006a68ee7d42af425825d8a7aa2d4bd6..f6655757d8318977ee667baf4c8cbf013948fb05 100644 --- a/apps/susidns/src/java/src/i2p/susi/dns/ConfigBean.java +++ b/apps/susidns/src/java/src/i2p/susi/dns/ConfigBean.java @@ -136,17 +136,16 @@ public class ConfigBean implements Serializable { String message = ""; if( action != null ) { if( lastSerial != null && serial != null && serial.compareTo( lastSerial ) == 0 ) { - if( action.compareToIgnoreCase( "save") == 0 ) { + if(action.equals(_("Save"))) { save(); - message = "Configuration saved."; - } - else if( action.compareToIgnoreCase( "reload") == 0 ) { + message = _("Configuration saved."); + } else if (action.equals(_("Reload"))) { reload(); - message = "Configuration reloaded."; + message = _("Configuration reloaded."); } } else { - message = "Invalid form submission, probably because you used the 'back' or 'reload' button on your browser. Please resubmit."; + message = _("Invalid form submission, probably because you used the \"back\" or \"reload\" button on your browser. Please resubmit."); } } if( message.length() > 0 ) @@ -162,4 +161,9 @@ public class ConfigBean implements Serializable { public void setSerial(String serial ) { this.serial = serial; } + + /** translate */ + private static String _(String s) { + return Messages.getString(s); + } } diff --git a/apps/susidns/src/java/src/i2p/susi/dns/Messages.java b/apps/susidns/src/java/src/i2p/susi/dns/Messages.java index 2426606af6525b9dadd0b022dc61e3fb7b22c9b6..dd04c6289052ad1c5ddf66f5439270b49f924222 100644 --- a/apps/susidns/src/java/src/i2p/susi/dns/Messages.java +++ b/apps/susidns/src/java/src/i2p/susi/dns/Messages.java @@ -19,19 +19,15 @@ public class Messages { return Translate.getString(key, _context, BUNDLE_NAME); } - /** - * translate a string with a parameter - * This is a lot more expensive than getString(s, ctx), so use sparingly. - * - * @param s string to be translated containing {0} - * The {0} will be replaced by the parameter. - * Single quotes must be doubled, i.e. ' -> '' in the string. - * @param o parameter, not translated. - * To tranlslate parameter also, use _("foo {0} bar", _("baz")) - * Do not double the single quotes in the parameter. - * Use autoboxing to call with ints, longs, floats, etc. - */ - public String _(String s, Object o) { - return Translate.getString(s, o, _context, BUNDLE_NAME); + public static String getString(String s) { + return Translate.getString(s, I2PAppContext.getGlobalContext(), BUNDLE_NAME); + } + + public static String getString(String s, Object o) { + return Translate.getString(s, o, I2PAppContext.getGlobalContext(), BUNDLE_NAME); + } + + public static String getString(String s, Object o, Object o2) { + return Translate.getString(s, o, o2, I2PAppContext.getGlobalContext(), BUNDLE_NAME); } } diff --git a/apps/susidns/src/java/src/i2p/susi/dns/SubscriptionsBean.java b/apps/susidns/src/java/src/i2p/susi/dns/SubscriptionsBean.java index b860e23930f5ed6c3112b2b868ccc643e02b5c54..cc983b54bf0c78ae105eae908304fb4abf54c047 100644 --- a/apps/susidns/src/java/src/i2p/susi/dns/SubscriptionsBean.java +++ b/apps/susidns/src/java/src/i2p/susi/dns/SubscriptionsBean.java @@ -126,7 +126,7 @@ public class SubscriptionsBean String message = ""; if( action != null ) { if( lastSerial != null && serial != null && serial.compareTo( lastSerial ) == 0 ) { - if( action.compareToIgnoreCase( "save") == 0 ) { + if (action.equals(_("Save"))) { save(); String nonce = System.getProperty("addressbook.nonce"); if (nonce != null) { @@ -135,20 +135,19 @@ public class SubscriptionsBean // Fetching from the addressbook servlet // with the correct parameters will kick off a // config reload and fetch. - message = "Subscriptions saved, updating addressbook from subscription sources now." + + message = _("Subscriptions saved, updating addressbook from subscription sources now.") + "<img height=\"1\" width=\"1\" alt=\"\" " + "src=\"/addressbook/?wakeup=1&nonce=" + nonce + "\">"; } else { - message = "Subscriptions saved."; + message = _("Subscriptions saved."); } - } - else if( action.compareToIgnoreCase( "reload") == 0 ) { + } else if (action.equals(_("Reload"))) { reload(); - message = "Subscriptions reloaded."; + message = _("Subscriptions reloaded."); } } else { - message = "Invalid form submission, probably because you used the 'back' or 'reload' button on your browser. Please resubmit."; + message = _("Invalid form submission, probably because you used the \"back\" or \"reload\" button on your browser. Please resubmit."); } } if( message.length() > 0 ) @@ -183,4 +182,9 @@ public class SubscriptionsBean return content; } + + /** translate */ + private static String _(String s) { + return Messages.getString(s); + } } diff --git a/apps/susidns/src/jsp/addressbook.jsp b/apps/susidns/src/jsp/addressbook.jsp index 4fda75eff7edc0ae6baf7faafb8cd286a363d93e..0189d0a32335361f9ef2bb6c5ce276389c21f963 100644 --- a/apps/susidns/src/jsp/addressbook.jsp +++ b/apps/susidns/src/jsp/addressbook.jsp @@ -38,7 +38,7 @@ <html> <head> <meta http-equiv="Content-Type" content="text/html; charset=UTF-8" /> -<title>${book.book} <%=intl._("addressbook")%> - susidns v${version.version}</title> +<title>${book.book} <%=intl._("addressbook")%> - susidns</title> <link rel="stylesheet" type="text/css" href="css.css"> </head> <body> @@ -111,7 +111,7 @@ <div id="search"> <table><tr> <td class="search"><%=intl._("Search")%>: <input type="text" name="search" value="${book.search}" size="20" ></td> -<td class="search"><input type="image" src="images/search.png" name="submitsearch" value="search" alt="Search" ></td> +<td class="search"><input type="submit" name="submitsearch" value="<%=intl._("Search")%>" ></td> </tr> </table> </div> @@ -155,7 +155,7 @@ <c:if test="${book.master || book.router || book.published || book.private}"> <div id="buttons"> -<p class="buttons"><input type="image" name="action" value="delete" src="images/delete.png" alt="Delete checked" > +<p class="buttons"><input type="submit" name="action" value="<%=intl._("Delete")%>" > </p> </div> </c:if> @@ -174,7 +174,7 @@ <b><%=intl._("Hostname")%>:</b> <input type="text" name="hostname" value="${book.hostname}" size="20"> <b><%=intl._("Destination")%>:</b> <textarea name="destination" rows="1" style="height: 3em;" cols="40" wrap="off" >${book.destination}</textarea><br/> </p><p> -<input type="image" name="action" value="add" src="images/add.png" alt="Add destination" > +<input type="submit" name="action" value="<%=intl._("Add")%>" > </p> </div> diff --git a/apps/susidns/src/jsp/config.jsp b/apps/susidns/src/jsp/config.jsp index 4c3cefbdf86cb2ed2b677024afd6f7010320b13c..9f407ced9565a2d3c90cf6a0219195629dc2ad10 100644 --- a/apps/susidns/src/jsp/config.jsp +++ b/apps/susidns/src/jsp/config.jsp @@ -34,7 +34,7 @@ <html> <head> <meta http-equiv="Content-Type" content="text/html; charset=UTF-8" /> -<title><%=intl._("configuration")%> - susidns v${version.version}</title> +<title><%=intl._("configuration")%> - susidns</title> <link rel="stylesheet" type="text/css" href="css.css"> </head> <body> @@ -64,8 +64,8 @@ <textarea name="config" rows="10" cols="80">${cfg.config}</textarea> </div> <div id="buttons"> -<input type="image" src="images/save.png" name="action" value="save" alt="Save Config"> -<input type="image" src="images/reload.png" name="action" value="reload" alt="Reload Config"> +<input type="submit" name="action" value="<%=intl._("Save")%>" > +<input type="submit" name="action" value="<%=intl._("Reload")%>" > </div> </form> <div id="help"> diff --git a/apps/susidns/src/jsp/index.jsp b/apps/susidns/src/jsp/index.jsp index 0f56bdf187c8d4f99da9644412400484ca92ab09..51e0517e973a1e26f4294dbc47ef6f222ae9bfca 100644 --- a/apps/susidns/src/jsp/index.jsp +++ b/apps/susidns/src/jsp/index.jsp @@ -32,7 +32,7 @@ <html> <head> <meta http-equiv="Content-Type" content="text/html; charset=UTF-8" /> -<title><%=intl._("Introduction")%> - SusiDNS v${version.version}</title> +<title><%=intl._("Introduction")%> - SusiDNS</title> <link rel="stylesheet" type="text/css" href="css.css"> </head> <body> diff --git a/apps/susidns/src/jsp/subscriptions.jsp b/apps/susidns/src/jsp/subscriptions.jsp index 7485e10bc278c21948471a0e32bff149fe1512f6..4edd704ae6d5cd07090ab7945a1315fe54bc5ee7 100644 --- a/apps/susidns/src/jsp/subscriptions.jsp +++ b/apps/susidns/src/jsp/subscriptions.jsp @@ -34,7 +34,7 @@ <html> <head> <meta http-equiv="Content-Type" content="text/html; charset=UTF-8" /> -<title><%=intl._("subscriptions")%> - susidns v${version.version}</title> +<title><%=intl._("subscriptions")%> - susidns</title> <link rel="stylesheet" type="text/css" href="css.css"> </head> <body> @@ -64,8 +64,8 @@ <textarea name="content" rows="10" cols="80">${subs.content}</textarea> </div> <div id="buttons"> -<input type="image" src="images/save.png" name="action" value="save" alt="Save Subscriptions" > -<input type="image" src="images/reload.png" name="action" value="reload" alt="Reload Subscriptions" > +<input type="submit" name="action" value="<%=intl._("Save")%>" > +<input type="submit" name="action" value="<%=intl._("Reload")%>" > </div> </form> <div id="help">