Can't add translation for descriptionHtml

Can't add translation for descriptionHtml

befstrat
Visitor
2 0 0

I am trying to add translations to products using translationsRegister mutation. So far I can successfully add translation for the title field, but when I try to add translation for the descriptionHtml (that is using as translation key "descriptionHtml") I get an error that the field is not available as translatable resource. I also tried to use "body_html" as key, but in that case i got an invalid hash error (of course I used a hash value based on descriptionHtml). So how can I add translation for descriptionHtml? Thanks

Replies 3 (3)

Iwillsolveit
Tourist
42 1 3

To add translations for descriptionHtml using the translationsRegister mutation, ensure your mutation uses the correct field and structure:

 

Mutation Example:

 

mutation {

  translationsRegister(

    translations: [

      {

        resourceId: "gid://shopify/Product/PRODUCT_ID"

        resourceType: PRODUCT

        locale: "LANGUAGE_CODE"

        translations: [

          { key: "title", value: "Translated Title" },

          { key: "descriptionHtml", value: "<p>Translated HTML Description</p>" }

        ]

      }

    ]

  ) {

    userErrors {

      field

      message

    }

  }

}

 

Use descriptionHtml for product descriptions.

 

Ensure the resourceType is PRODUCT and t

he HTML content is valid.

 

 

Hello I'm Nolan you can reach out to me here (https://wa.link/f7lf0o) if you ever need anything 
befstrat
Visitor
2 0 0

Hi. I am afraid this is not working... 
And according to the documentation the structure of the translationsRegister is

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

 There is no resourceType field and the locale field is inside each translationInput entity

Iwillsolveit
Tourist
42 1 3

You can make use of Langify

Hello I'm Nolan you can reach out to me here (https://wa.link/f7lf0o) if you ever need anything 