Sitecore allows a fallback version to be specified for another language that doesn’t exist as a language version.
For example: When you try to access/browse an item for the French language, https://[hostname]/home/item?sc_lang=fr-FR if that item doesn’t have a French version, then a “layout not found” error page will be shown.
We can avoid the above issue by configuring Sitecore to handle the scenario as follows: “Every time a request is made for the French version, then show its English version as its fallback version”.
There are two types of fallbacks in Sitecore:
Follow this blog to know the steps required to configure Item level fallback in your Sitecore.
Item-level fallback is a must if your site is multilingual. Sitecore doesn’t support language fallback by default.
Follow the following steps to enable item-level fallback and set it to the English language:
Step-1: Open your Sitecore -> Control Panel -> Localization -> Add a new language:
Step-2: Select the desired language:
Step-3: Press next to continue the installation.
Step-4: To enable language fallback go to the C:\inetpub\wwwroot\sc102sc.dev.local\App_Config\Include\Project\\SiteDefinition.config file:
And add two values, fallback language as en (English) and enable ItemLanguageFallback as true
Step-5: Go to C:\inetpub\wwwroot\sc102sc.dev.local\App_Config\Sitecore\CMS.Core\Sitecore.LanguageFallback.config:
And verify that the above-highlighted value is set to true.
Step-6: Now language fallback is enabled and set to English.
Step-7: Now select a fallback language in System\Language:
We have now changed the fallback language from French to English, Sitecore can handle fallback now.
Step-8: Create a template with Standard values and enable Item Level Fallback:
Step-9: Any item created from this template will have language fallback enabled from French to English. Create an item from the new template created.
Here, an item has been created with 2 versions one for each language available. When we will browse these items, we will see different outputs for each language version as shown below:
It’ll work for different language versions as both items are available. Now create an item with the same template for the English version only.
Now try to browse this item in the French language. It’ll show that the French version is the fallback version, and all values are populated in English. Although it looks like we have created a version of the French language, we haven’t. The values are coming due to the configuration settings we made. Since we used our fallback language as English for the French version, we’ll be getting the default values in English.
Now, every time we’ll try to access the French version of an item, even if that item doesn’t exist, we’ll be getting the English version of it.
That is the main benefit of enabling language fallback.
Follow the above given steps in this blog and you can successfully configure item level language fallback in Sitecore.