1 18 package org.apache.batik.util; 19 20 import java.util.Locale ; 21 import java.util.MissingResourceException ; 22 23 import org.apache.batik.i18n.LocalizableSupport; 24 import org.apache.batik.util.gui.resource.ResourceManager; 25 26 32 public class Messages { 33 34 37 protected Messages() { } 38 39 42 protected final static String RESOURCES = 43 "org.apache.batik.util.resources.Messages"; 44 45 48 protected static LocalizableSupport localizableSupport = 49 new LocalizableSupport(RESOURCES, Messages.class.getClassLoader()); 50 51 54 protected static ResourceManager resourceManager = 55 new ResourceManager(localizableSupport.getResourceBundle()); 56 57 60 public static void setLocale(Locale l) { 61 localizableSupport.setLocale(l); 62 resourceManager = new ResourceManager(localizableSupport.getResourceBundle()); 63 } 64 65 68 public static Locale getLocale() { 69 return localizableSupport.getLocale(); 70 } 71 72 76 public static String formatMessage(String key, Object [] args) 77 throws MissingResourceException { 78 return localizableSupport.formatMessage(key, args); 79 } 80 81 public static String getString(String key) 82 throws MissingResourceException { 83 return resourceManager.getString(key); 84 } 85 86 public static int getInteger(String key) 87 throws MissingResourceException { 88 return resourceManager.getInteger(key); 89 } 90 91 public static int getCharacter(String key) 92 throws MissingResourceException { 93 return resourceManager.getCharacter(key); 94 } 95 } 96 | Popular Tags |