翻译注册-translationsRegister mutation

创建或更新翻译。

所需的访问

write_translations 访问范围。


在本页面


互动范例

这是一个示例变异查询。

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>
] }

参数

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

必需的
可翻译资源的ID。
translations
() [[TranslationInput!]!](https://shopify.dev/docs/admin-api/graphql/reference/translations/translationinput)

必需的
指定翻译的输入字段。

TranslationInput字段

  • key[String!](https://shopify.dev/docs/admin-api/graphql/reference/scalar#string-2021-01)必需的
    翻译的关键。
  • locale[String!](https://shopify.dev/docs/admin-api/graphql/reference/scalar#string-2021-01)必需的
    翻译的语言环境。
  • translatableContentDigest[String!](https://shopify.dev/docs/admin-api/graphql/reference/scalar#string-2021-01)必需的
    正在翻译的内容的摘要(哈希)。
  • value[String!](https://shopify.dev/docs/admin-api/graphql/reference/scalar#string-2021-01)必需的
    翻译的价值。

返回字段

  • translations[[Translation!]](https://shopify.dev/docs/admin-api/graphql/reference/translations/translation)
    创建或更新的翻译。
  • userErrors[[TranslationUserError!]!](https://shopify.dev/docs/admin-api/graphql/reference/translations/translationusererror)
    执行突变时发生的错误列表。