Search in sources :

Example 26 with ResourceBundle

use of java.util.ResourceBundle in project head by mifos.

the class ViewStageTransactionActionForm method trxnDateValidate.

private ActionErrors trxnDateValidate(ActionErrors errors, Locale locale) {
    if (StringUtils.isNotBlank(getStageTrxnDate()) && !DateUtils.isValidDate(getStageTrxnDate())) {
        ResourceBundle resources = ResourceBundle.getBundle(FilePaths.SIMPLE_ACCOUNTING_RESOURCE, locale);
        String trxnDate = resources.getString(SimpleAccountingConstants.TRXNDATE);
        errors.add(SimpleAccountingConstants.INVALID_TRXN_DATE, new ActionMessage(SimpleAccountingConstants.INVALID_TRXN_DATE, trxnDate));
    }
    return errors;
}
Also used : ActionMessage(org.apache.struts.action.ActionMessage) ResourceBundle(java.util.ResourceBundle)

Example 27 with ResourceBundle

use of java.util.ResourceBundle in project head by mifos.

the class InterOfficeTransferActionForm method trxnDateValidate.

private ActionErrors trxnDateValidate(ActionErrors errors, Locale locale) {
    if (StringUtils.isNotBlank(getTrxnDate()) && !DateUtils.isValidDate(getTrxnDate())) {
        ResourceBundle resources = ResourceBundle.getBundle(FilePaths.SIMPLE_ACCOUNTING_RESOURCE, locale);
        String trxnDate = resources.getString(SimpleAccountingConstants.TRXNDATE);
        errors.add(SimpleAccountingConstants.INVALID_TRXN_DATE, new ActionMessage(SimpleAccountingConstants.INVALID_TRXN_DATE, trxnDate));
    }
    return errors;
}
Also used : ActionMessage(org.apache.struts.action.ActionMessage) ResourceBundle(java.util.ResourceBundle)

Example 28 with ResourceBundle

use of java.util.ResourceBundle in project head by mifos.

the class MifosImageTag method doStartTag.

/**
     * Function to render the tag
     *
     * @throws JspException
     */
@Override
public int doStartTag() throws JspException {
    JspWriter out = pageContext.getOut();
    ResourceBundle resource = getResourceBundle();
    path = resource.getString(getId());
    try {
        out.println(render());
    } catch (IOException e) {
        e.printStackTrace();
    }
    return SKIP_BODY;
}
Also used : ResourceBundle(java.util.ResourceBundle) IOException(java.io.IOException) JspWriter(javax.servlet.jsp.JspWriter)

Example 29 with ResourceBundle

use of java.util.ResourceBundle in project jscs-plugin by idok.

the class JscsBundle method getBundle.

private static ResourceBundle getBundle() {
    ResourceBundle bundle = com.intellij.reference.SoftReference.dereference(ourBundle);
    if (bundle == null) {
        bundle = ResourceBundle.getBundle(BUNDLE);
        ourBundle = new SoftReference<ResourceBundle>(bundle);
    }
    return bundle;
}
Also used : ResourceBundle(java.util.ResourceBundle)

Example 30 with ResourceBundle

use of java.util.ResourceBundle in project jodd by oblac.

the class ResourceBundleMessageResolver method findResourceBundle.

/**
	 * Finds resource bundle by it's name. Missed and founded resource bundles are cached for
	 * better performances. Returns <code>null</code> if resource bundle is missing.
	 */
public ResourceBundle findResourceBundle(String bundleName, Locale locale) {
    if (bundleName == null) {
        bundleName = fallbackBundlename;
    }
    if (locale == null) {
        locale = fallbackLocale;
    }
    if (!cacheResourceBundles) {
        try {
            return getBundle(bundleName, locale, ClassLoaderUtil.getDefaultClassLoader());
        } catch (MissingResourceException ignore) {
            return null;
        }
    }
    String key = bundleName + '_' + LocaleUtil.resolveLocaleCode(locale);
    try {
        if (!misses.contains(key)) {
            ResourceBundle bundle = notmisses.get(key);
            if (bundle == null) {
                bundle = getBundle(bundleName, locale, ClassLoaderUtil.getDefaultClassLoader());
                notmisses.put(key, bundle);
            }
            return bundle;
        }
    } catch (MissingResourceException ignore) {
        misses.add(key);
    }
    return null;
}
Also used : MissingResourceException(java.util.MissingResourceException) ResourceBundle(java.util.ResourceBundle)

Aggregations

ResourceBundle (java.util.ResourceBundle)605 Locale (java.util.Locale)80 MissingResourceException (java.util.MissingResourceException)80 HashMap (java.util.HashMap)41 ArrayList (java.util.ArrayList)36 ActionMessage (org.apache.struts.action.ActionMessage)29 Test (org.junit.Test)29 File (java.io.File)27 IOException (java.io.IOException)27 Enumeration (java.util.Enumeration)24 PropertyResourceBundle (java.util.PropertyResourceBundle)22 Preferences (java.util.prefs.Preferences)20 URL (java.net.URL)19 Map (java.util.Map)19 HashSet (java.util.HashSet)17 Set (java.util.Set)16 Iterator (java.util.Iterator)15 ListResourceBundle (java.util.ListResourceBundle)14 Engine (jgnash.engine.Engine)14 SSOException (com.iplanet.sso.SSOException)13