Fine-tune your language fallback configuration
Depending on your Sitecore solution, you can make a few adjustments to your language fallback configuration, including to the search index and to the settings in the Sitecore.LanguageFallback.config file.
Set up a search index to handle language fallback
If your solution relies on Sitecore’s content search (item buckets) and you want to use language fallback, you must set up the particular search index to handle item- or field-level fallback.
To set up a search index to handle language fallback:
-
Enable the relevant fallback modes by setting the inner value of the corresponding XML child element for the relevant search index to true.
RequestResponse<index id="sitecore_master_index" …> … <enableItemLanguageFallback>true</enableItemLanguageFallback> <enableFieldLanguageFallback>true</enableFieldLanguageFallback> … </index>
-
Perform a full rebuild of the affected indexes.
If your configuration file does not contain these elements, use the Sitecore.ContentSearch.Solr.Index.Master.config
file as an example of how to apply them.
No data is added to the index if there is no version of the field in the fallback language. However, in this case, the Sitecore data API returns items with fallback field values, and therefore we recommend that you enforce version presence on these items.
Configure the Sitecore.LanguageFallback.config file
In the the Sitecore.LanguageFallback.config
file, you can make changes to the following settings:
-
DefaultCacheSize
- determines the default cache size that stores the language fallback field values. The default value is 20MB.RequestResponse<!-- CACHING - LANGUAGE FALLBACK FIELD VALUES - DEFAULT CACHE SIZE Determines the default size of the cache that stores the language fallback field values. Specify the value in bytes or append the value with KB, MB or GB. Default value: 20MB. --> <setting name="Caching.LanguageFallbackFieldValues.DefaultCacheSize" value="20MB" />
If you want different cache sizes on a specific database, use the following code sample. The sample is available in the configuration file.
RequestResponse<!-- EXAMPLE: Override the size of languageFallbackFieldValues cache per database --> <!-- <databases> <database id="master"> <cacheSizes hint="setting"> <languageFallbackFieldValues>20MB</languageFallbackFieldValues> </cacheSizes> </database> </databases> -->
-
AllowVaryFallbackSettingsPerLanguage
- enables you to have different fallback settings for the same field in different languages. The default value is false.ImportantIf you enable this feature, performance is considerably degraded.
RequestResponse<!-- LANGUAGE FIELD FALLBACK - ALLOW VARY FALLBACK SETTINGS PER LANGUAGE If set to 'true', then values from both versioned 'Enable Language Fallback' and shared 'Enable Shared Language Fallback' checkbox fields on the field definition item are used to determine whether language fallback functionality should be enabled for the corresponding field. It allows you to have different fallback settings for the same field in different content languages. Example: when 'en-CA' tries to fallback to 'en', the checkbox field will be retrieved from the field definition item in 'en-CA', thus such version should exist. If retrieved value is 'false', then the 'Enable Shared Language Fallback' checkbox field is used. Note: enabling this feature has negative impact on performance. If set to 'false', only the shared 'Enable Shared Language Fallback' checkbox field on the field definition item is used to determine whether language fallback functionality should be enabled for the corresponding field. Default value: false. --> <setting name="LanguageFieldFallback.AllowVaryFallbackSettingsPerLanguage" value="false" />