translations Registermutation
mutation
2024-10latest
Requires write
access scope.
Creates or updates translations.
Arguments
ID of the resource that is being translated.
Specifies the input fields for a translation.
Was this section helpful?
TranslationsRegisterPayload returns
The translations that were created or updated.
The list of errors that occurred from executing the mutation.
Was this section helpful?
Code examples for MUTATION: translationsRegister
Query Reference for MUTATION: translationsRegister
"mutation translationsRegister($resourceId: ID!, $translations: [TranslationInput!]!) {\n translationsRegister(resourceId: $resourceId, translations: $translations) {\n translations {\n # Translation fields\n }\n userErrors {\n field\n message\n }\n }\n}"
Input Reference for MUTATION: translationsRegister
"{\n \"resourceId\": \"gid://shopify/<objectName>/10079785100\",\n \"translations\": [\n {\n \"key\": \"<your-key>\",\n \"locale\": \"<your-locale>\",\n \"marketId\": \"gid://shopify/<objectName>/10079785100\",\n \"translatableContentDigest\": \"<your-translatableContentDigest>\",\n \"value\": \"<your-value>\"\n }\n ]\n}"
Schema Reference for MUTATION: translationsRegister
"input TranslationInput {\n key: String!\n locale: String!\n marketId: ID\n translatableContentDigest: String!\n value: String!\n}\n"
Display Examples for MUTATION: translationsRegister
[ { "example": { "type_name": "translationsregister", "title": "Register a French product title", "description": "A successfully registered translation will be immediately visible to buyers if the locale is already published. In this example, the registered content will be visible to all buyers browsing in French from any market, unless there exists a market-specific translation for that market. To retrieve the `translatableContentDigest`, call the `translatableResource` query beforehand.", "query_string": "mutation translationsRegister($resourceId: ID!, $translations: [TranslationInput!]!) {\n translationsRegister(resourceId: $resourceId, translations: $translations) {\n userErrors {\n message\n field\n }\n translations {\n key\n value\n }\n }\n}", "query_arguments": { "resourceId": "$resourceId", "translations": "$translations" }, "variables": { "resourceId": "gid://shopify/Product/20995642", "translations": [ { "locale": "fr", "key": "title", "value": "L'élément", "translatableContentDigest": "4e5b548d6d61f0006840aca106f7464a4b59e5a854317d5b57861b8423901bf6" } ] }, "response": { "data": { "translationsRegister": { "userErrors": [], "translations": [ { "key": "title", "value": "L'élément" } ] } } }, "api_name": "admin", "minimum_api_version": "2023-10", "maximum_api_version": "unstable", "location": "/components/markets/store_localization/test/unit/graph_api/admin/mutations/translations_register_test.rb", "curl_example": "curl -X POST \\\nhttps://your-development-store.myshopify.com/admin/api/2024-10/graphql.json \\\n-H 'Content-Type: application/json' \\\n-H 'X-Shopify-Access-Token: {access_token}' \\\n-d '{\n\"query\": \"mutation translationsRegister($resourceId: ID!, $translations: [TranslationInput!]!) { translationsRegister(resourceId: $resourceId, translations: $translations) { userErrors { message field } translations { key value } } }\",\n \"variables\": {\n \"resourceId\": \"gid://shopify/Product/20995642\",\n \"translations\": [\n {\n \"locale\": \"fr\",\n \"key\": \"title\",\n \"value\": \"L'\\''élément\",\n \"translatableContentDigest\": \"4e5b548d6d61f0006840aca106f7464a4b59e5a854317d5b57861b8423901bf6\"\n }\n ]\n }\n}'\n", "remix_example": "const { admin } = await authenticate.admin(request);\n\nconst response = await admin.graphql(\n `#graphql\n mutation translationsRegister($resourceId: ID!, $translations: [TranslationInput!]!) {\n translationsRegister(resourceId: $resourceId, translations: $translations) {\n userErrors {\n message\n field\n }\n translations {\n key\n value\n }\n }\n }`,\n {\n variables: {\n \"resourceId\": \"gid://shopify/Product/20995642\",\n \"translations\": [\n {\n \"locale\": \"fr\",\n \"key\": \"title\",\n \"value\": \"L'élément\",\n \"translatableContentDigest\": \"4e5b548d6d61f0006840aca106f7464a4b59e5a854317d5b57861b8423901bf6\"\n }\n ]\n },\n },\n);\n\nconst data = await response.json();\n", "ruby_example": "session = ShopifyAPI::Auth::Session.new(\n shop: \"your-development-store.myshopify.com\",\n access_token: access_token\n)\nclient = ShopifyAPI::Clients::Graphql::Admin.new(\n session: session\n)\n\nquery = <<~QUERY\n mutation translationsRegister($resourceId: ID!, $translations: [TranslationInput!]!) {\n translationsRegister(resourceId: $resourceId, translations: $translations) {\n userErrors {\n message\n field\n }\n translations {\n key\n value\n }\n }\n }\nQUERY\n\nvariables = {\n \"resourceId\": \"gid://shopify/Product/20995642\",\n \"translations\": [{\"locale\"=>\"fr\", \"key\"=>\"title\", \"value\"=>\"L'élément\", \"translatableContentDigest\"=>\"4e5b548d6d61f0006840aca106f7464a4b59e5a854317d5b57861b8423901bf6\"}]\n}\n\nresponse = client.query(query: query, variables: variables)\n", "node_example": "const client = new shopify.clients.Graphql({session});\nconst data = await client.query({\n data: {\n \"query\": `mutation translationsRegister($resourceId: ID!, $translations: [TranslationInput!]!) {\n translationsRegister(resourceId: $resourceId, translations: $translations) {\n userErrors {\n message\n field\n }\n translations {\n key\n value\n }\n }\n }`,\n \"variables\": {\n \"resourceId\": \"gid://shopify/Product/20995642\",\n \"translations\": [\n {\n \"locale\": \"fr\",\n \"key\": \"title\",\n \"value\": \"L'élément\",\n \"translatableContentDigest\": \"4e5b548d6d61f0006840aca106f7464a4b59e5a854317d5b57861b8423901bf6\"\n }\n ]\n },\n },\n});\n", "php_example": "use Shopify\\Clients\\Graphql;\n\n$client = new Graphql(\"your-development-store.myshopify.com\", $accessToken);\n$query = <<<QUERY\n mutation translationsRegister($resourceId: ID!, $translations: [TranslationInput!]!) {\n translationsRegister(resourceId: $resourceId, translations: $translations) {\n userErrors {\n message\n field\n }\n translations {\n key\n value\n }\n }\n }\nQUERY;\n\n$variables = [\n \"resourceId\" => \"gid://shopify/Product/20995642\",\n \"translations\" => [{\"locale\"=>\"fr\", \"key\"=>\"title\", \"value\"=>\"L'élément\", \"translatableContentDigest\"=>\"4e5b548d6d61f0006840aca106f7464a4b59e5a854317d5b57861b8423901bf6\"}],\n];\n\n$response = $client->query([\"query\" => $query, \"variables\" => $variables]);\n" }, "titleStringKey": "variables", "inputVariableEntries": [ { "arg": { "name": "resourceId", "description": "ID of the resource that is being translated.", "type": { "kind": "SCALAR", "name": "ID", "list": false, "non_null": true }, "defaultValue": null, "typeSignature": "ID!", "isDeprecated": false, "deprecationReason": null, "kind": "ARGUMENT" }, "key": "resourceId", "argValue": " \"gid://shopify/Product/20995642\"", "typeKind": "MUTATION" }, { "arg": { "name": "translations", "description": "Specifies the input fields for a translation.", "type": { "kind": "INPUT_OBJECT", "name": "TranslationInput", "list": true, "non_null": true }, "defaultValue": null, "typeSignature": "[TranslationInput!]!", "isDeprecated": false, "deprecationReason": null, "kind": "ARGUMENT" }, "key": "translations", "argValue": " [{\"locale\":\"fr\",\"key\":\"title\",\"value\":\"L'élément\",\"translatableContentDigest\":\"4e5b548d6d61f0006840aca106f7464a4b59e5a854317d5b57861b8423901bf6\"}]", "typeKind": "MUTATION" } ] }, { "example": { "type_name": "translationsregister", "title": "Register a French product title specific to a market", "description": "To register content that surfaces only to buyers in a specific market, make use of the `TranslationInput` object's optional `marketId` field. In this example, the words \"L'élément canadien\" will only be visible to buyers in the specified market, which has an ID of `gid://shopify/Market/128989799`.", "query_string": "mutation translationsRegister($resourceId: ID!, $translations: [TranslationInput!]!) {\n translationsRegister(resourceId: $resourceId, translations: $translations) {\n userErrors {\n message\n field\n }\n translations {\n key\n value\n market {\n id\n name\n }\n }\n }\n}", "query_arguments": { "resourceId": "$resourceId", "translations": "$translations" }, "variables": { "resourceId": "gid://shopify/Product/20995642", "translations": [ { "locale": "fr", "key": "title", "value": "L'élément canadien", "translatableContentDigest": "4e5b548d6d61f0006840aca106f7464a4b59e5a854317d5b57861b8423901bf6", "marketId": "gid://shopify/Market/128989799" } ] }, "response": { "data": { "translationsRegister": { "userErrors": [], "translations": [ { "key": "title", "value": "L'élément canadien", "market": { "id": "gid://shopify/Market/128989799", "name": "Canada" } } ] } } }, "api_name": "admin", "minimum_api_version": "2023-10", "maximum_api_version": "unstable", "location": "/components/markets/store_localization/test/unit/graph_api/admin/mutations/translations_register_test.rb", "curl_example": "curl -X POST \\\nhttps://your-development-store.myshopify.com/admin/api/2024-10/graphql.json \\\n-H 'Content-Type: application/json' \\\n-H 'X-Shopify-Access-Token: {access_token}' \\\n-d '{\n\"query\": \"mutation translationsRegister($resourceId: ID!, $translations: [TranslationInput!]!) { translationsRegister(resourceId: $resourceId, translations: $translations) { userErrors { message field } translations { key value market { id name } } } }\",\n \"variables\": {\n \"resourceId\": \"gid://shopify/Product/20995642\",\n \"translations\": [\n {\n \"locale\": \"fr\",\n \"key\": \"title\",\n \"value\": \"L'\\''élément canadien\",\n \"translatableContentDigest\": \"4e5b548d6d61f0006840aca106f7464a4b59e5a854317d5b57861b8423901bf6\",\n \"marketId\": \"gid://shopify/Market/128989799\"\n }\n ]\n }\n}'\n", "remix_example": "const { admin } = await authenticate.admin(request);\n\nconst response = await admin.graphql(\n `#graphql\n mutation translationsRegister($resourceId: ID!, $translations: [TranslationInput!]!) {\n translationsRegister(resourceId: $resourceId, translations: $translations) {\n userErrors {\n message\n field\n }\n translations {\n key\n value\n market {\n id\n name\n }\n }\n }\n }`,\n {\n variables: {\n \"resourceId\": \"gid://shopify/Product/20995642\",\n \"translations\": [\n {\n \"locale\": \"fr\",\n \"key\": \"title\",\n \"value\": \"L'élément canadien\",\n \"translatableContentDigest\": \"4e5b548d6d61f0006840aca106f7464a4b59e5a854317d5b57861b8423901bf6\",\n \"marketId\": \"gid://shopify/Market/128989799\"\n }\n ]\n },\n },\n);\n\nconst data = await response.json();\n", "ruby_example": "session = ShopifyAPI::Auth::Session.new(\n shop: \"your-development-store.myshopify.com\",\n access_token: access_token\n)\nclient = ShopifyAPI::Clients::Graphql::Admin.new(\n session: session\n)\n\nquery = <<~QUERY\n mutation translationsRegister($resourceId: ID!, $translations: [TranslationInput!]!) {\n translationsRegister(resourceId: $resourceId, translations: $translations) {\n userErrors {\n message\n field\n }\n translations {\n key\n value\n market {\n id\n name\n }\n }\n }\n }\nQUERY\n\nvariables = {\n \"resourceId\": \"gid://shopify/Product/20995642\",\n \"translations\": [{\"locale\"=>\"fr\", \"key\"=>\"title\", \"value\"=>\"L'élément canadien\", \"translatableContentDigest\"=>\"4e5b548d6d61f0006840aca106f7464a4b59e5a854317d5b57861b8423901bf6\", \"marketId\"=>\"gid://shopify/Market/128989799\"}]\n}\n\nresponse = client.query(query: query, variables: variables)\n", "node_example": "const client = new shopify.clients.Graphql({session});\nconst data = await client.query({\n data: {\n \"query\": `mutation translationsRegister($resourceId: ID!, $translations: [TranslationInput!]!) {\n translationsRegister(resourceId: $resourceId, translations: $translations) {\n userErrors {\n message\n field\n }\n translations {\n key\n value\n market {\n id\n name\n }\n }\n }\n }`,\n \"variables\": {\n \"resourceId\": \"gid://shopify/Product/20995642\",\n \"translations\": [\n {\n \"locale\": \"fr\",\n \"key\": \"title\",\n \"value\": \"L'élément canadien\",\n \"translatableContentDigest\": \"4e5b548d6d61f0006840aca106f7464a4b59e5a854317d5b57861b8423901bf6\",\n \"marketId\": \"gid://shopify/Market/128989799\"\n }\n ]\n },\n },\n});\n", "php_example": "use Shopify\\Clients\\Graphql;\n\n$client = new Graphql(\"your-development-store.myshopify.com\", $accessToken);\n$query = <<<QUERY\n mutation translationsRegister($resourceId: ID!, $translations: [TranslationInput!]!) {\n translationsRegister(resourceId: $resourceId, translations: $translations) {\n userErrors {\n message\n field\n }\n translations {\n key\n value\n market {\n id\n name\n }\n }\n }\n }\nQUERY;\n\n$variables = [\n \"resourceId\" => \"gid://shopify/Product/20995642\",\n \"translations\" => [{\"locale\"=>\"fr\", \"key\"=>\"title\", \"value\"=>\"L'élément canadien\", \"translatableContentDigest\"=>\"4e5b548d6d61f0006840aca106f7464a4b59e5a854317d5b57861b8423901bf6\", \"marketId\"=>\"gid://shopify/Market/128989799\"}],\n];\n\n$response = $client->query([\"query\" => $query, \"variables\" => $variables]);\n" }, "titleStringKey": "variables", "inputVariableEntries": [ { "arg": { "name": "resourceId", "description": "ID of the resource that is being translated.", "type": { "kind": "SCALAR", "name": "ID", "list": false, "non_null": true }, "defaultValue": null, "typeSignature": "ID!", "isDeprecated": false, "deprecationReason": null, "kind": "ARGUMENT" }, "key": "resourceId", "argValue": " \"gid://shopify/Product/20995642\"", "typeKind": "MUTATION" }, { "arg": { "name": "translations", "description": "Specifies the input fields for a translation.", "type": { "kind": "INPUT_OBJECT", "name": "TranslationInput", "list": true, "non_null": true }, "defaultValue": null, "typeSignature": "[TranslationInput!]!", "isDeprecated": false, "deprecationReason": null, "kind": "ARGUMENT" }, "key": "translations", "argValue": " [{\"locale\":\"fr\",\"key\":\"title\",\"value\":\"L'élément canadien\",\"translatableContentDigest\":\"4e5b548d6d61f0006840aca106f7464a4b59e5a854317d5b57861b8423901bf6\",\"marketId\":\"gid://shopify/Market/128989799\"}]", "typeKind": "MUTATION" } ] }, { "example": { "type_name": "translationsregister", "title": "Register a product title in the shop default language specific to a market", "description": "To register content in the shop default language that surfaces only to buyers in a specific market, make use of the `TranslationInput` object's optional `marketId` field. In this example, the shop default language is English, and the words \"Canadian element\" will only be visible to buyers in the specified market, which has an ID of `gid://shopify/Market/128989799`.", "query_string": "mutation translationsRegister($resourceId: ID!, $translations: [TranslationInput!]!) {\n translationsRegister(resourceId: $resourceId, translations: $translations) {\n userErrors {\n message\n field\n }\n translations {\n key\n value\n market {\n id\n name\n }\n }\n }\n}", "query_arguments": { "resourceId": "$resourceId", "translations": "$translations" }, "variables": { "resourceId": "gid://shopify/Product/20995642", "translations": [ { "locale": "en", "key": "title", "value": "Canadian element", "translatableContentDigest": "4e5b548d6d61f0006840aca106f7464a4b59e5a854317d5b57861b8423901bf6", "marketId": "gid://shopify/Market/128989799" } ] }, "response": { "data": { "translationsRegister": { "userErrors": [], "translations": [ { "key": "title", "value": "Canadian element", "market": { "id": "gid://shopify/Market/128989799", "name": "Canada" } } ] } } }, "api_name": "admin", "minimum_api_version": "2023-10", "maximum_api_version": "unstable", "location": "/components/markets/store_localization/test/unit/graph_api/admin/mutations/translations_register_test.rb", "curl_example": "curl -X POST \\\nhttps://your-development-store.myshopify.com/admin/api/2024-10/graphql.json \\\n-H 'Content-Type: application/json' \\\n-H 'X-Shopify-Access-Token: {access_token}' \\\n-d '{\n\"query\": \"mutation translationsRegister($resourceId: ID!, $translations: [TranslationInput!]!) { translationsRegister(resourceId: $resourceId, translations: $translations) { userErrors { message field } translations { key value market { id name } } } }\",\n \"variables\": {\n \"resourceId\": \"gid://shopify/Product/20995642\",\n \"translations\": [\n {\n \"locale\": \"en\",\n \"key\": \"title\",\n \"value\": \"Canadian element\",\n \"translatableContentDigest\": \"4e5b548d6d61f0006840aca106f7464a4b59e5a854317d5b57861b8423901bf6\",\n \"marketId\": \"gid://shopify/Market/128989799\"\n }\n ]\n }\n}'\n", "remix_example": "const { admin } = await authenticate.admin(request);\n\nconst response = await admin.graphql(\n `#graphql\n mutation translationsRegister($resourceId: ID!, $translations: [TranslationInput!]!) {\n translationsRegister(resourceId: $resourceId, translations: $translations) {\n userErrors {\n message\n field\n }\n translations {\n key\n value\n market {\n id\n name\n }\n }\n }\n }`,\n {\n variables: {\n \"resourceId\": \"gid://shopify/Product/20995642\",\n \"translations\": [\n {\n \"locale\": \"en\",\n \"key\": \"title\",\n \"value\": \"Canadian element\",\n \"translatableContentDigest\": \"4e5b548d6d61f0006840aca106f7464a4b59e5a854317d5b57861b8423901bf6\",\n \"marketId\": \"gid://shopify/Market/128989799\"\n }\n ]\n },\n },\n);\n\nconst data = await response.json();\n", "ruby_example": "session = ShopifyAPI::Auth::Session.new(\n shop: \"your-development-store.myshopify.com\",\n access_token: access_token\n)\nclient = ShopifyAPI::Clients::Graphql::Admin.new(\n session: session\n)\n\nquery = <<~QUERY\n mutation translationsRegister($resourceId: ID!, $translations: [TranslationInput!]!) {\n translationsRegister(resourceId: $resourceId, translations: $translations) {\n userErrors {\n message\n field\n }\n translations {\n key\n value\n market {\n id\n name\n }\n }\n }\n }\nQUERY\n\nvariables = {\n \"resourceId\": \"gid://shopify/Product/20995642\",\n \"translations\": [{\"locale\"=>\"en\", \"key\"=>\"title\", \"value\"=>\"Canadian element\", \"translatableContentDigest\"=>\"4e5b548d6d61f0006840aca106f7464a4b59e5a854317d5b57861b8423901bf6\", \"marketId\"=>\"gid://shopify/Market/128989799\"}]\n}\n\nresponse = client.query(query: query, variables: variables)\n", "node_example": "const client = new shopify.clients.Graphql({session});\nconst data = await client.query({\n data: {\n \"query\": `mutation translationsRegister($resourceId: ID!, $translations: [TranslationInput!]!) {\n translationsRegister(resourceId: $resourceId, translations: $translations) {\n userErrors {\n message\n field\n }\n translations {\n key\n value\n market {\n id\n name\n }\n }\n }\n }`,\n \"variables\": {\n \"resourceId\": \"gid://shopify/Product/20995642\",\n \"translations\": [\n {\n \"locale\": \"en\",\n \"key\": \"title\",\n \"value\": \"Canadian element\",\n \"translatableContentDigest\": \"4e5b548d6d61f0006840aca106f7464a4b59e5a854317d5b57861b8423901bf6\",\n \"marketId\": \"gid://shopify/Market/128989799\"\n }\n ]\n },\n },\n});\n", "php_example": "use Shopify\\Clients\\Graphql;\n\n$client = new Graphql(\"your-development-store.myshopify.com\", $accessToken);\n$query = <<<QUERY\n mutation translationsRegister($resourceId: ID!, $translations: [TranslationInput!]!) {\n translationsRegister(resourceId: $resourceId, translations: $translations) {\n userErrors {\n message\n field\n }\n translations {\n key\n value\n market {\n id\n name\n }\n }\n }\n }\nQUERY;\n\n$variables = [\n \"resourceId\" => \"gid://shopify/Product/20995642\",\n \"translations\" => [{\"locale\"=>\"en\", \"key\"=>\"title\", \"value\"=>\"Canadian element\", \"translatableContentDigest\"=>\"4e5b548d6d61f0006840aca106f7464a4b59e5a854317d5b57861b8423901bf6\", \"marketId\"=>\"gid://shopify/Market/128989799\"}],\n];\n\n$response = $client->query([\"query\" => $query, \"variables\" => $variables]);\n" }, "titleStringKey": "variables", "inputVariableEntries": [ { "arg": { "name": "resourceId", "description": "ID of the resource that is being translated.", "type": { "kind": "SCALAR", "name": "ID", "list": false, "non_null": true }, "defaultValue": null, "typeSignature": "ID!", "isDeprecated": false, "deprecationReason": null, "kind": "ARGUMENT" }, "key": "resourceId", "argValue": " \"gid://shopify/Product/20995642\"", "typeKind": "MUTATION" }, { "arg": { "name": "translations", "description": "Specifies the input fields for a translation.", "type": { "kind": "INPUT_OBJECT", "name": "TranslationInput", "list": true, "non_null": true }, "defaultValue": null, "typeSignature": "[TranslationInput!]!", "isDeprecated": false, "deprecationReason": null, "kind": "ARGUMENT" }, "key": "translations", "argValue": " [{\"locale\":\"en\",\"key\":\"title\",\"value\":\"Canadian element\",\"translatableContentDigest\":\"4e5b548d6d61f0006840aca106f7464a4b59e5a854317d5b57861b8423901bf6\",\"marketId\":\"gid://shopify/Market/128989799\"}]", "typeKind": "MUTATION" } ] } ]