Access current editor locale in showIf for Section/Data Model fields

Hi,

we’re building a multi-locale site where each locale can display a different media type in a section model. The mediaType field is localized — one locale might show a video, another a static image.

We have dependent fields (videoPlaybackId, uploadFile, localAssetName, etc.) that should only appear when the relevant mediaType is selected for the current locale. This is a natural use case for showIf.

The problem:

options.get("mediaType") inside showIf returns the raw LocalizedValue object:

{
  "@type": "@builder.io/core:LocalizedValue",
  "de-DE": "Video",
  "en-US": "Image"
}

There is no way to resolve this to the current editor locale from within showIf. The current editor locale is not exposed anywhere in the showIf context (options, parent, parentElements).

Related known issue:

Combining showIf with localized: true on the same field makes the input uneditable in the editor — reported in 2022, still unresolved as far as we can tell.

Feature request:

Expose the current editor locale in the showIf context. For example:

showIf: (options, parent, parentElements, context) => {
  const locale = context?.locale // e.g. "de-DE"
  const mediaType = options.get("mediaType")
  const resolved = mediaType?.[locale] ?? mediaType
  return resolved === "Video"
}

Or a helper on options:

showIf: (options) => options.getLocalized("mediaType") === "Video"

This would make showIf actually usable for locale-aware field visibility — a common need on multi-locale projects.

Thanks!

Hi @AlissaAvt,

Thanks for the detailed write-up — this is clearly explained and we want to make sure we investigate it properly!

To help us reproduce and diagnose the issue on our end, could you share the following?

  1. A content/model link — the URL from your Builder dashboard for the Section or Data Model where this is configured (e.g. builder.io/models/... or a direct content entry link)
  2. Your full field definition — the code where you’ve defined mediaType and the dependent fields with showIf and localized: true
  3. Your Builder SDK — which framework you’re using (Next.js, React, etc.) and the version (@builder.io/sdk version from your package.json)
  4. Your Builder Space ID — this helps us look up your model configuration on our side

With these details we can properly investigate whether this is a bug, a limitation of the current showIf context, or something we can address with a workaround in the meantime.

Also, regarding the showIf + localized: true uneditable input issue you mentioned — is that still happening in your current setup? If so, please include that in the details above so we can track both issues together.

You can also raise this issue directly with support@builder.io for easier communication and faster response time.

Thanks again for taking the time to report this — locale-aware showIf is a valid use case and your feedback helps us prioritize it.

Looking forward to your response!