4

I'm working on setting up multilingual support for our 8.1u3 installation, and I'm running into some weird behavior with the language fallback. It works for the most part, but certain items refuse to fall back (some pages, some images, etc.). In each case I've noticed that the items that refuse to fall back exhibit some weird behavior in the Content Editor.

  1. In the Content Editor, select the non-default language (in our case, this is es-MX).
  2. Select an item in the content tree.
  3. Open the language selector next to the version selector.

For properly functioning items, you'll see the default language listed with at least one version and then the non-default language listed with "Fallback version."

For the improperly functioning items, it will list the default language as normal but the non-default language says "0 versions."

Thus far, I'm unable to determine what causes this discrepency. Has anyone encountered this? Any ideas on how to resolve it?

Additional notes

We enabled the multilingual support using the Sitecore.LanguageFallback.config that comes with 8.1u3 (disabled by default). I've also added a CustomItemResolver because the business prefers that the site show an off-language version rather than a 404. It's essentially the same as the out-of-the-box ItemResolver except for the GetItem method, which looks like this:

    /// <summary>
    /// Checks first if the item exists in the context language, then in 
    /// the default language, then in any defined language
    /// </summary>
    /// <param name="path">the path to the item</param>
    /// <param name="args">the HttpRequestArgs from the pipeline</param>
    /// <returns></returns>
    protected Item GetItem(string path, HttpRequestArgs args)
    {
        // opt out for core database
        if (Context.Database.Name == StringReferences.StringReference.DatabaseNames.Core)
        {
            return ItemManager.GetItem(path, Context.Language, Version.Latest, Context.Database);
        }

        HashSet<Language> languages = new HashSet<Language>
        {
            Context.Language,
            LanguageManager.DefaultLanguage
        };
        languages.AddRange(LanguageManager.GetLanguages(Context.Database).Where(x => !languages.Contains(x)));

        foreach (Language language in languages)
        {
            Item obj = ItemManager.GetItem(path, language, Version.Latest, Context.Database);
            if (obj != null) return obj;
            Log.Info("[CustomItemResolver.GetItem] No version found for language " + language.Name, this);
        }
        return null;
    }

1 Answer 1

2

We are having the same problem at the moment, and while we haven't yet figured out why it is happening, we found a way to work around it.

In an item's advanced tab, there is a checkbox to enable Fallback for that item. The tickbox was not marked by default in our instance, and once we checked it, saved, and published, the items appeared as fallback.

I hope this answers at least part of your questions and it works in your case.

enter image description here

1
  • This is the way to solve the issue, but it should be set at the standard values for the templates you wish to fall back. (If it doesn't propagate down to a specific item, you will need to Reset that field back to standard values to pick up the change.) Mar 20, 2019 at 14:07

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service and acknowledge that you have read and understand our privacy policy and code of conduct.

Not the answer you're looking for? Browse other questions tagged or ask your own question.