Closed brunoscopelliti closed 1 year ago
Ok, the problem is that we serialized the config in the last release... And after serialize it getT
can't access to loadLocaleFrom
... So probably we introduced this issue in 2.4.3... Meanwhile, as a workaround you can overwrite the global config:
import config from "../../../i18n";
import getT from "next-translate/getT";
export const generateMetadata = async ({ searchParams }: any) => {
globalThis.__NEXT_TRANSLATE__ = { lang: searchParams.lang, config }; // temporal workaround
const t = await getT(searchParams.lang, "common");
return {
title: t("common:page_title"),
};
};
Fixed in next-translate-plugin 2.4.4. Thanks for your contributions reporting these errors @brunoscopelliti
Confirm version 2.4.4 fixes all problems. Thank you
I'm attaching a repro, repro.zip. Download it, install dependencies, and visit
/demo
. In browser's title bar you should read something like "common:page_title" instead of the label.