1.

How To Support Internationalization (i18n) On Liferay Portlets? How Do You Support Multiple Languages Without Writing Java Code In Liferay?

Answer»

We can support internationalization (i18n) on Liferay portlets and through out this whole Liferay portal. We need to provide whatever LANGUAGE we need to support into LIferay portal. This is mainly reads the regions number and provide the available language like en_US(english), SG(singapore), zh_CN(simple chinease), zh_TW(traditional chinease), ja_JP(Japanease). 

In the same way to provide support of multiple languages WITHOUT writing java code in Liferay, we can use Locales this through out the portal,

portlet, hooks and themes. This entry we can provide into same portal-ext.properties which Liferay portal would read and provide all the translation accordingly.

locales=en_US,zh_CN,zh_TW,ja_JP,ko_KR

If we are writing some custom messages in out code then we need to provide the below PROPERTY files also as per the called language and using of Locales would convert it accordingly. We can use LocaleUtil in our code which will convert the certain MESSAGE given in language files. 

For example we want the assetCategory title in multi languages then we need to use this assetCategory.getTitle(locale). So here whatever locale we have mentioned earlier would be in action and pick the given title name from certain locale RELATED language.property file.

Language_en_US.properties
Language_zh_CN.properties
Language_zh_TW.properties

We can support internationalization (i18n) on Liferay portlets and through out this whole Liferay portal. We need to provide whatever language we need to support into LIferay portal. This is mainly reads the regions number and provide the available language like en_US(english), SG(singapore), zh_CN(simple chinease), zh_TW(traditional chinease), ja_JP(Japanease). 

In the same way to provide support of multiple languages without writing java code in Liferay, we can use Locales this through out the portal,

portlet, hooks and themes. This entry we can provide into same portal-ext.properties which Liferay portal would read and provide all the translation accordingly.

locales=en_US,zh_CN,zh_TW,ja_JP,ko_KR

If we are writing some custom messages in out code then we need to provide the below property files also as per the called language and using of Locales would convert it accordingly. We can use LocaleUtil in our code which will convert the certain message given in language files. 

For example we want the assetCategory title in multi languages then we need to use this assetCategory.getTitle(locale). So here whatever locale we have mentioned earlier would be in action and pick the given title name from certain locale related language.property file.

Language_en_US.properties
Language_zh_CN.properties
Language_zh_TW.properties



Discussion

No Comment Found