package net.sourceforge.phpeclipse.wiki.actions.mediawiki.config; //Parts of this sources are copied and modified from the jEdit Wikipedia plugin: //http://www.djini.de/software/wikipedia/index.html // //The modified sources are available under the "Common Public License" //with permission from the original author: Daniel Wunsch import java.text.MessageFormat; import java.util.MissingResourceException; import java.util.ResourceBundle; public class WikiProperties { private static final String PACKAGE_NAME = WikiProperties.class.getPackage().getName(); private String RESOURCE_BUNDLE = null; private ResourceBundle fgResourceBundle = null; protected WikiProperties(String locale) { RESOURCE_BUNDLE = PACKAGE_NAME + ".WikiProperties" + locale; fgResourceBundle = ResourceBundle.getBundle(RESOURCE_BUNDLE); } public String getString(String key) { try { return fgResourceBundle.getString(key); } catch (MissingResourceException e) { return '!' + key + '!'; } } /** * Gets a string from the resource bundle and formats it with the argument * * @param key * the string used to get the bundle value, must not be null */ public String getFormattedString(String key, Object arg) { return MessageFormat.format(getString(key), new Object[] { arg }); } /** * Gets a string from the resource bundle and formats it with arguments */ public String getFormattedString(String key, Object[] args) { return MessageFormat.format(getString(key), args); } // test code // public static void main(String[] args) { // WikiProperties p = new WikiProperties("EN"); // System.out.println(p.getString("uploadNoLogin")); // } }