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

Forums / Developing with Sitefinity / 3.2 multilingual - keeps redirecting to czech version

3.2 multilingual - keeps redirecting to czech version

10 posts, 0 answered
  1. Meister
    Meister avatar
    262 posts
    Registered:
    09 Nov 2007
    01 Dec 2009
    Link to this post
    Hi

    I have a user based in czech, and everytime then load the site, its redirects to the czech version which i guess is fine, except when they select the english language version from the drop down, it loads the english version of the site, but as soon as they navigate using the menu it redirects to the czech version of the site again

    is this correct functionality?
    how can the user select a the english language and continue using the site in english

    thanks
  2. Ivan Dimitrov
    Ivan Dimitrov avatar
    16072 posts
    Registered:
    12 Sep 2017
    02 Dec 2009
    Link to this post
    Hi Quade,

    As far as I remember there was similar bug, it was mainly related to the specific cultures. The problem is fixed in Sitefinity 3.7. Possible options

    1. Upgrade your project to the last official release.
    2. Subscribe for ItemDataBound event of RadMenu and check the current culture. Then change the NavigateUrl propery.

    sample code:

    CultureInfo currentCulture = CultureInfo.CurrentUICulture;
    CmsSiteMapNode menuNode= e.Item.DataItem as CmsSiteMapNode;
     
              if (LocalizationManager.DefaultCulture.Equals(currentCulture) && menuNode.PageType != CmsPageType.External)
              {
                        e.Item.NavigateUrl = "~/" + currentCulture + e.Item.NavigateUrl.Substring(1);
      
              }


    All the best,
    Ivan Dimitrov
    the Telerik team

    Instantly find answers to your questions on the new Telerik Support Portal.
    Watch a video on how to optimize your support resource searches and check out more tips on the blogs.
  3. Meister
    Meister avatar
    262 posts
    Registered:
    09 Nov 2007
    03 Dec 2009
    Link to this post
    Thanks
    Upgrading isn't an option unfortunatley

    however, i've tried inserting the code but getting the following error, (i've tried adding using Telerik.Localization; but no joy)

    SiteMenu.ascx.cs(497): error CS0246: The type or namespace name 'CultureInfo' could not be found (are you missing a using directive or an assembly reference?)
  4. Radoslav Georgiev
    Radoslav Georgiev avatar
    3370 posts
    Registered:
    01 Feb 2016
    03 Dec 2009
    Link to this post
    Hi Quade,

    The CultureInfo class belongs to System.Globalization assembly. Please check if it is referenced in your project and then add the using to the code file.

    All the best,
    Radoslav Georgiev
    the Telerik team

    Instantly find answers to your questions on the new Telerik Support Portal.
    Watch a video on how to optimize your support resource searches and check out more tips on the blogs.
  5. Meister
    Meister avatar
    262 posts
    Registered:
    09 Nov 2007
    03 Dec 2009
    Link to this post
    thanks

    almost there
    i'm now getting the following error

    Error 103 'Telerik.Cms.Web.CmsSiteMapNode' does not contain a definition for 'PageType' ......\UserControls\Navigation\SiteMenu.ascx.cs 504 83 


    its this line its erroring on:

    if

     

    (LocalizationManager.DefaultCulture.Equals(currentCulture) && menuNode.PageType != CmsPageType.External)

    any ideas

     

     

     

     

     

  6. Ivan Dimitrov
    Ivan Dimitrov avatar
    16072 posts
    Registered:
    12 Sep 2017
    03 Dec 2009
    Link to this post
    Hello Quade,

    Try using the following namespace Telerik.Cms.CmsPageType.

    Kind regards,
    Ivan Dimitrov
    the Telerik team

    Instantly find answers to your questions on the new Telerik Support Portal.
    Watch a video on how to optimize your support resource searches and check out more tips on the blogs.
  7. Meister
    Meister avatar
    262 posts
    Registered:
    09 Nov 2007
    03 Dec 2009
    Link to this post
    Thanks Ivan, but that doesnt work


    EDIT:

    menuNode.CmsPage.PageType


    seems to not error, i'll test that
  8. Meister
    Meister avatar
    262 posts
    Registered:
    09 Nov 2007
    03 Dec 2009
    Link to this post
    scratch that

    it now adds an extra /en/ in the url
    for example

    www.mysite.com/en/en/index.aspx

    any ideas?
  9. Ivan Dimitrov
    Ivan Dimitrov avatar
    16072 posts
    Registered:
    12 Sep 2017
    03 Dec 2009
    Link to this post
    Hello Quade,

    You can substring one of the "en" prefixed. You can attache the code to debugger and see from where the additional prefix comes.

    All the best,
    Ivan Dimitrov
    the Telerik team

    Instantly find answers to your questions on the new Telerik Support Portal.
    Watch a video on how to optimize your support resource searches and check out more tips on the blogs.
  10. Meister
    Meister avatar
    262 posts
    Registered:
    09 Nov 2007
    07 Dec 2009
    Link to this post
    Thanks Ivan

    Replacing one of your lines with

    e.Item.NavigateUrl =

    "~/" + currentCulture + e.Item.NavigateUrl.Substring(4);

     



    seems to do the trick, i'll test that now
Register for webinar
10 posts, 0 answered