---
title: "translatableResource"
description: "查询店铺的翻译语料。"
doc_type: graphql
doc_category: adminGraphQL
doc_version: v20270301
source_url:
  html: 'https://developer.shopline.com/zh-hans-cn/docs/admin-graph-ql-api/localizations/queries/translatable-resource'
  md: 'https://developer.shopline.com/zh-hans-cn/docs/admin-graph-ql-api/localizations/queries/translatable-resource.md'
---
# translatableResource

查询店铺的翻译语料。

- **Required Scopes:** `read_translation`
- **API Version:** v20270301
- **API Type:** Admin
- **API Protocol:** GraphQL
- **Operation Type:** Query

## Required Permissions

* `read_translation`

接口访问需要令牌，具体如何获取令牌请参考：[身份认证](https://developer.shopline.com/zh-hans-cn/docs/apps/api-instructions-for-use/graph-ql-admin-api/overview.md)

## Arguments

* `resourceId`

  [ID!](https://developer.shopline.com/zh-hans-cn/docs/admin-graph-ql-api/common/scalars/id.md)

  资源的唯一标识符。<br></br>样例：商品 ID： `16057169190700063316363001`。

## Returns

* `resourceId`

  [ID!](https://developer.shopline.com/zh-hans-cn/docs/admin-graph-ql-api/common/scalars/id.md)

  资源的唯一标识符。<br></br>样例：商品 ID：`16057169190700063316363001`。

* `translations`

  [[Translation]](https://developer.shopline.com/zh-hans-cn/docs/admin-graph-ql-api/localizations/objects/translation.md)

  可被翻译的内容。

* `translatableContent`

  [[TranslatableContent!]!](https://developer.shopline.com/zh-hans-cn/docs/admin-graph-ql-api/localizations/objects/translatable-content.md)

  资源对应的翻译语料内容。

## Examples

### 查询店铺下指定资源 ID 、市场 ID 、语言下的原始语料和翻译语料。

查询店铺下指定资源 ID 、市场 ID 、语言下的原始语料和翻译语料。

**Request:**

```json
query MyQuery {
  translatableResource(resourceId: "gid://shopline/Product/12259794083525432746782293") {
    resourceId
    translatableContent {
      digest
      key
      locale
      type
      value
    }
    translations(locale: "en", marketId: "2805979406510623080534") {
      key
      locale
      market {
        id
      }
      outdated
      updatedAt
      value
    }
  }
}
```

**Response:**

```json
{
  "data": {
    "data": {
      "translatableResource": {
        "resourceId": "gid://shopline/Product/12259794083525432746782293",
        "translatableContent": [
          {
            "type": "STRING",
            "value": "title",
            "digest": "361af515d4e29f4a80ac9f8702ab703b",
            "key": "title",
            "locale": "DEFAULT"
          }
        ],
        "translations": [
          {
            "market": {
              "id": "2805979406510623080534"
            },
            "outdated": false,
            "type": "STRING",
            "updatedAt": "2025-01-05T00:00:00.492Z",
            "value": "desc",
            "key": "title",
            "locale": "en"
          }
        ]
      }
    }
  }
}
```

### 查询店铺下指定资源 ID 、市场 ID 、语言且翻译语料已过时对应的原始语料和翻译语料。

查询店铺下指定资源 ID 、市场 ID 、语言且翻译语料已过时对应的原始语料和翻译语料。

**Request:**

```json
query MyQuery {
  translatableResource(resourceId: "gid://shopline/Product/12259794083525432746782293") {
    resourceId
    translatableContent {
      digest
      key
      locale
      type
      value
    }
    translations(locale: "en", outdated: true, marketId: "2805979406510623080534") {
      key
      locale
      market {
        id
      }
      outdated
      updatedAt
      value
    }
  }
}
```

**Response:**

```json
{
  "data": {
    "data": {
      "translatableResource": {
        "resourceId": "gid://shopline/Product/12259794083525432746782293",
        "translatableContent": [
          {
            "digest": "361af515d4e29f4a80ac9f8702ab703b",
            "key": "title",
            "locale": "DEFAULT",
            "type": "STRING",
            "value": "title"
          }
        ],
        "translations": [
          {
            "market": {
              "id": "2805979406510623080534"
            },
            "outdated": true,
            "type": "STRING",
            "updatedAt": "2025-01-05T00:00:00.492Z",
            "value": "desc",
            "key": "title",
            "locale": "en"
          }
        ]
      }
    }
  }
}
```

### 查询店铺下指定资源 ID 、语言下默认市场的原始语料和翻译语料。

查询店铺下指定资源 ID 、语言下默认市场的原始语料和翻译语料。

**Request:**

```json
query MyQuery {
  translatableResource(resourceId: "gid://shopline/Product/12259794083525432746782293") {
    resourceId
    translatableContent {
      digest
      key
      locale
      type
      value
    }
    translations(locale: "en") {
      key
      locale
      market {
        id
      }
      outdated
      updatedAt
      value
    }
  }
}
```

**Response:**

```json
{
  "data": {
    "data": {
      "translatableResource": {
        "resourceId": "gid://shopline/Product/12259794083525432746782293",
        "translatableContent": [
          {
            "key": "title",
            "locale": "DEFAULT",
            "type": "STRING",
            "value": "title",
            "digest": "361af515d4e29f4a80ac9f8702ab703b"
          }
        ],
        "translations": [
          {
            "key": "title",
            "locale": "en",
            "market": {
              "id": "2805979406510623080534"
            },
            "outdated": false,
            "type": "STRING",
            "updatedAt": "2025-01-05T00:00:00.492Z",
            "value": "desc"
          }
        ]
      }
    }
  }
}
```

## Error Handling

关于更多通用错误码说明，参考：[状态码和错误码](https://developer.shopline.com/zh-hans-cn/docs/apps/api-instructions-for-use/graph-ql-admin-api/overview.md#status-and-error-codes)。

