You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
I am currently using your gatsby-theme-minimal-blog template for a project I am working on. While it's been a great asset, I've run into a hurdle that I'm unable to overcome and would greatly appreciate your help.
I'm trying to integrate react-i18next and gatsby-plugin-react-i18next into my blog.
The problem is with the GraphQL part of the setup, and I suspect it may be related to the use of that template. Despite several attempts to follow various guides, I've been unsuccessful. These are the guides I tried:
The problem arises when the UI starts placing variable names instead of the actual text from locale files. For example, the UI uses 'hero.greeting' and 'hero.description' from the hero.tsx file instead of the translated text. Here's the corresponding code snippet from my project:
importReactfrom'react';import{Text}from'theme-ui';import{useTranslation}from'gatsby-plugin-react-i18next';constHeroTextComponent=()=>{const{ t }=useTranslation();return(<div><Textsx={{fontSize: [3],fontWeight: `bold`,color: `heading`}}>{t('hero.greeting')}</Text><p>{t('hero.description')}</p></div>);};exportdefaultHeroTextComponent;
It appears to me that the useTranslation() hook doesn't fetch the text from the locale files correctly. I suspect that I might be missing some necessary configurations in GraphQL or the Gatsby theme, which are causing this issue.
Sadly, I don't have much experience with React/GraphQL/Gatsby to fix this.
Could you please shed some light on how to resolve this? Your expert guidance and assistance would be greatly appreciated.
reacted with thumbs up emoji reacted with thumbs down emoji reacted with laugh emoji reacted with hooray emoji reacted with confused emoji reacted with heart emoji reacted with rocket emoji reacted with eyes emoji
-
Dear Lennart and LekoArts community,
I am currently using your gatsby-theme-minimal-blog template for a project I am working on. While it's been a great asset, I've run into a hurdle that I'm unable to overcome and would greatly appreciate your help.
I'm trying to integrate react-i18next and gatsby-plugin-react-i18next into my blog.
The problem is with the GraphQL part of the setup, and I suspect it may be related to the use of that template. Despite several attempts to follow various guides, I've been unsuccessful. These are the guides I tried:
The problem arises when the UI starts placing variable names instead of the actual text from locale files. For example, the UI uses 'hero.greeting' and 'hero.description' from the hero.tsx file instead of the translated text. Here's the corresponding code snippet from my project:
It appears to me that the
useTranslation()
hook doesn't fetch the text from the locale files correctly. I suspect that I might be missing some necessary configurations in GraphQL or the Gatsby theme, which are causing this issue.Sadly, I don't have much experience with React/GraphQL/Gatsby to fix this.
Could you please shed some light on how to resolve this? Your expert guidance and assistance would be greatly appreciated.
Best regards,
Roman Rud
Beta Was this translation helpful? Give feedback.
All reactions