Sanity Library Reference Docs
    Preparing search index...

    Interface LocaleResourceBundle

    A collection of locale resources for a given locale and namespace. In other words, an object of translated locale strings.

    interface LocaleResourceBundle {
        deep?: boolean;
        locale: string;
        namespace: string;
        overwrite?: boolean;
        resources:
            | LocaleResourceRecord
            | (
                () => Promise<
                    LocaleResourceRecord
                    | { default: LocaleResourceRecord },
                >
            );
    }
    Index

    Properties

    deep?: boolean

    Whether the resources should be merged deeply (eg for nested objects). Default: true

    locale: string

    The locale ID the resources belong to, eg en-US, nb-NO, th-TH

    namespace: string

    The namespace the resources belong to, eg vision, structure, studio

    overwrite?: boolean

    Whether any existing resource keys for the namespace be overwritten. Default: true

    resources:
        | LocaleResourceRecord
        | (() => Promise<LocaleResourceRecord | { default: LocaleResourceRecord }>)

    An object of locale resources, or a function that resolves to one. The localization framework automatically handles ESM modules with a default export, since a common use case is to dynamically load a resource file on use. This is the preferred option, since it allows for lazy loading of locale resources on use.