Search in sources :

Example 1 with LocaleUtils

use of org.apache.commons.lang3.LocaleUtils in project fess by codelibs.

the class FessUserLocaleProcessProvider method findBusinessLocale.

@Override
public OptionalThing<Locale> findBusinessLocale(final ActionRuntime runtimeMeta, final RequestManager requestManager) {
    final FessConfig fessConfig = ComponentUtil.getFessConfig();
    final String name = fessConfig.getQueryBrowserLangParameterName();
    if (StringUtil.isNotBlank(name)) {
        try {
            return requestManager.getParameter(name).filter(StringUtil::isNotBlank).map(LocaleUtils::toLocale);
        } catch (final Exception e) {
            logger.debug("Failed to parse a value of " + name + ".", e);
        }
    }
    return OptionalObject.empty();
}
Also used : LocaleUtils(org.apache.commons.lang3.LocaleUtils) FessConfig(org.codelibs.fess.mylasta.direction.FessConfig)

Aggregations

LocaleUtils (org.apache.commons.lang3.LocaleUtils)1 FessConfig (org.codelibs.fess.mylasta.direction.FessConfig)1