Files
pterodactyl-panel/resources/scripts/components/elements/Translate.tsx
T
6c0413e39b Start 2.0 development
Co-authored-by: Anthony <anthony@infraly.co>
Co-authored-by: Sky Mulley <daniel.mulley@outlook.com>
2026-10-05 18:10:18 -04:00

30 lines
646 B
TypeScript

import React from 'react';
import { Trans, useTranslation } from 'react-i18next';
export type TranslationValue =
| string
| number
| boolean
| null
| readonly TranslationValue[]
| { readonly [key: string]: TranslationValue };
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>
);
}