relate-app / gatsby-source-strapi-graphql

A Gatsby source plugin for building websites using Strapi as a data source
BSD Zero Clause License
32 stars 9 forks source link

unable to query multiple locales #17

Closed t-kietzmann closed 2 years ago

t-kietzmann commented 2 years ago

Hi all, first thanks again for this great package!

Currently i'm trying to fetch data in multiple languages. I've added a Single Type with one Field in two locales (de and en).

When querying via GraphQL i only get the data in the default language (de) (locale in package config is all). When changing the locale in the the package config to en, i only get the en data.

I tried to query strapiTypename and allStrapiTypename

I have read: Internationalization support Strapi now supports internationalization. But by default, this plugin will only fetch data in the default locale of your Strapi app. If your content types are available in different locales, you can also pass an entity definition object to specify the locale you want to fetch for a content type. Use the all value to get all available locales on a collection type.

But i don't get what to do.

Can someone help? Thx !

timbrandin commented 2 years ago

The documentation might be wrong or the implementation, will check in the coming days.

t-kietzmann commented 2 years ago

Hey Tim, any news on it?

I'm using still your package (although the official one is now available in beta) and querying collections in different locales works fine with the locale filter.

But i still don't know how i can query/filter a SingleType in different locales.

All the best & many thanks

timbrandin commented 2 years ago

Ok, I found the issue now, the Strapi graphql needs to be queried once for each language, will try to resolve this now.

timbrandin commented 2 years ago

Fixed in 4.4.0