Public
cancel
Showing results for 
Show  only  | Search instead for 
Did you mean: 
Expert

How to change the category name depending on the language selected

Hi guys! Our community has two languages. You can change the language just by clicking the link in the header of each page.

Where can I add the logic to change the category name and description depending on language selected by the user?

Thanks!

5 Replies 5
Director

Hi Myko,

First you have to get the user language by using the following query and then use conditional statement.

<#assign getUserLang =restadmin("/users/id/12/profiles/name/language").value />
<#if getUserLang == "en">
// Your code here
<#elseif getUserLang == "US">
//Your code here
<#else>
//Your code here
</#if>


Let me know if it works.

Thanks,
Payal

Payal Uppal

Thanks!

I already got the same code in a couple of custom components. My question was more about where I have to place this code to get it work with categories titles/descriptions?

So can I use two different languages for categories titles/descriptions and switch it based on the language chosen by the user? 

Khoros Alumni (Retired)

It's relatively easy to replace the "PageTitle" component on the ForumPage and CategoryPage layouts with a custom component that shows different titles depending on user language setting.

 

The bigger challenge though is the board list component that you would need to completely re-created to show different titles and descriptions. There's currently no support for different localized names. The reason for that is that it's generally against best practice to combine multi-language content on the same node. You'd rather set up dedicated categories and nodes within them for each language. The only exception might be very similar language, e.g. Ukrainian and Russian that you might want to combine within the same boards.

 

See this related discussion: https://community.lithium.com/t5/Support-Forum/Can-a-Node-Title-be-a-Named-Text-Key/m-p/281433


Khoros Best Practice until August 2019. Onwards posting as Claudius.
Learn how to master Khoros. Learn Best Practice in the Community Documentation
If you appreciate my efforts, please give me a kudo ↓
Accept as solution to help others find it faster.

Welcome to the Technology board!

Curious about our platform? Looking to connect on social technology? You've come to the right place!

Are you a Khoros customer? For direct assistance from our Support team, please visit the Support Forum.