volume_up

A critical vulnerability was discovered in React Server Components (Next.js). Our systems remain protected but we advise to update packages to newest version. Learn More

AI OnAI Off

Fallback Languages in Optimizely Graph

Hello everyone! I notice that Optimizely Graph doesn't return results of a language available in the cms, but that is doing a fallback to another one. Do you know if Opti Graph supports this? 

#341244
Dec 09, 2025 14:45

See Fallback Languages in Optimizely Graph | Optimizely Developer Com

Fallback language isn't supported in Graph at the moment

#341249
Edited, Dec 10, 2025 15:02

Hi Kevin,

As Eric mentioned Optimizely Graph does not currently support CMS-style fallback languages automatically (like CMS 12 fallback / language branching). This is expected behavior and often causes confusion.

How language fallback works (and doesn’t work) in Optimizely Graph

In CMS:

  • Language fallback is handled by the CMS runtime.

  • If content doesn’t exist in the requested language, CMS transparently falls back to the configured fallback language.

In Optimizely Graph:

  • Graph is language-explicit.

  • If you query for sv and the content doesn’t exist in sv, Graph will simply return null.

  • There is no built-in concept of “try fallback language automatically.”

So Graph will never implicitly fall back to another language for you.

 

 

#341278
Dec 16, 2025 6:28
Vote:

If you are using PaaS CMS then this is a solvable problem using the IContentApiModelProperty interface.  Implementing this interface allows you to index custom properties within Graph and I do have PaaS clients where we do this for several fields to make querying a lot easier and to solve a very similar issue.  Lets start by looking at this interface:

public interface IContentApiModelProperty
{
    string Name { get; }

    object GetValue(ContentApiModel contentApiModel);
}

The name propety is the name of the field you want to index, this should be a unique field name to avoid confusion down the line.  The Get method is how you retrieve the value to index and is called automatically during the indexing event.

[ServiceConfiguration(typeof(IContentApiModelProperty), Lifecycle = ServiceInstanceScope.Singleton)]
public sealed class AvailableLanguagesProperty(
    IContentLoader contentLoader,
    IContentLanguageSettingsHandler contentLanguageSettingsHandler) : IContentApiModelProperty
{
    public string Name => "AvailableLanguages";

    public object GetValue(ContentApiModel contentApiModel)
    {
        return this.GetTypedValue(contentApiModel);
    }

    private IEnumerable<string> GetTypedValue(ContentApiModel contentApiModel)
    {
        if (!contentLoader.TryGet(contentApiModel.ContentLink?.ToContentReference(), out BasePageData basePageData))
        {
            return [];
        }

        var availableLanguages = new List<string>();

        // Use basePageData and IContentLanguageSettingsHandler to populate availableLanguages

        return availableLanguages..Distinct();
    }
}

This then allows us to filter our queries by our custom field for available languages, in this example we get content in en-US which is a fallback from en-GB using pure graphql, you can translate this into the library of your own chosing:

query MyQuery {
  BasePageData(where: { AvailableLanguages: { in: "en-US" } }) {
    items {
      Name
      ContentLink {
        Url
        Id
      }
      AvailableLanguages
    }
  }
}

 

#341345
Jan 02, 2026 13:46
* You are NOT allowed to include any hyperlinks in the post because your account hasn't associated to your company. User profile should be updated.