Khoros Community

Highlighted
Frequent Advisor
Frequent Advisor

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!

0 Kudos
5 Replies 5
Honored Contributor
Honored Contributor

Re: How to change the category name depending on the language selected

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

Reply
Loading...
Frequent Advisor
Frequent Advisor

Re: How to change the category name depending on the language selected

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?

0 Kudos
Reply
Loading...
Frequent Advisor
Frequent Advisor

Re: How to change the category name depending on the language selected

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

0 Kudos
Reply
Loading...
Khoros Guru
Khoros Guru

Re: How to change the category name depending on the language selected

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


Learn how to master Khoros. Visit the Best Practice Center

If you appreciate my efforts, please give me a kudo ↓
Accept as solution to help others find it faster.
Reply
Loading...
Frequent Advisor
Frequent Advisor

Re: How to change the category name depending on the language selected

0 Kudos
Reply
Loading...