Search code examples
liferayliferay-6liferay-themeliferay-velocity

Liferay Language switch issue


I am trying to implement multiple language support in my liferay Project. For this i added below code in portal_normal.vmfile of theme.

#set( $availLanguage = $stringUtil.split("hi_IN,en_US"))
<span id="language">$taglibLiferay.language("fm", null, "languageId", $toto, 0)</span>

which will add support for two language Hindi,English (United States).

and created hook for multiple language properties files.

<hook>
    <language-properties>content/Language_hi.properties</language-properties>
    <language-properties>content/Language_en.properties</language-properties>
</hook>

but whenever i switch my language its not changing.It always shows values from Language_en.properties file

so to check whats happening i tried printing below values in theme

$theme_display.getLanguageId() 
$locale

but it always shows en_US even thought i changed language to hi_IN.

Looking for help to figure out whats going wrong.

Environment: Liferay 6.1.1 CE GA2


Solution

  • I think you need to add hi_IN language as Available Languages in Portal Settings if it is already not there.

    To add this/or verify go to Control Panel --> Portal Settings --> Display Settings

    here you will find a input box Available Languages which shows all available locales (comma seperated), make sure you have entry for hi_IN in this input box.