diff --git a/apps/susidns/src/css.css b/apps/susidns/src/css.css index 0ee2432d6..fae4f94a0 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 8ea13225a..000000000 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 736eaf246..000000000 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 b0503ac5b..000000000 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 0743f3879..000000000 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 ce46f1d37..000000000 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 4036462bd..ce53d99d4 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 + " | "; } - 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.
"; + 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.
"; + if (deleted == 1) + message = _("Destination {0} deleted.", name); + else + message = _("{0} destinations deleted.", deleted); } } if( changed ) { try { save(); - message += "Addressbook saved.
"; + message += "
" + _("Addressbook saved."); } catch (Exception e) { Debug.debug( e.getClass().getName() + ": " + e.getMessage() ); - message += "ERROR: Could not write addressbook file.
"; + message += "
" + _("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 7dad7a250..f6655757d 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 2426606af..dd04c6289 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 b860e2393..cc983b54b 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.") + "\"\""; } 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 4fda75eff..0189d0a32 100644 --- a/apps/susidns/src/jsp/addressbook.jsp +++ b/apps/susidns/src/jsp/addressbook.jsp @@ -38,7 +38,7 @@ -${book.book} <%=intl._("addressbook")%> - susidns v${version.version} +${book.book} <%=intl._("addressbook")%> - susidns @@ -111,7 +111,7 @@ @@ -155,7 +155,7 @@
-

+

" >

@@ -174,7 +174,7 @@ <%=intl._("Hostname")%>: <%=intl._("Destination")%>:

- +" >

diff --git a/apps/susidns/src/jsp/config.jsp b/apps/susidns/src/jsp/config.jsp index 4c3cefbdf..9f407ced9 100644 --- a/apps/susidns/src/jsp/config.jsp +++ b/apps/susidns/src/jsp/config.jsp @@ -34,7 +34,7 @@ -<%=intl._("configuration")%> - susidns v${version.version} +<%=intl._("configuration")%> - susidns @@ -64,8 +64,8 @@
- - +" > +" >
diff --git a/apps/susidns/src/jsp/index.jsp b/apps/susidns/src/jsp/index.jsp index 0f56bdf18..51e0517e9 100644 --- a/apps/susidns/src/jsp/index.jsp +++ b/apps/susidns/src/jsp/index.jsp @@ -32,7 +32,7 @@ -<%=intl._("Introduction")%> - SusiDNS v${version.version} +<%=intl._("Introduction")%> - SusiDNS diff --git a/apps/susidns/src/jsp/subscriptions.jsp b/apps/susidns/src/jsp/subscriptions.jsp index 7485e10bc..4edd704ae 100644 --- a/apps/susidns/src/jsp/subscriptions.jsp +++ b/apps/susidns/src/jsp/subscriptions.jsp @@ -34,7 +34,7 @@ -<%=intl._("subscriptions")%> - susidns v${version.version} +<%=intl._("subscriptions")%> - susidns @@ -64,8 +64,8 @@
- - +" > +" >