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

Forums / Bugs & Issues / Localization links cause the set language to fail

Localization links cause the set language to fail

12 posts, 0 answered
  1. Dave Hey
    Dave Hey avatar
    8 posts
    Registered:
    21 Apr 2010
    21 Apr 2010
    Link to this post
    I've setup localization with the following web.config setting:

    <localization defaultProvider="Sitefinity" persistenceMode="PathPrefix" defaultCulture="en" cultures="en, zh-CHS">

    Everything appears to work. I can create a Chinese version of a page, template, etc. Whenever I set the language to Chinese through the Sitefinity language selector, and then I click off to a new part of the site it changes back to English.

    I've tried using querystring as well for the persistence mode and that doesn't change anything.

    How can I make sure the language is persistent across the site when the user moves around?

    Thanks!

  2. Dave Hey
    Dave Hey avatar
    8 posts
    Registered:
    21 Apr 2010
    21 Apr 2010
    Link to this post
    Update:

    I've found if I set the web.config to the following:

    <localization defaultProvider="Sitefinity" persistenceMode="QueryString" defaultCulture="en" cultures="en, zh-CN, zh-CHS">

    Everything works, if and only if I also set zh-CN as the default language for the web browser (both IE and FireFox). Even worse than that if I remove either zh-CN or zh-CHS it breaks. I have to have BOTH for it to work, and user overrides still fail.

    So I'm still far from a real solution. Please any insight would be helpful.

    Thanks.
  3. Radoslav Georgiev
    Radoslav Georgiev avatar
    3370 posts
    Registered:
    01 Feb 2016
    22 Apr 2010
    Link to this post
    Hi Dave Hey,

    Thank you for contacting Telerik Support.

    Please try setting localization like this:
    <localization defaultProvider="Sitefinity" persistenceMode="PathPrefix" defaultCulture="en" allowSpecificCultures="true" autoSetClientLanguage="false" cultures="en, zh-CN, zh-CH">

    AutoSetClientLanguage will prevent the browser automatically setting the default culture.

    Regards,
    Radoslav Georgiev
    the Telerik team

    Do you want to have your say when we set our development plans? Do you want to know when a feature you care about is added or when a bug fixed? Explore the Telerik Public Issue Tracking system and vote to affect the priority of the items.
  4. Dave Hey
    Dave Hey avatar
    8 posts
    Registered:
    21 Apr 2010
    22 Apr 2010
    Link to this post
    Wow I really thought that would fix the problem, but it didn't. I tried both of the following in the web.config:

    <localization defaultProvider="Sitefinity" persistenceMode="QueryString" defaultCulture="en" cultures="en, zh-CHS" autoSetClientLanguage="False" >

    <localization defaultProvider="Sitefinity" persistenceMode="PathPrefix"  defaultCulture="en"  allowSpecificCultures="true" autoSetClientLanguage="false"  cultures="en, zh-CN, zh-CHS">

    I point out both of them because in your example you had zh-CH as a culture and Sitefinity doesn't recognize it.

    Also because I prefer to use querystring if possible, but at this point I'll take either.

    Some back story might be helpful for you in helping me figure this out. I had turned on localization on this server at one point, but I noticed some of the templates had absolute paths, so I turned localization off. Before I turned it off everything worked correctly. It was only after I turned localization back on a second time did I notice this problem pop up. Does Sitefinity keep localization settings in a config table somewhere that I can flush? I've tried browsing in private mode, to clear the browser cache, and I've done iisresets after I change the web.config as well to help give it as clean of a setup as possible.

    Two things I've seen happen that lead me to believe that Sitefinity might be caching stuff it shouldn't:

    At one point yesteday when I switched from QueryString to PathPrefix (or vice versa I don't recall.) I got a url that looked like the following when I selected Chinese from the language selector:

    http://mysite/en/index.aspx?sflang=zh-CHS

    Mind you that was after selecting Chinese.

    This morning after making your suggested change I got:

    http://mysite/index.aspx?sflang=en&sflang=zh-CHS&sfopl=true&sflang=zh-CHS&sflang=zh-CHS

    Each time I select Chinese it appends a new sflang, but it always stays English.

    With some work I can get it to stop doing that stuff, but it still goes back to the initial problem of not remembering the language I select from the dropdown after clicking a link.

    Thanks!
  5. Radoslav Georgiev
    Radoslav Georgiev avatar
    3370 posts
    Registered:
    01 Feb 2016
    22 Apr 2010
    Link to this post
    Hi Dave Hey,

    This should work. I saw that you were using zh-CH in your web.config which is a specific culture, this why I posted the allowSpecificCultures="true". You did not have to copy my config lines word for word. You only had to copy the higlighted parts.

    Greetings,
    Radoslav Georgiev
    the Telerik team

    Do you want to have your say when we set our development plans? Do you want to know when a feature you care about is added or when a bug fixed? Explore the Telerik Public Issue Tracking system and vote to affect the priority of the items.
  6. Dave Hey
    Dave Hey avatar
    8 posts
    Registered:
    21 Apr 2010
    22 Apr 2010
    Link to this post
    OK, yeah no problem. I tried with and without specific cultures. I am not worried about that.

    Can you explain any of the strange behavior I mentioned in the previous post?

    Specifically I'm dead in the water and localization isn't working. What's worse is it use to work before I turned it off and on again.

    Does Sitefinity cache its localization or localization related settings anywhere and can I flush that cache somehow?

    Please help.
  7. Dave Hey
    Dave Hey avatar
    8 posts
    Registered:
    21 Apr 2010
    22 Apr 2010
    Link to this post
    I hope you guys are still working on this one. I have done some more experimenting, and I've found some more strange stuff:

    If I have it set to English all of the links, except for one, look like this when I hover over them:

    http://mysite/<page>.aspx

    One, and only one, link looks like this when I hover over it:

    http://mysite/en/about/EnterpriseForum.aspx

    Now when I switch the site to Chinese all of the links, except for the exception in the last example, look like this when I hover over them:

    http://mysite/<page>.aspx

    Note: It's the exact same as the English version of the link.

    Now the same exception link in the first example looks like this when I hover over it, while the language is set to Chinese:

    http://mysite/zh-CHS/Item%20not%20found:%20%5BSitefinity%5Df39eefae-8882-4fba-bbf5-21a3e906f2ee

    Wow that's a bit crazy.

    Hopefully this can help you track down why localization stopped working for me. Please let me know if you're working on this still.

    Thanks.
  8. Dave Hey
    Dave Hey avatar
    8 posts
    Registered:
    21 Apr 2010
    22 Apr 2010
    Link to this post
    Lots of more useful information for you.

    I did a restore of the database from a time before localization was first installed. I then added localization. Didn't fix the problem.

    I also got desperate and removed the language selector bar and then re-added it. Didn't fix the problem.

    I tried this in the web.config:

    <localization defaultProvider="Sitefinity" persistenceMode="QueryString"  defaultCulture="en" autoSetClientLanguage="true"  cultures="en, zh-CN">

    and I get the following error in FireFox:

    Redirect Loop

    Firefox has detected that the server is redirecting the request for this address in a way that will never complete.

    The browser has stopped trying to retrieve the requested item. The site is redirecting the request in a way that will never complete.

        * Have you disabled or blocked cookies required by this site?
        * NOTE: If accepting the site's cookies does not resolve the problem, it is likely a server configuration issue and not your computer.

    ----

    Additionally the URL that appears in the browser when that happens is:

    http://70.46.226.132/index.aspx?sflang=zh-CHS
  9. Dave Hey
    Dave Hey avatar
    8 posts
    Registered:
    21 Apr 2010
    23 Apr 2010
    Link to this post
    As an experiment I created a new Sitefinity site from scratch. I then added localization. After that I added Chinese version of the main page. I checked the links and they behaved in the way that they should. That is to say they included the en or the zh-CHS as you would expect them to, and the language information did not get lost.
  10. Radoslav Georgiev
    Radoslav Georgiev avatar
    3370 posts
    Registered:
    01 Feb 2016
    23 Apr 2010
    Link to this post
    Hello Dave Hey,

    Thank you for getting back to me.

    On the first project, before you turned localization off and then back on, is it possible that you had another language set as your default one?

    Regards,
    Radoslav Georgiev
    the Telerik team

    Do you want to have your say when we set our development plans? Do you want to know when a feature you care about is added or when a bug fixed? Explore the Telerik Public Issue Tracking system and vote to affect the priority of the items.
  11. Dave Hey
    Dave Hey avatar
    8 posts
    Registered:
    21 Apr 2010
    23 Apr 2010
    Link to this post
    Nope, and a look at the backup file confirms it.

    Additionally creating a new site from scratch and getting the desired results without issue tells me something behind the scenes is messed up. I believe I require deeper support. Please Advise.
  12. Radoslav Georgiev
    Radoslav Georgiev avatar
    3370 posts
    Registered:
    01 Feb 2016
    23 Apr 2010
    Link to this post
    Hi Dave Hey,

    Thank you for getting back to me.

    Could you please open a support ticket and send us over the project and a back up of the database. I am afraid that without looking at the project we will not be able to tell what is wrong. I have tried to reproduce the issue locally, however to no avail. Also please mention in the ticket what are your locale settings and to what culture is the browser set.

    Thank you very much for your cooperation in advance.

    Kind regards,
    Radoslav Georgiev
    the Telerik team

    Do you want to have your say when we set our development plans? Do you want to know when a feature you care about is added or when a bug fixed? Explore the Telerik Public Issue Tracking system and vote to affect the priority of the items.
Register for webinar
12 posts, 0 answered