Language Fallback on Display Name

In Sitecore 8.1 we finally got language fallback built into the core product. This gives us the option to specify, per field, if we want to inherit a field value from another language when the field itself is null.

I guess we all have some sort of love and hate relation to the built in Display Name field of Sitecore. It solves a lot of potential issues, but it causes tons of other problems as well. With language fallback, there is another one. If you enable language fallback on the Display Name item, nothing happens. This is because the default LanguageFallbackFieldValuesProvider ignores all standard fields. Well, all fields starting with a double underscore to be exact.

So in order to have language fallback on Display Name or any other standard field (though the need for it on other fields are probably very rare), we’ll have to replace the default implementation, with an overridden version where the bool IsValidForFallback(Field field) method doesn’t return false just because its internal name is "__Display Name".

If you need details on how to replace the default implementation, look at my post about editor friendly language fallback.

6 thoughts on “Language Fallback on Display Name

  1. Hi Mikael,
    I’m trying achieve the same thing, but then with the fields of the Help section. Unfortunatly i’m unable to get it to work. I also tried the solution with replacing the default implementation (deleting the __ fieldname check), but it does not work.
    Did you validate the solution by overridding the default version?
    greetings, Sander

    • Are you using fallback for the help sections internally in the CMS? If so, you’ll need to enable language fallback for the “shell” website.

      • I did enable language fallback for the “shell” website via a patch file.

        We have a multi language site (>20) and currently create versions of the “__Standard Values” of the templates for all the cultures. The large number of language versions and items makes deployments slow.

        When i create a page in a language (“en”) which is equal to the language defined on the “__Standard Values” of the template, i see the help text i set for the fields in the contenteditor displayed.

        But when i choose another language for creating the page, i don’t see the help text. I expected that Field Fallback on the Help fields would work. I did bypass the “__” check, but still it doesn’t work.

        I think i want “Field fallback on the (Help) Template Fields of a __Standard Values for a template”.

        I find that the situation is not very consequent as the Displayname of the fields does come from the “en” version, even without having Fallback set-up.

        • Hmm, interesting… I don’t have a Sitecore instance at hand right now, but let me check this on one of my instances with a similar setup.

  2. I realize this is an old post, but since i came here its probably still relevant. I came up with a solution to this, so i thought i wanted to share.

    To enable display name for language fallback in 8.2, i changed the method “ShouldStandardFieldBeSkipped” in the LanguageFallbackFieldValuesProvider to this:

    public override bool ShouldStandardFieldBeSkipped(Field field)
    if (field.Name.StartsWith(“__”))
    if (field.ID == FieldIDs.FinalLayoutField) return false;
    if (field.ID == FieldIDs.DisplayName) return false;
    return true;
    return false;

    The last step is to enable language fallback on the field item itself in Sitecore, on this path (/sitecore/templates/System/Templates/Sections/Appearance/Appearance/__Display name), check the field called “Enable field level fallback”.

    Now language fallback on display names should work properly.

    • Good point! The virtual ShouldStandardFieldBeSkipped method was added in 8.2, and that makes the code a lot simpler.

Comments are closed.