use of java.util.ResourceBundle in project OpenAM by OpenRock.
the class SMSException method getString.
private String getString(String msgID) {
errorCode = msgID;
ResourceBundle bundle = null;
if (bundleName != null) {
bundle = amCache.getResBundle(bundleName, java.util.Locale.ENGLISH);
}
return (Locale.getString(bundle, msgID, debug));
}
use of java.util.ResourceBundle in project OpenAM by OpenRock.
the class ValidateResourceResult method getLocalizedMessage.
/**
* Returns localized message.
*
* @param locale Locale.
* @return localized message.
*/
public String getLocalizedMessage(Locale locale) {
ResourceBundle rb = ResourceBundle.getBundle("EntitlementException", locale);
String str = rb.getString(message);
return ((args != null) && (args.length > 0)) ? MessageFormat.format(str, args) : str;
}
use of java.util.ResourceBundle in project OpenAM by OpenRock.
the class ResourceNameSplitTest method parseResource.
private Map<String, Set<String>> parseResource(String rbName) {
Map<String, Set<String>> results = new HashMap<String, Set<String>>();
ResourceBundle rb = ResourceBundle.getBundle(rbName);
for (Enumeration e = rb.getKeys(); e.hasMoreElements(); ) {
String k = (String) e.nextElement();
String val = rb.getString(k);
Set<String> set = new HashSet<String>();
for (StringTokenizer st = new StringTokenizer(val, ","); st.hasMoreElements(); ) {
set.add(st.nextToken().trim());
}
results.put(k, set);
}
return results;
}
use of java.util.ResourceBundle in project OpenAM by OpenRock.
the class ResourceNameIndexTest method parseResource.
private Map<String, String> parseResource(String rbName) {
Map<String, String> results = new HashMap<String, String>();
ResourceBundle rb = ResourceBundle.getBundle(rbName);
for (Enumeration e = rb.getKeys(); e.hasMoreElements(); ) {
String k = (String) e.nextElement();
String val = rb.getString(k).trim();
results.put(k, val);
}
return results;
}
use of java.util.ResourceBundle in project OpenAM by OpenRock.
the class RestException method getLocalizedMessage.
/**
* Returns localized exception message.
*
* @param locale Locale of the message.
* @return localized exception message.
*/
public String getLocalizedMessage(Locale locale) {
ResourceBundle rb = ResourceBundle.getBundle(RES_BUNDLE_NAME, locale);
String msg = rb.getString(Integer.toString(errorCode));
return (params != null) ? MessageFormat.format(msg, params) : msg;
}
Aggregations