microapps / gatsby-plugin-react-i18next

Easily translate your Gatsby website into multiple languages
MIT License
121 stars 72 forks source link

You need to add a graphql query to every page like this #151

Open viktormoskalev07 opened 2 years ago

viktormoskalev07 commented 2 years ago

I am using Strapi , so i don't have any json files for translations in my project , how can i switch off that message?

wrapPageElement.js:114 No translations were found in "locales" key for "/team/".

You need to add a graphql query to every page like this:

 export const query = graphql` 
  query($language: String!) { 
    locales: allLocale(language: {eq: $language}) {
      edges {
        node {
          ns
          data
          language
        }
      }
    }
  }
CompuWiser commented 1 year ago

Add this line at the top of the file

import { graphql } from "gatsby";

I spent hours debugging to find this out!!

dev-smart-ui commented 1 year ago

Add this line at the top of the file

import { graphql } from "gatsby";

I spent hours debugging to find this out!!

Which file do you mean I receive this error on every page , Even if I don’t have any requests

CompuWiser commented 1 year ago

Add this line at the top of the file

import { graphql } from "gatsby";

I spent hours debugging to find this out!!

Which file do you mean I receive this error on every page , Even if I don’t have any requests

On each page you use graphql like this

 export const query = graphql` 
  query($language: String!) { 
    locales: allLocale(language: {eq: $language}) {
      edges {
        node {
          ns
          data
          language
        }
      }
    }
  }