gatsby-plugin-react-i18next icon indicating copy to clipboard operation
gatsby-plugin-react-i18next copied to clipboard

language change Link not updating gatsby-plugin-layout component

Open presto2116 opened this issue 3 years ago • 0 comments

Hello, I have been working through adding this plugin to our site and ran into an issue where using the language switcher. It lives inside my gatsby-plugin-layout component. and on Link click, it updates the url which changes all contents of the page, but does not update any of the translated text in the gatsby-plugin-layout component itself. the below example. the navigationHome translation does not update to the new language where all the t functions in the page itself do get updated. when refreshing the page, navigationHome does update.

Navigation.tsx

import { Link , useI18next, useTranslation } from "gatsby-plugin-react-i18next";

---

const { languages, originalPath } = useI18next();
const { t } = useTranslation("navigation");

---

<h1>
   {t("navigationHome")}
</h1>

---

{languages.map((language) => {
  return (
    <Link key={language} to={originalPath} language={language}>
      {language}
    </Link>
  );
})}
Screen Shot 2021-03-11 at 11 58 22 AM Screen Shot 2021-03-11 at 11 58 51 AM

above are console logs when changing the language. the language changes form German => English and vice-versa but navigationHome does not update

presto2116 avatar Mar 11 '21 16:03 presto2116