type
LocaleAvailability
Dynamically limit content locales shown to one author.
Example
AvailableLocales:
func(
input core.LocaleAvailabilityContext,
) ([]schema.LocaleCode, error) {
if input.Actor == nil {
return []schema.LocaleCode{"en"}, nil
}
return []schema.LocaleCode{"en", "fr"}, nil
}Arguments
| Argument | Type | Description |
|---|---|---|
context | LocaleAvailabilityContext | The request context, actor identity, and LocalAPI. |
Returns
The visible configured locale codes, or an evaluation error.
([]schema.LocaleCode, error)How it works
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.
Full signature
type LocaleAvailability func(
LocaleAvailabilityContext,
) ([]schema.LocaleCode, error)Related types
LocaleAvailabilityContextRequest input for dynamic admin locale visibility.
LocaleCodeA validated locale identity used by operations, manifests, and storage.