TranslationsRegister Locale has an invalid language code

hoitho
New Member
2 0 0
{
  availableLocales{
    isoCode
    name
  }
}

I check the list of availableLocales there is Akan (ak),
but when I use translationsRegister with ak language, it gets an error

mutation CreateTranslation($id: ID!, $translations: [TranslationInput!]!) {
    translationsRegister(resourceId: $id, translations: $translations) {
        userErrors {
            message
            field
        }
        translations {
            locale
            key
            value
        }
    }
}
{
  "id": "gid://shopify/Product/xxxx",
  "translations": {
    "locale": "ak",
    "key": "title",
    "value": "test tran ak",
    "translatableContentDigest": "xxxxx2"
    
  }
}
{
  "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
      }
    }
  }
} 

 

Replies 4 (4)
Kevin_A
Shopify Staff
Shopify Staff
318 42 61

Hey @hoitho 

Based on the error you are seeing the most likely cause is that you haven't enabled the Locale on your shop. Check out this tutorial for details:

https://shopify.dev/tutorials/translating-content-for-online-store

If that still doesn't work for you kindly reply with the x-request-id from the response headers so we can look into it further. 

Kevin_A | Solutions Engineer @ Shopify 
 - Was my reply helpful? Click Like to let me know! 
 - Was your question answered? Mark it as an Accepted Solution
 - To learn more visit Shopify.dev or the Shopify Web Design and Development Blog

hoitho
New Member
2 0 0

Hi @Kevin_A 

I have enabled the Locale on shop
If I have not enabled it will display an error

{
  "data": {
    "translationsRegister": {
      "userErrors": [
        {
          "message": "Locale is not a valid locale for the shop",
          "field": [
            "translations",
            "0",
            "locale"
          ]
        }
      ],
    }
  }
}

The error I am experiencing is that ak is not available
I think shopify has a problem translating with ak?

{
  "id": "gid://shopify/Product/4431163293769",
  "translations": {
    "key": "title",
    "value": "translate title with language ak",
    "translatableContentDigest": "abd24b9f5a5fdcbaf3610f6db3781b2dd3b394a5c09983cb4cb883e6e3d2e5e6",
    "locale": "ak"
  }
}

err

{
  "data": {
    "translationsRegister": {
      "userErrors": [
        {
          "message": "Locale has an invalid language code",
          "field": [
            "translations",
            "0",
            "locale"
          ]
        }
      ],
    }
  }
}
Kevin_A
Shopify Staff
Shopify Staff
318 42 61

Hey @hoitho 

Took another look at this and you are correct, it does appear to be an issue where we haven't properly registered "ak" as a valid locale. I have an open issue with our International dev team on this now. Thanks for reporting this!

Kevin_A | Solutions Engineer @ Shopify 
 - Was my reply helpful? Click Like to let me know! 
 - Was your question answered? Mark it as an Accepted Solution
 - To learn more visit Shopify.dev or the Shopify Web Design and Development Blog

Kevin_A
Shopify Staff
Shopify Staff
318 42 61

Hey @hoitho 

This should be fixed now. Thanks again for reporting this issue to us!

Kevin_A | Solutions Engineer @ Shopify 
 - Was my reply helpful? Click Like to let me know! 
 - Was your question answered? Mark it as an Accepted Solution
 - To learn more visit Shopify.dev or the Shopify Web Design and Development Blog