type

LocaleAvailability

Dynamically limit content locales shown to one author.

Source core/config.go:72

@param context
The request context, actor identity, and LocalAPI.
@returns
The visible configured locale codes, or an evaluation error.

This callback runs for an admin request and controls only which already-configured locales the author can select. It is presentation, not authorization: API clients may still request any configured locale, and ordinary access rules remain authoritative.

Return a non-empty list of unique configured codes in display order. Unknown or duplicate codes and an empty result fail the request with locale_availability_failed. Fallbacks outside the returned set are removed, and if the configured default is absent, the first returned locale becomes the request schema default.

Example

go
AvailableLocales: func(
  input core.LocaleAvailabilityContext,
) ([]schema.LocaleCode, error) {
  if input.Actor == nil {
    return []schema.LocaleCode{"en"}, nil
  }
  return []schema.LocaleCode{"en", "fr"}, nil
}

Related types