Example usage for com.liferay.portal.kernel.language UnicodeLanguageUtil format

List of usage examples for com.liferay.portal.kernel.language UnicodeLanguageUtil format

Introduction

In this page you can find the example usage for com.liferay.portal.kernel.language UnicodeLanguageUtil format.

Prototype

public static String format(ResourceBundle resourceBundle, String pattern, Object[] arguments,
            boolean translateArguments) 

Source Link

Usage

From source file:com.liferay.taglib.ui.MessageTag.java

License:Open Source License

@Override
public int doEndTag() throws JspException {
    try {/*from  w w  w  . j av a  2 s  .co  m*/
        String value = StringPool.BLANK;

        if (_arguments == null) {
            if (_unicode) {
                value = UnicodeLanguageUtil.get(pageContext, _key);
            } else {
                value = LanguageUtil.get(pageContext, _key);
            }
        } else {
            if (_unicode) {
                value = UnicodeLanguageUtil.format(pageContext, _key, _arguments, _translateArguments);
            } else {
                value = LanguageUtil.format(pageContext, _key, _arguments, _translateArguments);
            }
        }

        JspWriter jspWriter = pageContext.getOut();

        jspWriter.write(value);

        return EVAL_PAGE;
    } catch (Exception e) {
        throw new JspException(e);
    } finally {
        if (!ServerDetector.isResin()) {
            _arguments = null;
            _key = null;
            _translateArguments = true;
            _unicode = false;
        }
    }
}