Sanity Library Reference Docs
    Preparing search index...

    Interface TranslationProps

    Props for the Translate component.

    interface TranslationProps {
        components?: TranslateComponentMap;
        context?: string;
        i18nKey: string;
        t: TFunction;
        values?: Record<string, string | string[] | number | undefined>;
    }
    Index

    Properties

    A map of component names to React components, used to render more complex content

    context?: string

    A string representing the "context" of the resource key.

    For an i18nKey of greeter.greet-entity, passing context: 'human' will look for a key of greeter.greet-entity_human in the locale resources. If not found, it will fall back to the base key (greeter.greet-entity).

    i18nKey: string

    The i18n resource key to translate

    t: TFunction

    The t function to use, from the useTranslation hook

    values?: Record<string, string | string[] | number | undefined>

    A map of values to interpolate into the translated string. The resources should use the double curly bracket annotation to use them, eg {{petName}}. Will be escaped by React, so no need to escape HTML.