Function Trans

  • Insert React elements to the translation message.

    Parameters

    • props: PropsWithChildren<TProps>
    • Optional context: any

    Returns null | ReactElement<any, any>

    Example

    <Trans message="a{{b}}c{{d}}e">
    <h1 data-t-slot="b">B</h1>
    <p data-t-slot="d">D</p>
    </Trans>

    <>
    a<h1 data-t-slot="b">B</h1>c<p data-t-slot="d">D</p>e
    <>

    data-t-slot can be ignored if there is only one placeholder.

    Example

    <Trans message="a{{b}}c">
    <h1>B</h1>
    </Trans>

    <>
    a<h1>B</h1>c
    </>