To use the language fallback functionality, you enable either item-level or field-level fallback on the relevant sites and on the relevant items, fields, or templates. In addition, on the relevant language definition items you specify the fallback language that determines which language version of an item or field that you want displayed when there is no version available in the current language.
You should not use both item- and field-level fallback on the same item because it makes it difficult to maintain an overview of the versions that different items and fields fall back to.
This topic outlines how to:
- Enable site-level language fallback
- Specify the language fallback rules
- Enable item level fallback
- Enable field level fallback
Enable site-level language fallback
To be able to use language fallback in your Sitecore solution, you have to enable it for each relevant site.
To enable site-level language fallback:
\Sitecore.LanguageFallback.configand set the following attributes to true:
You must enable the attributes on the shell and on each of the relevant websites.
Note Do not make changes directly to the configuration files. Instead, you must create a patch file that performs the required changes during run time.
Do not make changes directly to the configuration files. Instead, you must create a patch file that performs the required changes during run time.
In multisite environments where you only want to enable language fallback on a subset of the websites, you need to create a specific shell site for each website where you want the language fallback feature enabled.
Specify the fallback language rules
For each language in your Sitecore solution that you want to use for language fallback, you must specify the language that you want it to fall back to. The fallback language specified on a language definition item applies to all the fields and items that have language fallback enabled.
To specify the fallback language for a language definition item:
- In the Content Editor, in the content tree, navigate to and click the language definition item that you want to specify the fallback language for. The language definition items are located in sitecore/system/Languages.
- In the Data section, in the Fallback Language field, enter the name of the relevant language, for example, en-AU.
- Save your changes.
You can also set up a chain of language fallback. For example, you can specify the language en-NZ to fall back to en-AU and en-AU to fall back to en. If the version in en-AU does not exist for a particular item, then the version in en-NZ falls back to the version in en.
Enable item-level fallback
On all the individual items or item templates where you want to use language fallback, you must enable item-level fallback.
To enable item-level fallback:
- In the content tree, navigate to the relevant item.
- To enable language fallback on a template, navigate to the relevant template and click the _Standard Values item.
- On the Content tab, in the Advanced section, select Enable Item Fallback.
- Save your changes.
Enable field-level fallback
You can enable field-level fallback on a field template on every relevant field definition item.
To enable field-level fallback can be a very tedious task, so to automate this process and perform a batch update of the field-level fallback settings, you can use the Sitecore Powershell Extensions module that is available on Sitecore Marketplace.
To enable field-level fallback:
- In the content tree, navigate to the relevant template and click the field definition item that you want to enable field-level fallback for.
- In the Data section of the item, select:
- Enable field level fallback – to enable language fallback for all the language versions of the current field. This applies to all the currently available language versions of the field and any new language versions that you create.
- Enable versioned field level fallback – to enable language fallback for only the current language version of the field.
To allow different fallback settings for the same field in different languages (versioned fallback), in the
Sitecore.LanguageFallback.configfile, you must set the configuration setting
LanguageFieldFallback.AllowVaryFallbackSettingsPerLanguageto true. However, this degrades performance considerably.
- Save your changes.