skip to Main Content

I’m currently working on rolling out a Korean version of a site in Kentico 8.2 and working with local and dev versions of the site.

I can get a page to load in Korean and even some subsequent pages to load in Korean while navigating. Usually the third or fourth page I navigate to will revert back to English. I can re-add the query string ?lang=ko-kr or add /ko-kr/ to the URL (depending on what setting I’m trying at the time) to get that page to load in Korean (verifying it exists). It doesn’t seem to matter what page I start on or what page(s) I navigate to.

I’ve tried a combination of the below settings:

  • Forcing Domain Culture (only) in Settings/URLs and SEO
  • Use Language prefix for URLs (with and without Allow URLs without
    language prefixes) in Settings/URLs and SEO
  • Changing visitor culture to Automatic (Sites/General)

With these variety of settings, I’ve tried appending ?lang=ko-kr or used domain/ko-kr/rest-of-url to get a page to load in Korean (matching the appropriate setting).

I’ve tried other things to see if they’re interfering, such as:

  • Language setting in my browser changed to Korean to see if this was overriding anything.
  • Run in incognito mode and cleared cache/cookies to see if these were possible issues.
  • Restarting the server after changing settings.
  • Verifying custom URLs aren’t interfering (not set)

I’ve been searching through Kentico Forums, here on SO, and Googling a variety of search terms with no luck. According to what I’ve found, these few settings are all that is needed. There’s not much addressing these issues, as most results return the normal documentation on how to implement multiple languages on the site.

I’ve been stuck on this for a few days and feel like I’m missing something quite obvious… it shouldn’t be this difficult, should it?

3

Answers


  1. Chosen as BEST ANSWER

    I was able to resolve this issue by setting (Settings > URLs and SEO under heading SEO - Cultures):

    Forcing Domain Culture (unchecked) Use Language prefix for URLs (checked) Allow URLs without language prefixes (unchecked)

    Whenever we were retrieving NodeAliasPath the URL did not include the culture code. It would retain the current language for a few page loads but would eventually revert to the default language (English). Adding the below function around uses of NodeAliasPath fixed the issue.

    public static string GetCultureURL(string url)
    {
      url = url.TrimStart('~');
    
      string output = url;
    
      if (CMS.Localization.LocalizationContext.CurrentCulture.CultureCode.ToLower() != "en-us")
        output = "/" + CMS.Localization.LocalizationContext.CurrentCulture.CultureCode + url;
    
      return output.ToLower();
    }
    

    The CMS likes to insert a tilde (~) for links selected with the link selector so I had to trim it from URLs. Because English is the default language (and it was requested to have English URLs plain), I had an if statement skip the addition of /en-us to the front of URLs.

    It's also not necessary to lowercase the URL, so the function could be reduced to even further.


  2. We have recently come across an issue with one of our sites, and it may or may not be related to your issue, but might be worth a check.

    If your default culture document has a custom path defined that is the same as the default node alias path, urls for other cultures wont work as expected if you’re using only the nodealiaspath urls in your front end.

    To work with multilang urls properly use this method:

    You have /page, on the english version (default culture) the use custom path must be checked but the path texbox should be empty, or have something diferent than /page.

    On the Portuguese version (my example), the use custom path is also checked but the path textbox has the translated version /pagina (you can check/uncheck the use custom path checkbox and it will generate the translated path for you).

    This way if you navigate the url /page for the first time it should go to /en/page

    However if you already have a cookie for Portuguese version if you go to /page it will redirect to /pt/pagina.

    You should also be able to navigato to /pagina and it will redirect /pt/pagina

    This is the best way we found to use and explain to clients how to do and work with multilang urls.

    Login or Signup to reply.
  3. In my case I was able to resolve the issue by going to the URLs tab of the page in question and unchecking the Use custom URL path checkbox.

    And also deleting all Page aliases from both culture versions.

    Login or Signup to reply.
Please signup or login to give your own answer.
Back To Top
Search