More in this section

Forums / General Discussions / Taxonomy Localization

Taxonomy Localization

2 posts, 0 answered
  1. Kevin
    Kevin avatar
    20 posts
    14 Jun 2010
    18 Aug 2011
    Link to this post
    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?

  2. Lubomir Velkov
    Lubomir Velkov avatar
    688 posts
    03 Nov 2014
    22 Aug 2011
    Link to this post
    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 >>

2 posts, 0 answered