/** * Returns the named messages for the current locale. * * @param name the message resource name * @return messages for the current locale * @throws ResourceNotFoundException if the named resource cannot be found */ @Override public Messages getMessages(String name) { InputStream in = resources.getInputStream(name); return new LocaleDatabase(in, this); }
/** * Constructs a {@code LocaleDatabase}. * * @param in the stream to read the translation from. May be {@code null} * @param parent the parent messages. May be {@code null} * @param locales the supported locales * @throws ResourceException if the stream is not an IzPack langpack file */ public LocaleDatabase(InputStream in, Messages parent, Locales locales) { this.parent = parent; this.locales = locales; if (in != null) { add(in); } }
/** * Adds messages. * <p/> * This merges the supplied messages with the current messages. If an existing message exists with the same * identifier as that supplied, it will be replaced. * * @param messages the messages to add */ @Override public void add(Messages messages) { putAll(messages.getMessages()); }
String welcomeText = installData.getLangpack().getString("MyHelloPanel.welcome1") + idata.getInfo().getAppName() + " " + idata.getInfo().getAppVersion() + installData.getLangpack().getString("MyHelloPanel.welcome2"); JLabel welcomeLabel = LabelFactory.create(welcomeText, parent.getIcons().get("host"), LEADING); welcomeLabel.setName(GuiId.HELLO_PANEL_LABEL.id); String authorText = installData.getLangpack().getString("MyHelloPanel.authors"); JLabel appAuthorsLabel = LabelFactory.create(authorText, parent.getIcons() .get("information"), LEADING); String urlText = installData.getLangpack().getString("MyHelloPanel.url") + idata.getInfo().getAppURL(); JLabel appURLLabel = LabelFactory.create(urlText, parent.getIcons().get("bookmark"), LEADING);
/** * Creates a new messages instance from the named resource that inherits the current messages. * * @param name the messages resource name * @return the messages */ @Override public Messages newMessages(String name) { Messages child = locales.getMessages(name); Messages result = new LocaleDatabase(this, locales); result.add(child); return result; }
webDir + "/langpacks/" + Resources.PACK_TRANSLATIONS_RESOURCE_NAME + installData.getLocaleISO3()); langPackStream = new WebAccessor(null).openInputStream(url); messages = new LocaleDatabase(langPackStream, messages, locales); fallback = false;
messages = new LocaleDatabase(in, parentMessages, this);