Contentful logo

Contentful Community

Graphql Query to get localized version of items when using `linkedFrom`

I can obtain the correct items when using linkedFrom as shown below:

movie(id: $movieId, locale: $locale) {
  linkedFrom {
    movieLocationCollection { 
      items {//fields - looking for the localized version of these fields} 
    }
  }
}

However, only if the locale variable is set to the default. If I try and get a different locale, then no results come through, just an empty array. as if

1 Like

I had the same problem, but I solved it by changing query option into like this:

movie(id: $movieId, locale: $locale) {
  linkedFrom(allowedLocales: ["ro", "en-US"]) {
    movieLocationCollection { 
      items {//fields - looking for the localized version of these fields} 
    }
  }
}

I found this solution in this article: https://www.contentful.com/blog/2020/12/03/three-new-graphql-features-2020/