Files

30 lines
646 B
TypeScript
Raw Permalink Normal View History

import React from 'react';
2026-10-05 18:10:18 -04:00
import { Trans, useTranslation } from 'react-i18next';
2026-10-05 18:10:18 -04:00
export type TranslationValue =
| string
| number
| boolean
| null
| readonly TranslationValue[]
| { readonly [key: string]: TranslationValue };
2026-10-05 18:10:18 -04:00
export type TranslationValues = Record<string, TranslationValue>;
interface Props {
ns: string;
i18nKey: string;
values?: TranslationValues;
children?: React.ReactNode;
}
export default function Translate({ ns, children, ...props }: Props) {
const { t } = useTranslation(ns);
return (
<Trans t={t} {...props}>
{children}
</Trans>
);
2026-10-05 18:10:18 -04:00
}