+1-888-365-2779
Try Now
More in this section

Forums / Set-up & Installation / Changing default culture

Changing default culture

2 posts, 0 answered
  1. KocSchool
    KocSchool avatar
    2 posts
    Registered:
    28 Jun 2007
    04 Mar 2008
    Link to this post
    Hi,

    If I change the default culture of my site through the web.config file, i.e changing:
    <localization defaultProvider="Sitefinity"
    persistenceMode="PathPrefix" defaultCulture="en" cultures="en, tr">
    into
    <localization defaultProvider="Sitefinity" persistenceMode="PathPrefix" defaultCulture="tr" cultures="en, tr">
    or
    <localization defaultProvider="Sitefinity" persistenceMode="PathPrefix" defaultCulture="tr" cultures="tr, en">
    I get an error:
    System.ArgumentException: An item with the same key has already been added.

    Now before I made the change I already added quite some pages to the English sitemap. I found a thread on the forum that warned not to change the default culture after adding pages, however this warning came too late.

    Question is: do I have to remove all pages and start all over again (or will this not prevent the error), or do I need to reinstall SF... or, better, ... is there a way to save me?

    Below the full error:
    [ArgumentException: An item with the same key has already been added.]
       System.ThrowHelper.ThrowArgumentException(ExceptionResource resource) +48
       System.Collections.Generic.Dictionary`2.Insert(TKey key, TValue value, Boolean add) +1057449
       System.Collections.Generic.Dictionary`2.Add(TKey key, TValue value) +11
       Telerik.Cms.Data.CmsPage.get_LanguageVersions() +232
       Telerik.Cms.Web.UrlHelper.FillTableRecursive(IPagesContainer
    parent, String parentPath, CmsUrlContext parentUrlContext) +646
       Telerik.Cms.Web.UrlHelper.FillTable(CmsManager man) +115
       Telerik.Cms.Web.UrlHelper..cctor() +634

    [TypeInitializationException: The type initializer for 'Telerik.Cms.Web.UrlHelper' threw an exception.]
       Telerik.Cms.Web.UrlHelper.UnresolveLanguageUrl(String path, String&
    languageCode) +0
       Telerik.Cms.Web.CmsHttpModule.SetCurrentCulture(HttpContext
    context, String& path, String query, Boolean& redirected) +69
       Telerik.Cms.Web.CmsHttpModule.BeginRequest(Object sender, EventArgs e) +1224
       System.Web.SyncEventExecutionStep.System.Web.HttpApplication.IExecutionStep.Execute()
    +92
       System.Web.HttpApplication.ExecuteStep(IExecutionStep step, Boolean& completedSynchronously) +64
    Might be a bug? Any help would be much appreciated!

    Kind regards,

    Jac Gubbels
  2. Yasen
    Yasen avatar
    121 posts
    Registered:
    18 May 2013
    07 Mar 2008
    Link to this post
    Hi Zumrut CIM,

    You are right that changing the default culture is not recommended after you have already created pages and content. The error you get is the expected behavior when you change the defaultCulture property.

    Fortunately, there is a hack you could use in order to perform this shift. You can find the needed information in the attached KB article.

    I hope this information is helpful, if you have any questions, remarks or suggestions, please share them.

    Best wishes,
    Yasen
    the Telerik team

    Instantly find answers to your questions at the new Telerik Support Center
2 posts, 0 answered