Make it easier to know outdated translations

Hello,

Right now, it is extremely hard to know if a resource (let’s say a metaobject) has outdated translations. This is useful to instruct a merchant that they must update translations in one or more languages.

To know if a resource has at least one outdated translations, this currently requires two steps:

  1. Retrieving all the locales of a store.
  2. Manually generate a request for each locales:
// Query 1: get all the shop locales
query {
  shopLocales {
    locale
  }
}

// Query 2: based on retrieved locales, generate another query
query {
    translatableResource(resourceId: "gid://shopify/Collection/1007901140") {
      resourceId
      fr: translations(locale: "fr") {
        outdated
      }
      de: translations(locale: "de") {
        outdated
      }
      it: translations(locale: "it") {
        outdated
      }
    }
  }

Those queries can’t be parallelized as query 2 needs to wait for query 1, and manually generating a GraphQL string is cumbersome.

To make it easier, it would be nice if the translatableResource would offer a convenient to get outdatedLocales:

query {
    translatableResource(resourceId: "gid://shopify/Collection/1007901140") {
      resourceId
      outdatedLocales {
        locale
      }
    }
  }

An outdated locale would be a translatable resource with at least one outdated translation.

Thanks.

Hey again @bakura10, hope all’s well :waving_hand:

You’re right that there’s not currently a great way of optimizing a query like this, I’m going to raise this with some folks internally and at the very least set up a feature request for you. We’ll get this looked into :slight_smile: