Wrong language warning

Created: 24 Apr 2015, last update: 24 Jun 2017

Sitecore content editor wrong language warning

Sitecore is easy extendable with custom features to make it easier for the CMS users. One of them is the Content Editor Warning.

On multilingual and multi site Sitecore environments and also on sites with another language than Default "en". There are typical users with rights on more than one language.

If you have more than 1 language in Sitecore than sometimes you must switch language. A common mistake is create or edit content items in the wrong language.
Recommendation: Give users only rights on the language they need.

Beside this you can also use a Wrong Language Content Editor Warning. See Marketplace

How do you know what language / languages a item must have?. You can check if your item is below a node define in the site definitions and from there found the default language. But that does not work if you have multilingual trees, you can expand the site definition with a custom attribute to define the alternative languages.

A Content Editor Warning is a Pipeline Processor in getContentEditorWarnings pipeline.

A content editor warning consists of a title, text, and a option list. The option list may contain links to switch the language. We do this with the item: load (see also http://www.sitecore.net/nl-be/learn/blogs/technical-blogs/john-west-sitecore-blog/posts/2011/08/load-or-reload-an-item-in-the-sitecore-aspnet-cms.aspx)

Each site in Sitecore has an optional default language. Defined in the config <Sites> <site> node. For example: <site name = "website" language = "en-US" ..... />

On Multilingual site's you can create a custom attribute altLanguage. It is possible to set more than one alternative language  '|' separator, in the same way as for the host. <site name = "website" language = "en-US" altLanguage = "fr-BE|en" ..... />

We want this wrong language warning processor as first in the getContentEditorWarnings pipeline to ensure that other processors such as the "The current item does not have a version in Language X" this one not ignore because the IsExclusive flag. The ItemNotFound  is in the default web.config the first processor in the Content Editor Warning pipeline so patch before this one.

See the Source Code of the Sitecore Wrong Language Editor Warning on GitHub


The missing version warning the red dot in the left content tree is not aware of what version are needed and warn on all languages, in this case it is correct, and complements the Content Editor Warning.