Taxonomy Localization

Posted by Community Admin on 03-Aug-2018 18:35

Taxonomy Localization

All Replies

Posted by Community Admin on 18-Aug-2011 00:00

I have a project that I'm using some of the examples posted in these forums and the developer's guide to get taxonomy terms using the API.  It's a bilingual site (English and French) but I'm seemingly only able to get the English versions of the terms.  

I'm using the following: 

TaxonomyManager tManager = TaxonomyManager.GetManager();
                ITaxonomy categoriesTaxonomy = tManager.GetTaxonomy(TaxonomyManager.CategoriesTaxonomyId);

Any suggestions?

Thanks!

Posted by Community Admin on 22-Aug-2011 00:00

Hi Kevin,

You can set the CurrentUICulture of the current thread to the culture you would like to get the Taxonomy for, then get the taxonomy, then switch the culture back to its original value:

var savedCulture = System.Threading.Thread.CurrentThread.CurrentUICulture;
System.Threading.Thread.CurrentThread.CurrentUICulture = new System.Globalization.CultureInfo("fi");
 
TaxonomyManager tManager = TaxonomyManager.GetManager();
var tagsTaxonomy = tManager.GetTaxonomy(TaxonomyManager.TagsTaxonomyId);
 
var firstTaxon = tagsTaxonomy.Taxa.First();
 
System.Threading.Thread.CurrentThread.CurrentUICulture = savedCulture;

Best wishes,
Lubomir Velkov
the Telerik team

Thank you for being the most amazing .NET community! Your unfailing support is what helps us charge forward! We'd appreciate your vote for Telerik in this year's DevProConnections Awards. We are competing in mind-blowing 20 categories and every vote counts! VOTE for Telerik NOW >>

This thread is closed