Search in sources :

Example 1 with StrutsLocalizedTextProvider

use of com.opensymphony.xwork2.util.StrutsLocalizedTextProvider in project onebusaway-application-modules by camsys.

the class ResourceBundleSupport method getLocaleMap.

public static Map<String, String> getLocaleMap(LocaleProvider localeProvider, Class<?> resourceType) {
    StrutsLocalizedTextProvider localizedTextProvider = new StrutsLocalizedTextProvider();
    ResourceBundle bundle = localizedTextProvider.findResourceBundle(resourceType.getName(), Locale.getDefault());
    Map<String, String> m = new LinkedHashMap<String, String>();
    for (Enumeration<String> en = bundle.getKeys(); en.hasMoreElements(); ) {
        String key = en.nextElement();
        String value = bundle.getString(key);
        m.put(key, value);
    }
    return m;
}
Also used : StrutsLocalizedTextProvider(com.opensymphony.xwork2.util.StrutsLocalizedTextProvider) ResourceBundle(java.util.ResourceBundle) LinkedHashMap(java.util.LinkedHashMap)

Example 2 with StrutsLocalizedTextProvider

use of com.opensymphony.xwork2.util.StrutsLocalizedTextProvider in project onebusaway-application-modules by camsys.

the class TwilioSupport method addMessage.

protected void addMessage(String msg, Object... args) {
    ActionContext context = ActionContext.getContext();
    Locale locale = context.getLocale();
    ValueStack valueStack = context.getValueStack();
    String text = new StrutsLocalizedTextProvider().findText(TwilioSupport.this.getClass(), msg, locale, msg, args, valueStack);
    _log.debug("message: " + text);
    _message.append(" " + text + " ");
    _log.debug(getText(msg));
}
Also used : Locale(java.util.Locale) StrutsLocalizedTextProvider(com.opensymphony.xwork2.util.StrutsLocalizedTextProvider) ValueStack(com.opensymphony.xwork2.util.ValueStack) ActionContext(com.opensymphony.xwork2.ActionContext)

Aggregations

StrutsLocalizedTextProvider (com.opensymphony.xwork2.util.StrutsLocalizedTextProvider)2 ActionContext (com.opensymphony.xwork2.ActionContext)1 ValueStack (com.opensymphony.xwork2.util.ValueStack)1 LinkedHashMap (java.util.LinkedHashMap)1 Locale (java.util.Locale)1 ResourceBundle (java.util.ResourceBundle)1