/** * Get a localized string, and replace on-the-fly a value. * @param key Key to search for. * @param pattern Pattern to replace, ${ and } not included. * @param value Replacement value. * @return String */ public String getString(String key, String pattern, String value) { return getString(key, new String[]{pattern}, new String[]{value}); // FIXME code efficiently! }
/** * Returns the translation of the given key, prefixed by the short name of * the current class. * * @param key * The key to fetch * @return The translation */ static String l10n(String key) { return NodeL10n.getBase().getString("PluginManager." + key); }
@Override protected String getPageTitle(String titleCountString) { return NodeL10n.getBase().getString("DarknetConnectionsToadlet.fullTitle", new String[] {"counts"}, new String[] {titleCountString} ); }
/** Get the (localised) long explanation for this failure mode. */ public static String getShortMessage(InsertExceptionMode mode) { // FIXME change the l10n to use the keyword not the code String ret = NodeL10n.getBase().getString("InsertException.shortError."+mode.code); if(ret == null) return "Unknown error "+mode; else return ret; }
public PutCompletedEvent(String identifier, FreenetURI uri, long size) { super(Type.PutCompleted, true, null, null, null, null, UserAlert.MINOR, true, NodeL10n.getBase().getString("UserAlert.hide"), true, null, completedPuts); this.identifier = identifier; this.uri = uri; this.size = size; }
/** Get the (localised) short name of this failure mode. */ public static String getShortMessage(FetchExceptionMode mode) { // FIXME change the l10n to use the names rather than codes int code = mode.code; String ret = NodeL10n.getBase().getString("FetchException.shortError."+code); if(ret == null || ret.equals("")) return "Unknown code "+mode; else return ret; }
/** * */ public TimeSkewDetectedUserAlert() { super(false, null, null, null, null, UserAlert.CRITICAL_ERROR, false, NodeL10n.getBase().getString("UserAlert.hide"), false, null); }
public String getShortDescription() { if(shortDescription == null) return ""; if(shortDescription.toLowerCase().startsWith("l10n:")) return NodeL10n.getBase().getString("Bookmarks.Defaults.ShortDescription."+shortDescription.substring("l10n:".length())); return shortDescription; }
/** Get the (localised) short name of this failure mode. */ public static String getMessage(InsertExceptionMode mode) { // FIXME change the l10n to use the keyword not the code String ret = NodeL10n.getBase().getString("InsertException.longError."+mode.code); if(ret == null) return "Unknown error "+mode; else return ret; }
/** Get the (localised) long explanation for this failure mode. */ public static String getMessage(FetchExceptionMode mode) { if(mode == null) throw new NullPointerException(); int code = mode.code; // FIXME change the l10n to use the names rather than codes String ret = NodeL10n.getBase().getString("FetchException.longError."+code); if(ret == null) return "Unknown fetch error code: "+mode; else return ret; }
@Override public String dismissButtonText() { return NodeL10n.getBase().getString("UserAlert.hide"); } @Override
@Override public Boolean parseString(String val) throws InvalidConfigValueException { if(val.equalsIgnoreCase("true") || val.equalsIgnoreCase("yes")) { return true; } else if(val.equalsIgnoreCase("false") || val.equalsIgnoreCase("no")) { return false; } else throw new OptionFormatException(NodeL10n.getBase().getString("BooleanOption.parseError", "val", val)); }
/** * @throws IOException See {@link #sendErrorPage(ToadletContext, int, String, String)} * @throws ToadletContextClosedException See {@link #sendErrorPage(ToadletContext, int, String, String)} */ void sendUnauthorizedPage(ToadletContext ctx) throws ToadletContextClosedException, IOException { sendErrorPage(ctx, 403, NodeL10n.getBase().getString("Toadlet.unauthorizedTitle"), NodeL10n.getBase().getString("Toadlet.unauthorized")); }
@Override public void set(String[] val) throws InvalidConfigValueException { //if(storeDir.equals(new File(val))) return; // FIXME throw new InvalidConfigValueException(NodeL10n.getBase().getString("PluginManager.cannotSetOnceLoaded")); }
public String getPluginVersion() { if (isVersionedPlugin) { return ((FredPluginVersioned)plug).getVersion(); } else { return NodeL10n.getBase().getString("PproxyToadlet.noVersion"); } }
private static HTMLNode getHTML(boolean disabledNotBlown, String msg) { HTMLNode div = new HTMLNode("div"); if(disabledNotBlown) { div.addChild("p", NodeL10n.getBase().getString("RevocationKeyFoundUserAlert.textDisabled")); div.addChild("p", NodeL10n.getBase().getString("RevocationKeyFoundUserAlert.textDisabledDetail", "message", msg)); } else { div.addChild("p", NodeL10n.getBase().getString("RevocationKeyFoundUserAlert.text")); div.addChild("p", NodeL10n.getBase().getString("RevocationKeyFoundUserAlert.textDetail", "message", msg)); } return div; }
public HTMLNode toLocalisedHTML() { if(pluginProgress == PROGRESS_STATE.DOWNLOADING && total > 0) { return QueueToadlet.createProgressCell(false, true, ClientPut.COMPRESS_STATE.WORKING, current, failed, fatallyFailed, minSuccessful, total, finalisedTotal, false); } else if(pluginProgress == PROGRESS_STATE.DOWNLOADING) return new HTMLNode("td", NodeL10n.getBase().getString("PproxyToadlet.startingPluginStatus.downloading")); else if(pluginProgress == PROGRESS_STATE.STARTING) return new HTMLNode("td", NodeL10n.getBase().getString("PproxyToadlet.startingPluginStatus.starting")); else return new HTMLNode("td", toString()); }
public void testGetStringFallback() { BaseL10n l10n = createTestL10n(LANGUAGE.GERMAN); String value = l10n.getString("test.sanity"); assertEquals("Sane", value); }
public void testGetStringFallbackOverridden() { BaseL10n l10n = createTestL10n(LANGUAGE.GERMAN); String value = l10n.getString("test.override"); assertEquals("Not overridden", value); }
@Override protected void createSelectDirectoryButton (HTMLNode formNode, String path, HTMLNode persist) { formNode.addChild("input", new String[] { "type", "name", "value" }, new String[] { "submit", selectDir, NodeL10n.getBase().getString("QueueToadlet.download")}); formNode.addChild("input", new String[] { "type", "name", "value" }, new String[] { "hidden", filenameField(), path}); formNode.addChild(persist); }