mirror of
https://github.com/pterodactyl/panel.git
synced 2026-11-30 11:25:52 -05:00
Co-authored-by: Anthony <anthony@infraly.co> Co-authored-by: Sky Mulley <daniel.mulley@outlook.com>
30 lines
646 B
TypeScript
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>
|
|
);
|
|
}
|