Translation Issues in storefront api using the Translate & Adapt App with @inContext

Hey,

there are a couple of issues with translations using the storefront api.

  1. The following metaobject query will not return the translated values:
query metaobjectById($country: CountryCode, $language: LanguageCode)
@inContext(country: $country, language: $language) {
  metaobject(id: "gid://shopify/Metaobject/368771349") {
    fields {
      key
      value
    }
  }
}

However a metabobjects query like this will work:

query metabojectsByType($country: CountryCode, $language: LanguageCode)
@inContext(country: $country, language: $language) {
  metaobjects(type: "homepage", first: 1) {
    nodes {
      fields {
        key
        value
      }
    }
  }
}
  1. If there are metaobject references in a metaobjects query the values will not be translated:
query metaobjectsByTypeWithReference($country: CountryCode, $language: LanguageCode)
@inContext(country: $country, language: $language) {
  metaobjects(type: "homepage", first: 1) {
    nodes {
      fields {
        key
        value
        reference {
          ... on Metaobject {
            fields {
              key
              value
            }
          }
        }
      }
    }
  }
}
  1. menu queries like navigations are not translated:
query homepageMetaQuery($country: CountryCode, $language: LanguageCode)
@inContext(country: $country, language: $language) {
	headerMenu: menu(handle: "main-menu") {
      id
      items {
        id
        resourceId
        tags
        title
        type
        url
      }
    }
}
1 Like
  1. Regarding the first issue, the metaobject query that you provided will not return the translated values. However, a metabobjects query that specifies the type and first node will work.

  2. The second issue you have encountered is that if there are metaobject references in a metaobjects query, the values will not be translated.

  3. Finally, menu queries like navigations are not translated using the Shopify Storefront API.