1 package net.sourceforge.phpeclipse.wiki.actions.mediawiki.config;
2 //Parts of this sources are copied and modified from the jEdit Wikipedia plugin:
3 //http://www.djini.de/software/wikipedia/index.html
5 //The modified sources are available under the "Common Public License"
6 //with permission from the original author: Daniel Wunsch
8 import java.text.MessageFormat;
9 import java.util.MissingResourceException;
10 import java.util.ResourceBundle;
12 public class WikiProperties {
14 private static final String PACKAGE_NAME = WikiProperties.class.getPackage().getName();
16 private String RESOURCE_BUNDLE = null;
18 private ResourceBundle fgResourceBundle = null;
20 protected WikiProperties(String locale) {
21 RESOURCE_BUNDLE = PACKAGE_NAME + ".WikiProperties" + locale;
22 fgResourceBundle = ResourceBundle.getBundle(RESOURCE_BUNDLE);
25 public String getString(String key) {
27 return fgResourceBundle.getString(key);
28 } catch (MissingResourceException e) {
29 return '!' + key + '!';
34 * Gets a string from the resource bundle and formats it with the argument
37 * the string used to get the bundle value, must not be null
39 public String getFormattedString(String key, Object arg) {
40 return MessageFormat.format(getString(key), new Object[] { arg });
44 * Gets a string from the resource bundle and formats it with arguments
46 public String getFormattedString(String key, Object[] args) {
47 return MessageFormat.format(getString(key), args);
51 // public static void main(String[] args) {
52 // WikiProperties p = new WikiProperties("EN");
53 // System.out.println(p.getString("uploadNoLogin"));