RE: How to make localised custom text in Configurable Theme Settings?

Jason Chee, modified 6 Years ago. Junior Member Posts: 52 Join Date: 9/24/18 Recent Posts
Hey all, I've followed this tutorial https://dev.liferay.com/develop/tutorials/-/knowledge_base/7-1/making-configurable-theme-settings to make an editable disclaimer for the footer of my site. I think it is a good feature, as the disclaimer might need to be changed by someone who only access the portal's settings instead of Language.properties files.

However, the site is multilingual and needs the disclaimer to be written in multiple languages. How do I make the configurable theme settings cater multiple languages?
thumbnail
Olaf Kock, modified 6 Years ago. Liferay Legend Posts: 6441 Join Date: 9/23/08 Recent Posts
Jason CheeHey all, I've followed this tutorial https://dev.liferay.com/develop/tutorials/-/knowledge_base/7-1/making-configurable-theme-settings to make an editable disclaimer for the footer of my site. I think it is a good feature, as the disclaimer might need to be changed by someone who only access the portal's settings instead of Language.properties files.

However, the site is multilingual and needs the disclaimer to be written in multiple languages. How do I make the configurable theme settings cater multiple languages?
You could embed a Web Content Article in your theme and make its ID configurable. The translation would be made within the article itself.
Jason Chee, modified 6 Years ago. Junior Member Posts: 52 Join Date: 9/24/18 Recent Posts
This sounds like a good workaround. However, does this also mean the configurable theme settings don't support locales?
thumbnail
Olaf Kock, modified 6 Years ago. Liferay Legend Posts: 6441 Join Date: 9/23/08 Recent Posts
Jason Chee
This sounds like a good workaround. However, does this also mean the configurable theme settings don't support locales?
I'm typically keeping myself away from themes these days, but in the days when I was still touching them, the configurable values weren't configurable. I assume that they still aren't, because this would raise complexity significantly, and a good workaround exists with the given technique.

Note that you can embed static content in your theme, or in your layout template - both would be valid considerations (but again, that's independent of the locales)
Jason Chee, modified 6 Years ago. Junior Member Posts: 52 Join Date: 9/24/18 Recent Posts
Hey Olaf, I tried to apply your technique but I've encountered a separate issue: https://community.liferay.com/forums/-/message_boards/message/113179098?_com_liferay_message_boards_web_portlet_MBPortlet_showBreadcrumb=false

Just wondering if you know what caused this?
thumbnail
Andrew Jardine, modified 6 Years ago. Liferay Legend Posts: 2416 Join Date: 12/22/10 Recent Posts
Hi Jason, 

I once say this solved by adding a theme setting for each language, which worked, but it's a very effective solution if you plan to grow the number of languages you support in the future. What Olaf is suggesting I think is the best answer because (as you pointed out) theme settings don't suport locales. In fact, theme settings really aren't (imho) designed for such purposes so it makes sense that they are not localizeable. 

I have had to do similar things to what you are asking in the past and have always leaned on a Web Conten portlet combined with the runtime tag to embed it. It also has the added benefit of being runtime configurable (ie. no deployment to change) where as the Language.properties solution would require a new build to alter the text.

In the end, my client who tried to fake it with theme settings regretted the cheat the very first time they have to add a new locale to their site.
Jason Chee, modified 6 Years ago. Junior Member Posts: 52 Join Date: 9/24/18 Recent Posts
Alright, I shall try with Web Content as suggested by you and Olaf. Thanks!