Example usage for com.liferay.portal.kernel.language LanguageUtil isDuplicateLanguageCode

List of usage examples for com.liferay.portal.kernel.language LanguageUtil isDuplicateLanguageCode

Introduction

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

Prototype

public static boolean isDuplicateLanguageCode(String languageCode) 

Source Link

Usage

From source file:com.liferay.portlet.layoutsadmin.util.SitemapImpl.java

License:Open Source License

protected String buildI18NPath(Locale locale) {
    String languageId = LocaleUtil.toLanguageId(locale);

    if (Validator.isNull(languageId)) {
        return null;
    }//from   w  w w . j a  va2 s . c  o  m

    if (LanguageUtil.isDuplicateLanguageCode(locale.getLanguage())) {
        Locale priorityLocale = LanguageUtil.getLocale(locale.getLanguage());

        if (locale.equals(priorityLocale)) {
            languageId = locale.getLanguage();
        }
    } else {
        languageId = locale.getLanguage();
    }

    return StringPool.SLASH.concat(languageId);
}