Santa

Let’s Talk

We would love to hear from you. Want to know more about
our services or have any questions? Say Hi!

How to Configure Language Fallback in Sitecore?

July 17, 2023
How to Configure Language Fallback in Sitecore?
Mitesh Patel
Mitesh Patel
Technical Head
how-to-configure-language-fallback-in-sitecore

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:

  • Item Level Fallback
  • Field Level Fallback

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:

how-to-configure-language-fallback-in-sitecore-1

Step-2: Select the desired language:

how-to-configure-language-fallback-in-sitecore-2

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:

how-to-configure-language-fallback-in-sitecore-3

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:

how-to-configure-language-fallback-in-sitecore-4

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:

how-to-configure-language-fallback-in-sitecore-5

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:

how-to-configure-language-fallback-in-sitecore-6

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.

how-to-configure-language-fallback-in-sitecore-7 how-to-configure-language-fallback-in-sitecore-8

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:

https:// [Hostname]/?sc_mode=edit&sc_itemid={Item-Id}&sc_version=1&sc_lang=en&sc_site=sitecore_demo

how-to-configure-language-fallback-in-sitecore-9

https:// [Hostname]/?sc_mode=edit&sc_itemid={Item-Id}&sc_version=1&sc_lang=fr-FR&sc_site=sitecore_demo

how-to-configure-language-fallback-in-sitecore-10

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.

how-to-configure-language-fallback-in-sitecore-11

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.

how-to-configure-language-fallback-in-sitecore-12 how-to-configure-language-fallback-in-sitecore-13

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.


YOU MAY ALSO LIKE