I am creating a new topic, but the issue is basically the same as this one
The language is Burmese.
All the request are made through Shopify Admin GraphQL API
The locale code for Burmese is "my", and the language is added to a test store using this request
curl --location --request POST 'https://<shop_url>/admin/api/2020-07/graphql.json' \
--header 'Content-Type: application/json' \
--header 'X-Shopify-Access-Token: <access_token>' \
--data-raw '{
"query": "mutation enableLocale($locale: String!) { shopLocaleEnable(locale: $locale) { userErrors {message field} shopLocale {locale name primary published} } }",
"variables": {
"locale": "my"
}
}'
To confirm that the language is there you can use
curl --location --request POST 'https://<shop_url>/admin/api/2020-07/graphql.json' \
--header 'Content-Type: application/graphql' \
--header 'X-Shopify-Access-Token: <access_token>' \
--data-raw '{
shopLocales {
name
locale
primary
published
}
}'
Response
{
"data": {
"shopLocales": [
{
"name": "English",
"locale": "en",
"primary": true,
"published": true
},
{
"name": "French",
"locale": "fr",
"primary": false,
"published": false
},
{
"name": "Burmese",
"locale": "my",
"primary": false,
"published": false
}
]
},
"extensions": {
"cost": {
"requestedQueryCost": 1,
"actualQueryCost": 1,
"throttleStatus": {
"maximumAvailable": 1000.0,
"currentlyAvailable": 999,
"restoreRate": 50.0
}
}
}
}
When we try to create a translation for Burmese we get
Locale has an invalid language code
curl --location --request POST 'https://<shop_url>/admin/api/2020-07/graphql.json' \
--header 'Content-Type: application/json' \
--header 'X-Shopify-Access-Token: <access_token>' \
--data-raw '{
"query": "mutation CreateTranslation($id: ID!, $translations: [TranslationInput!]!) { translationsRegister(resourceId: $id, translations: $translations) { userErrors {message field} translations {locale key value} } }",
"variables": {
"id": "<product_gid>",
"translations": [
{
"key": "title",
"value": "Burmese translation for product",
"locale": "my",
"translatableContentDigest": "<content_digest>"
}
]
}
}'
Response
{
"data": {
"translationsRegister": {
"userErrors": [
{
"message": "Locale has an invalid language code",
"field": [
"translations",
"0",
"locale"
]
}
],
"translations": []
}
},
"extensions": {
"cost": {
"requestedQueryCost": 10,
"actualQueryCost": 10,
"throttleStatus": {
"maximumAvailable": 1000.0,
"currentlyAvailable": 990,
"restoreRate": 50.0
}
}
}
}
It is not related to the published state of the language.
You should be able to translate while the language is not published.
I will appreciate if a Shopify API developer can take a look on the matter and check if the language is properly registered.
Solved! Go to the solution
Hey @Metin
Thanks for reporting this! I have reported the issue to our team and will update you once I have more info.
Kevin_A | Developer Support @ 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
This is an accepted solution.
Hey @Metin
This should be fixed now.
Kevin_A | Developer Support @ 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
User | Count |
---|---|
14 | |
12 | |
10 | |
8 | |
7 |