2

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;
    }

Your Answer

By clicking "Post Your Answer", you acknowledge that you have read our updated terms of service, privacy policy and cookie policy, and that your continued use of the website is subject to these policies.

Browse other questions tagged or ask your own question.