cancel
Showing results for 
Show  only  | Search instead for 
Did you mean: 
%3CLINGO-SUB%20id%3D%22lingo-sub-435896%22%20slang%3D%22en-US%22%3EHow%20to%20change%20the%20category%20name%20depending%20on%20the%20language%20selected%3C%2FLINGO-SUB%3E%3CLINGO-BODY%20id%3D%22lingo-body-435896%22%20slang%3D%22en-US%22%3E%3CP%3EHi%20guys!%20Our%20community%20has%20two%20languages.%20You%20can%20change%20the%20language%20just%20by%20clicking%20the%20link%20in%20the%20header%20of%20each%20page.%3C%2FP%3E%3CP%3EWhere%20can%20I%20add%20the%20logic%20to%20change%20the%20category%20name%20and%20description%20depending%20on%20language%20selected%20by%20the%20user%3F%3C%2FP%3E%3CP%3EThanks!%3C%2FP%3E%3C%2FLINGO-BODY%3E%3CLINGO-SUB%20id%3D%22lingo-sub-436062%22%20slang%3D%22en-US%22%3ERe%3A%20How%20to%20change%20the%20category%20name%20depending%20on%20the%20language%20selected%3C%2FLINGO-SUB%3E%3CLINGO-BODY%20id%3D%22lingo-body-436062%22%20slang%3D%22en-US%22%3E%3CP%3EThank%20you%20all!%20Just%20created%20a%20related%20Idea%26nbsp%3B%3CA%20href%3D%22https%3A%2F%2Fcommunity.lithium.com%2Ft5%2FProduct-Ideas%2FMulti-Language-support-for-Boards-Categories-Titles-and%2Fidi-p%2F436061%22%20target%3D%22_blank%22%20rel%3D%22noopener%20noreferrer%22%3Ehttps%3A%2F%2Fcommunity.lithium.com%2Ft5%2FProduct-Ideas%2FMulti-Language-support-for-Boards-Categories-Titles-and%2Fidi-p%2F436061%3C%2FA%3E%3C%2FP%3E%3C%2FLINGO-BODY%3E%3CLINGO-SUB%20id%3D%22lingo-sub-436058%22%20slang%3D%22en-US%22%3ERe%3A%20How%20to%20change%20the%20category%20name%20depending%20on%20the%20language%20selected%3C%2FLINGO-SUB%3E%3CLINGO-BODY%20id%3D%22lingo-body-436058%22%20slang%3D%22en-US%22%3E%3CP%3EIt's%20relatively%20easy%20to%20replace%20the%20%22PageTitle%22%20component%20on%20the%20ForumPage%20and%20CategoryPage%20layouts%20with%20a%20custom%20component%20that%20shows%20different%20titles%20depending%20on%20user%20language%20setting.%3C%2FP%3E%0A%3CP%3E%26nbsp%3B%3C%2FP%3E%0A%3CP%3EThe%20bigger%20challenge%20though%20is%20the%20board%20list%20component%20that%20you%20would%20need%20to%20completely%20re-created%20to%20show%20different%20titles%20and%20descriptions.%26nbsp%3BThere's%20currently%20no%20support%20for%20different%20localized%20names.%20The%20reason%20for%20that%20is%20that%20it's%20generally%20against%20best%20practice%20to%20combine%20multi-language%20content%20on%20the%20same%20node.%20You'd%20rather%20set%20up%20dedicated%20categories%20and%20nodes%20within%20them%20for%20each%20language.%20The%20only%20exception%20might%20be%20very%26nbsp%3Bsimilar%20language%2C%20e.g.%20Ukrainian%20and%20Russian%20that%20you%20might%20want%20to%20combine%20within%20the%20same%20boards.%3C%2FP%3E%0A%3CP%3E%26nbsp%3B%3C%2FP%3E%0A%3CP%3ESee%20this%20related%20discussion%3A%20%3CA%20href%3D%22https%3A%2F%2Fcommunity.lithium.com%2Ft5%2FSupport-Forum%2FCan-a-Node-Title-be-a-Named-Text-Key%2Fm-p%2F281433%22%20target%3D%22_blank%22%20rel%3D%22noopener%20noreferrer%22%3Ehttps%3A%2F%2Fcommunity.lithium.com%2Ft5%2FSupport-Forum%2FCan-a-Node-Title-be-a-Named-Text-Key%2Fm-p%2F281433%3C%2FA%3E%3C%2FP%3E%3C%2FLINGO-BODY%3E%3CLINGO-SUB%20id%3D%22lingo-sub-436038%22%20slang%3D%22en-US%22%3ERe%3A%20How%20to%20change%20the%20category%20name%20depending%20on%20the%20language%20selected%3C%2FLINGO-SUB%3E%3CLINGO-BODY%20id%3D%22lingo-body-436038%22%20slang%3D%22en-US%22%3E%3CP%3ESo%20can%20I%20use%20two%20different%20languages%20for%20categories%20titles%2Fdescriptions%20and%20switch%20it%20based%20on%20the%20language%20chosen%20by%20the%20user%3F%26nbsp%3B%3C%2FP%3E%3C%2FLINGO-BODY%3E%3CLINGO-SUB%20id%3D%22lingo-sub-435907%22%20slang%3D%22en-US%22%3ERe%3A%20How%20to%20change%20the%20category%20name%20depending%20on%20the%20language%20selected%3C%2FLINGO-SUB%3E%3CLINGO-BODY%20id%3D%22lingo-body-435907%22%20slang%3D%22en-US%22%3E%3CP%3EThanks!%3C%2FP%3E%3CP%3EI%20already%20got%20the%20same%20code%20in%20a%20couple%20of%20custom%20components.%20My%20question%20was%20more%20about%20where%20I%20have%20to%20place%20this%20code%20to%20get%20it%20work%20with%20categories%20titles%2Fdescriptions%3F%3C%2FP%3E%3C%2FLINGO-BODY%3E%3CLINGO-SUB%20id%3D%22lingo-sub-435903%22%20slang%3D%22en-US%22%3ERe%3A%20How%20to%20change%20the%20category%20name%20depending%20on%20the%20language%20selected%3C%2FLINGO-SUB%3E%3CLINGO-BODY%20id%3D%22lingo-body-435903%22%20slang%3D%22en-US%22%3E%3CP%3EHi%20Myko%2CFirst%20you%20have%20to%20get%20the%20user%20language%20by%20using%20the%20following%20query%20and%20then%20use%20conditional%20statement.%3CBR%20%2F%3E%3CBR%20%2F%3E%3C%2FP%3E%3CPRE%3E%26lt%3B%23assign%20getUserLang%20%3Drestadmin(%22%2Fusers%2Fid%2F12%2Fprofiles%2Fname%2Flanguage%22).value%20%2F%26gt%3B%0A%26lt%3B%23if%20getUserLang%20%3D%3D%20%22en%22%26gt%3B%0A%2F%2F%20Your%20code%20here%0A%26lt%3B%23elseif%20getUserLang%20%3D%3D%20%22US%22%26gt%3B%0A%2F%2FYour%20code%20here%0A%26lt%3B%23else%26gt%3B%0A%2F%2FYour%20code%20here%0A%26lt%3B%2F%23if%26gt%3B%3C%2FPRE%3E%3CP%3E%3CBR%20%2F%3ELet%20me%20know%20if%20it%20works.Thanks%2CPayal%3C%2FP%3E%3C%2FLINGO-BODY%3E
Highlighted
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!

5 Replies 5
Highlighted
Honored Contributor

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

Highlighted
Frequent Advisor

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?

Highlighted
Frequent Advisor

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

Highlighted
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.