View Javadoc

1   package es.caib.signatura.impl.locales;
2   
3   import java.util.Locale;
4   import java.util.MissingResourceException;
5   import java.util.PropertyResourceBundle;
6   import java.util.ResourceBundle;
7   
8   public class Messages {
9   	private static final String BUNDLE_NAME = "es.caib.signatura.impl.locales.messages"; //$NON-NLS-1$
10  
11  	private static ResourceBundle RESOURCE_BUNDLE;
12  
13  	static{
14  		  try {
15  			  RESOURCE_BUNDLE =  (PropertyResourceBundle) ResourceBundle.getBundle(BUNDLE_NAME);
16  		  } catch (MissingResourceException e) {
17  			  RESOURCE_BUNDLE =  (PropertyResourceBundle) ResourceBundle.getBundle(BUNDLE_NAME,  new Locale("ca"));
18  		  }
19  	}
20  	
21  	private Messages() {
22  	}
23  
24  	public static String getString(String key) {
25  		try {
26  			return RESOURCE_BUNDLE.getString(key);
27  		} catch (MissingResourceException e) {
28  			return '!' + key + '!';
29  		}
30  	}
31  }