translationsRegister mutation

Creates or updates translations.

Required access

write_translations access scope.

On this page

Interactive example

This is an example mutation query. Use the embedded interactive tool below to edit the query.

Hint: use Ctrl + Space for autocompleting fields.

mutation translationsRegister($resourceId: ID!, $translations: [TranslationInput!]!) { translationsRegister(resourceId: $resourceId, translations: $translations) {
  1. <font style="color:#1F61A0;">translations</font> <font style="color:#555555;">{</font>
  2. <font style="color:#1F61A0;">key</font>
  3. <font style="color:#1F61A0;">locale</font>
  4. <font style="color:#1F61A0;">outdated</font>
  5. <font style="color:#1F61A0;">value</font>
  6. <font style="color:#555555;">}</font>
  7. <font style="color:#1F61A0;">userErrors</font> <font style="color:#555555;">{</font>
  8. <font style="color:#1F61A0;">code</font>
  9. <font style="color:#1F61A0;">field</font>
  10. <font style="color:#1F61A0;">message</font>
  11. <font style="color:#555555;">}</font>
} } { “resourceId”: “Z2lkOi8vU2hvcGlmeS9FeGFtcGxlLzE=”, “translations”: [
  1. <font style="color:#555555;">{</font>
  2. <font style="color:#8B2BB9;">"locale"</font><font style="color:#555555;">:</font> <font style="color:#D64292;">"placeholder"</font><font style="color:#555555;">,</font>
  3. <font style="color:#8B2BB9;">"key"</font><font style="color:#555555;">:</font> <font style="color:#D64292;">"placeholder"</font><font style="color:#555555;">,</font>
  4. <font style="color:#8B2BB9;">"value"</font><font style="color:#555555;">:</font> <font style="color:#D64292;">"placeholder"</font><font style="color:#555555;">,</font>
  5. <font style="color:#8B2BB9;">"translatableContentDigest"</font><font style="color:#555555;">:</font> <font style="color:#D64292;">"placeholder"</font>
  6. <font style="color:#555555;">}</font>
] }

Arguments

Argument Description
resourceId
(
[ID!](https://shopify.dev/docs/admin-api/graphql/reference/scalar#id-2021-01)

) REQUIRED
ID of a translatable resource.
translations
(
[[TranslationInput!]!](https://shopify.dev/docs/admin-api/graphql/reference/translations/translationinput)

) REQUIRED
Specifies the input fields for a translation.

TranslationInput fields

  • key ([String!](https://shopify.dev/docs/admin-api/graphql/reference/scalar#string-2021-01)) REQUIRED
    The key of the translation.
  • locale ([String!](https://shopify.dev/docs/admin-api/graphql/reference/scalar#string-2021-01)) REQUIRED
    The locale of the translation.
  • translatableContentDigest ([String!](https://shopify.dev/docs/admin-api/graphql/reference/scalar#string-2021-01)) REQUIRED
    The digest (hash) of the content being translated.
  • value ([String!](https://shopify.dev/docs/admin-api/graphql/reference/scalar#string-2021-01)) REQUIRED
    The value of the translation.

Return fields

  • translations ([[Translation!]](https://shopify.dev/docs/admin-api/graphql/reference/translations/translation))
    The translations that were created or updated.
  • userErrors ([[TranslationUserError!]!](https://shopify.dev/docs/admin-api/graphql/reference/translations/translationusererror))
    List of errors that occurred executing the mutation.