improve i18nhelper

This commit is contained in:
Max Peintner
2025-06-19 14:20:04 +02:00
parent ed7f664b54
commit 3cb8729f20

View File

@@ -11,9 +11,10 @@ export function Translated({
namespace?: string; namespace?: string;
} & React.HTMLAttributes<HTMLSpanElement>) { } & React.HTMLAttributes<HTMLSpanElement>) {
const t = useTranslations(namespace); const t = useTranslations(namespace);
const helperKey = `${namespace ? `${namespace}.` : ""}${i18nKey}`;
return ( return (
<span data-i18n-key={i18nKey} {...props}> <span data-i18n-key={helperKey} {...props}>
{t(i18nKey)} {t(i18nKey)}
</span> </span>
); );