Open lpieri opened 10 months ago
I am encountering an issue with gatsby-plugin-react-i18next where it's not able to locate the translation keys in my JSON files. Despite having the translations defined in my JSON files, I keep getting a missingKey error.
i18next::translator: missingKey fr translation welcome welcome
// Gatsby Config Excerpt const config: GatsbyConfig = { // ...other configurations... plugins: [ // ...other plugins... { resolve: 'gatsby-source-filesystem', options: { name: 'locale', path: `${__dirname}/src/locales/` }, __key: "locale" }, { resolve: '@herob/gatsby-plugin-react-i18next', options: { languages: ["fr"], fallbackLanguage: "fr", trailingSlash: 'never', verbose: true, i18nextOptions: { debug: true, interpolation: { escapeValue: false, }, keySeparator: false, nsSeparator: false, }, } } // ...other plugins... ] };
// React Component Excerpt const Home: React.FC = () => { const { t } = useI18next(); // ...other component logic... return ( <Box> {/* ...other JSX... */} {t("welcome")} {/* ...other JSX... */} </Box> ); };
{ "welcome": "Welcome on my website", }
Despite these efforts, the issue persists. Any guidance or assistance in resolving this would be greatly appreciated.
Gatsby version: "5.9.1" gatsby-plugin-react-i18next version: latest
I am encountering an issue with gatsby-plugin-react-i18next where it's not able to locate the translation keys in my JSON files. Despite having the translations defined in my JSON files, I keep getting a missingKey error.
Error Message:
Relevant Configuration:
Gatsby Config:
Component using the t function:
JSON File (locales/fr/index.json):
Attempted Solutions:
Despite these efforts, the issue persists. Any guidance or assistance in resolving this would be greatly appreciated.
Environment:
Gatsby version: "5.9.1" gatsby-plugin-react-i18next version: latest