Last active
August 29, 2015 14:03
-
-
Save htmlr/fdede9d227f8c2e5d080 to your computer and use it in GitHub Desktop.
Liferay 6.1 Bootstrap language selector
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
| #* BOOTSTRAP 2.3.2 LANGUAGE SELECTOR | |
| I've found this doesnt work consistently in LR 6.1 GA2 also it prefixes the text with 'Beta' for some unknown reason | |
| $taglibLiferay.language("fm",null,"languageId",1) | |
| *# | |
| <div class="dropdown"> | |
| <a class="dropdown-toggle" id="language-selector" role="button" data-toggle="dropdown" href="#"> | |
| <strong>#*$locale.getDisplayName()*#$locale.getLanguage().toUpperCase() ($locale.getCountry().toUpperCase())</strong> | |
| <i class="-icon-caret-down"></i> | |
| </a> | |
| #set ($change_language_url = $portletURLFactory.create($request, "82", $page.getPlid(), "ACTION_PHASE")) | |
| $change_language_url.setWindowState("normal") | |
| $change_language_url.setPortletMode("view") | |
| $change_language_url.setParameter("struts_action", "/language/view") | |
| $change_language_url.setParameter("redirect", "$portalUtil.getCurrentURL($request)") | |
| #set($availableLocales = $languageUtil.getAvailableLocales()) | |
| <ul class="dropdown-menu" role="menu" aria-labelledby="language-selector"> | |
| #foreach( $availableLocale in $availableLocales ) | |
| <li> | |
| <a tabindex="-1" href="${change_language_url}&languageId=$availableLocale">$availableLocale.getDisplayName()</a> | |
| </li> | |
| #end | |
| </ul> | |
| </div> |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment