Request all translation locales of a product at once

Solved
Beatroot
Tourist
5 1 1

Using GraphQL, is it possible to receive all translation locales of a product at once? Currently i use this to request the translation language by language:

 

{
product(id: "...") {
translations(locale: "de") {
key
locale
value
}
}
}

Is there a way to receive key/locale/value for all languages at once? 

0 Likes
SBD_
Shopify Staff
Shopify Staff
1090 147 199

This is an accepted solution.

Hey @Beatroot,

 

I think this requires multiple requests.

0 Likes
Beatroot
Tourist
5 1 1

Thanks. it very much looks like it. I've already implemented it like that. Creates a bunch of extra complexity and code.

It's always good to have a second opinion. 

To whom it may concern:
This would be a useful functionality to be able to return several locales at once, saves a lot of queries. Especially since the name of the locale is already the result fields.

ryanlunka
New Member
2 0 0

You can namespace the translations node to get multiples at a time.

{
  collection(id: "gid://shopify/Collection/xxxxxxxxxxx"){
    id
    es:translations (locale: "es"){
      key
      locale
      value
    }
    fr:translations (locale: "fr"){
      key
      locale
      value
    }
  }
}

 

0 Likes