Enable and set up language fallback
In a multilanguage solution, you can use the language fallback functionality to display content in a different language if the content does not exist in the current language. This involves doing the following:
-
Defining the language fallback rules.
-
Enabling language fallback, either on individual sites or on all sites within the environment.
-
As required, enabling language fallback on items, item templates, or fields.
Do 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.
Define the language fallback rules
For each language in your environment that you want to use for language fallback, you need to 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.
You can set up a chain of language fallback. For example, as illustrated in the picture, Korean falls back to Mexican, and Mexican falls back to English. Suppose there is no Korean nor Mexican version, then the English version of the item or field is shown.
To define the language fallback rules:
-
In the Content Editor, in the content tree, navigate to sitecore/System/Languages and click the language item that you want to specify the fallback language for.
NoteIf any languages are missing, you can add more languages to your environment.
-
In the Data section, in the Fallback Language field, select the relevant language.
-
Save your changes.
Enable language fallback for the entire environment
If not already enabled, you can enable language fallback for all the sites in your environment by changing the settings in the \App_Config\Sitecore\Services.GraphQL\Sitecore.Services.GraphQL.EdgeContent.config
file. Changing the configuration file also affects existing sites.
You can enable language fallback for items or fields, or both.
If you want the language fallback functionality to be enabled only for a subset of your sites, leave the configuration file unchanged and enable language fallback manually for each relevant site.
To enable language fallback for an environment:
-
Set either (or both) of the following configuration settings to
true
:
<setting name="ExperienceEdge.EnableItemLanguageFallback" value="false"/>
<setting name="ExperienceEdge.EnableFieldLanguageFallback" value="false"/>
Enable language fallback for a site
Unless language fallback has been enabled for the entire environment, you need to enable it for each relevant site. This includes configuring language fallback for items or fields, or both.
On the shell sites, language fallback is enabled by default.
To enable language fallback for a site:
-
In the Content Editor, in the content tree, click sitecore/Content/<site collection>/<site>/Settings/Site Grouping, and then click the site item.
-
In the Language section, select one or both of the following check boxes:
-
Enable item language fallback .
-
Enable field language fallback.
-
Enable language fallback on an item or item template
On all the individual items or item templates where you want to use language fallback, you need to enable item-level fallback. Enabling language fallback on an item template affects all items that are based on the template.
Check that, in XM Cloud Content Editor, on the View tab, the Standard fields check box is selected.
To enable item-level fallback:
-
In the Content Editor, in the content tree, navigate to the relevant item.
-
To enable language fallback on individual items, in the Advanced section, select the Enable Item Fallback check box.
-
To enable language fallback on an item template:
-
In the Quick Info section, click the link in the Template field.
-
In the Template Manager dialog, expand the template item and, in the Advanced section, click the __Standard Values item.
-
-
Select the Enable Item Fallback check box.
-
Save your changes.
Enable language fallback on the field definition item of an item template
If you want to use field-level language fallback, you need to enable field-level language fallback on every relevant field definition of an item template. You can do this for a specific language version of a field, or for all language versions of the field.
Enabling 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.
Check that, in the Content Editor, on the View tab, the Standard fields check box is selected.
To enable language fallback on a field definition item:
-
In the Content Editor, in the content tree, navigate to the relevant item template and, in the Advanced section, make sure that the Enable item fallback check box is cleared.
-
Click the field definition item that you want to enable field-level fallback for.
-
In the Data section of the item, select one or both of the following:
-
Enable field level fallback – select 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 – select to enable language fallback for only the currently selected language version of the field.
By default, this setting is deactivated. To activate it, in the
Sitecore.LanguageFallback.config
file, set the configuration settingLanguageFieldFallback.AllowVaryFallbackSettingsPerLanguage
to true. However, this reduces performance considerably.
NoteSome field values might be inherited from another template, in which case you must enable them on the individual templates as well.
-
-
Save your changes. If you select an item that has the field you selected in step 2 and then select a language configured to fallback to, for example, English, you'll see that the field value falls back to English.