Search in sources :

Example 1 with TextProviderFactory

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

the class ResourceBundleSupport method getLocaleMap.

public static Map<String, String> getLocaleMap(LocaleProvider localeProvider, Class<?> resourceType) {
    TextProviderFactory factory = new TextProviderFactory();
    TextProvider provider = factory.createInstance(resourceType, localeProvider);
    ResourceBundle bundle = provider.getTexts();
    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 : TextProviderFactory(com.opensymphony.xwork2.TextProviderFactory) ResourceBundle(java.util.ResourceBundle) TextProvider(com.opensymphony.xwork2.TextProvider) LinkedHashMap(java.util.LinkedHashMap)

Aggregations

TextProvider (com.opensymphony.xwork2.TextProvider)1 TextProviderFactory (com.opensymphony.xwork2.TextProviderFactory)1 LinkedHashMap (java.util.LinkedHashMap)1 ResourceBundle (java.util.ResourceBundle)1