Storefront GraphQL with different language

Storefront GraphQL with different language

KeiKei
Shopify Partner
2 0 0

I using storefront graphQL with accept-language to get different language from my store

I can get data from "en" or "zh-TW"

But can't get from "zh-CN"

Is the storefront graphQL not working with "zh-CN"?

Reply 1 (1)

KeiKei
Shopify Partner
2 0 0

Query:

mutation CreateTranslation($id: ID!, $translations: [TranslationInput!]!) {
  translationsRegister(resourceId: $id, translations: $translations) {
    userErrors {
      message
      field
    }
    translations {
      locale
      key
      value
    }
  }
}

Variables:

{
  "id": "gid://shopify/Product/6051879157938",
  "translations": [
    {
      "key": "title",
      "value": "[限时优惠] Lifetrons Switzerland 逆龄射频美眼仪",
      "locale": "zh-CN",
      "translatableContentDigest": "b35d6b841ef7f2c018e3e7e1ddc3d7f1b9f4b0884e0ce73848183e73616fba30"
    }
  ]
}

Result:

{
  "data": {
    "translationsRegister": {
      "userErrors": [
        {
          "message": "Locale has an invalid language code",
          "field": [
            "translations",
            "0",
            "locale"
          ]
        }
      ],
      "translations": []
    }
  },
  "extensions": {
    "cost": {
      "requestedQueryCost": 10,
      "actualQueryCost": 10,
      "throttleStatus": {
        "maximumAvailable": 1000,
        "currentlyAvailable": 990,
        "restoreRate": 50
      }
    }
  }
}