yasuflatland-lf / damascus

⚔️ CRUD boilerplate generator for Liferay DXP
https://yasuflatland-lf.github.io/damascus-doc/
GNU Lesser General Public License v3.0
51 stars 35 forks source link

It is possible to implement columns with multilingual capabilities ? #96

Open icarrara opened 4 years ago

icarrara commented 4 years ago

In Liferay portal, Varchar and RichText columns may have multilingual capabilities.

To define a multilingual column, in ServiceBuilder we need for example: <column name="description" type="String" localized="true" />

If you want to access the above column from jsp page, you have to write: <%= LanguageUtil.get(pageContext,"description") %>

If you want to access the above column from controller, you have to write: PortletConfig portletConfig = (PortletConfig) portletRequest.getAttribute(JavaConstants.JAVAX_PORTLET_CONFIG); String description = LanguageUtil.get(portletConfig, locale, key);

where: locale = themeDisplay.getLocale() key = the key which you have defined in Language.property file.

Question/Request: To manage in Damascus columns with multilingual capabilities, it is possible to implement a new property in Varchar and RichText fields as below and manage it?

{ "type": "com.liferay.damascus.cli.json.fields.Varchar", "name": "title", "title": "Title", "length": "80", "showFieldInView": "true", "required": "true", "localized": "true" }

Thank you for comments.

yasuflatland-lf commented 4 years ago

@icarrara Let me look into this. If this can be done only by taglib and no backend modification is necessary, this could be added as a template.

yasuflatland-lf commented 4 years ago

David's blog for reference https://liferay.dev/blogs/-/blogs/new-since-liferay-7-1-localized-entities

icarrara commented 4 years ago

@yasuflatland-lf I saw that localized fileds was changed so we need backend motification, right ?

Do you think that it is still possible to implement localized fileds in Damascus ?