It works as expect" /> It works as expect" /> It works as expect"/>

Sitecore multilingual site, default to non-english language even when English version exists

1.4k views Asked by At

I am working on a sitecore 7.1 site which in Web.config is set to a Swedish language.

<site name="SiteName" language="sv-SE" ... />

It works as expected if I go to a page which only has a Swedish version, but if an English and Swedish version of an Item exists, it prefers the English version. How can I change it so it prefers the Swedish version by default even if an English version exists.

I've read John West's post on how Sitecore language can be set here and of the five ways he mentions language can be set, I think the following 2 may be y pertinent to me, but I'm not sure:

  1. Language cookie associated with context site: in my request, I see there is a cookie se#lang=sv-SE. First is this the site context language cookie? If yes, then language is getting set elsewhere down the pipeline.
  2. The default language associated with the context logical site. I'm not sure how to get at this.
2

There are 2 answers

0
BraveNewMath On BEST ANSWER

I think this is more of a feature than a bug. I narrowed down the causes on my end and it appears to be caused by the following.

  1. My browser sends a request header that it expects english content.
  2. if a version of the content exists in the requested language, sitecore prioritizes english, per the user's preferred language, even if the site is configured to default to a different language.
3
Jay S On

The site language setting should be enough, but just in case, there are some other settings you could check:

  1. ClientLanguage: By default, this is set to 'en'.
  2. DefaultLanguage: By default, this is set to 'en'.

The ClientLanguage should not be used for users visiting your site. From my understanding, that is used for the editing interfaces.

Also, according to my decompiler, the Sitecore 7.2 pipelines should only use the DefaultLanguage if the site language cannot be found.

I did notice that a user's cookie for language is read before it will default to the site language. Are you sure you have a fresh session when you are visiting the page with two languages and the user's default session language has not already been set?

Otherwise, as mentioned in one of the comments, do you have a fallback module installed that may have their own configurations?