2022-11-25 20:25:03 +00:00
|
|
|
import type { TransProps } from 'react-i18next';
|
|
|
|
import { Trans, useTranslation } from 'react-i18next';
|
2022-06-11 18:52:41 +00:00
|
|
|
|
2022-11-25 20:25:03 +00:00
|
|
|
type Props = Omit<TransProps<string, string>, 't'>;
|
2022-06-11 18:52:41 +00:00
|
|
|
|
2022-11-25 20:25:03 +00:00
|
|
|
function Translate({ ns, children, ...props }: Props) {
|
2022-06-11 18:52:41 +00:00
|
|
|
const { t } = useTranslation(ns);
|
|
|
|
|
|
|
|
return (
|
|
|
|
<Trans t={t} {...props}>
|
|
|
|
{children}
|
|
|
|
</Trans>
|
|
|
|
);
|
2022-11-25 20:25:03 +00:00
|
|
|
}
|
|
|
|
|
|
|
|
export default Translate;
|