Skip to content

About Translate

Access scope

Multiple access scopes needed — refer to each endpoint for access scope requirements.

Translation Service is a core component of the Genstore platform, providing powerful business data translation capabilities. Through translation services, business systems can support multi-language data translation, ensuring that business data is accurately converted into different target languages.

Core Functions

  • Translate data: Retrieve the business data, translate it into the target language, and then write the translated data back into the business system.

Usage Scenarios

  • Store Language Addition: When a user adds a new language in the store's backend, the system can translate the existing business data into the newly added language.

Endpoints

POST /api/202412/translate: Translate all data

POST /api/202412/translate/{domainName}/{bizId}: Translation specified data

PUT /api/202412/translate/business/{domainName}: Save translated business data

GET /api/202412/translate/languages: Get language list

GET /api/202412/translate/business/{domainName}: Get translatable business data

GET /api/202412/translate/business: Get translatable business types

Translate Object

The translate object.

Properties

translateobjectrequired
Translate the task information.
- Hide child properties
targetLanguagestringrequired
Target language for translation.
completionStatusnumberrequired
The state of translation completion. Enumeration value: untranslated -0; Translation -1; Completed -2; Task exception -3.
bash
{
  "translate": {
    "targetLanguage": "en-us",
    "completionStatus": "1"
  }
}

POST Translate all data

Translate the entire business data, and after translation, the translated results will be written back to the business system for storage.

Access scope

Requires ANY of the following access scopes: write_translate

Endpoint

POST /api/202412/translate 

Request Params

targetLanguagestringrequired
Target language for translation.

Response Data

translateobjectrequired
Translate the task information of all data.
- Hide child properties
targetLanguagestringrequired
Target language for translation.
completionStatusbooleanrequired
The state of translation completion. Enumeration value: untranslated -0; Translation -1; Completed -2; Task exception -3.
bash
curl -X POST \ 
https://{shop}.genmystore.com/api/202412/translate" \ 
-H "X-Genstore-Access-Token: {access_token}" \ 
-H "Content-Type: application/json" \ 
-d '{
	"targetLanguage":"en-us"
}'
json
HTTP/1.1 200 OK
{
  "translate": {
    "targetLanguage": "en-us",
    "completionStatus": "1"
  }
}

POST Translation specified data

Translate the specified business data, and after translation, the translated results will be written back to the business system for storage.

Access scope

Requires ANY of the following access scopes: write_translate

Endpoint

POST /api/202412/translate/{domainName}/{bizId} 

Request Params

targetLanguagestringrequired
Target language for translation.
bizIdstringrequired
Unique identifiers of business data.

Response Data

translateobjectrequired
- Hide child properties
bizIdstringrequired
Unique identifiers of business data.
bizDataListarrayrequired
Content of business data
+ Show child properties
bash
curl -X POST \ 
https://{shop}.genmystore.com/api/202412/translate/{domainName}/{bizId}" \ 
-H "X-Genstore-Access-Token: {access_token}" \ 
-H "Content-Type: application/json" \ 
-d '{
	"targetLanguage":"en-us",
	"bizId":"100001"
}'
json
HTTP/1.1 200 OK
{
  "translate": {
    "bizId": "100001",
    "bizDataList": [
      {
        "reference": "苹果",
        "fieldName": "goodsName",
        "targetVal": "apple"
      }
    ]
  }
}

PUT Save translated business data

After the business data is translated into the target language, the translated data is saved through this api.

Access scope

Requires ANY of the following access scopes: write_translate

Endpoint

PUT /api/202412/translate/business/{domainName} 

Request Params

targetLanguagestringrequired
Target language for translation.
listarrayrequired
List of business data, maximum 50 items.
+ Show child properties

Response Data

businessarrayrequired
Business data object.
- Hide child properties
bizIdstringrequired
Unique identifier of business data.
bizDataListarrayrequired
Content of business data list.
+ Show child properties
bash
curl -X PUT \ 
https://{shop}.genmystore.com/api/202412/translate/business/{domainName}" \ 
-H "X-Genstore-Access-Token: {access_token}" \ 
-H "Content-Type: application/json" \ 
-d '{
	"targetLanguage":"en",
	"list":[
		{
			"bizId":"100001",
			"bizDataList":[
				{
					"reference":"苹果",
					"targetVal":"apple",
					"extraTransData":"flag1",
					"fieldKey":"goodsName",
					"subBizDataList":[
						{
							"targetVal":"blue",
							"extraTransData":"flag1",
							"fieldKey":"goodsColor"
						}
					]
				}
			]
		}
	]
}'
json
HTTP/1.1 200 OK
{
  "business": [
    {
      "bizId": "100001",
      "bizDataList": [
        {
          "reference": "苹果",
          "fieldName": "goodsName",
          "targetVal": "apple"
        }
      ]
    }
  ]
}

GET Get language list

Get a list of languages supported by the store.

Access scope

Requires ANY of the following access scopes: read_translate

Endpoint

GET /api/202412/translate/languages 

Request Params

{}

Response Data

languagesobjectrequired
List of languages.
- Hide child properties
publishedListarrayrequired
List of published languages.
+ Show child properties
unPublishedListarrayrequired
List of unpublished languages.
+ Show child properties
bash
curl -X GET \ 
https://{shop}.genmystore.com/api/202412/translate/languages" \ 
-H "X-Genstore-Access-Token: {access_token}" \
json
HTTP/1.1 200 OK
{
  "languages": {
    "publishedList": [
      {
        "translateStatus": "true",
        "isDefault": "true",
        "name": "en-us",
        "language": "en-us",
        "marketNameList": [
          "marketA"
        ]
      }
    ],
    "unPublishedList": [
      {
        "translateStatus": "false",
        "isDefault": "false",
        "name": "zh-cn",
        "language": "zh-cn",
        "marketNameList": [
          "marketB"
        ]
      }
    ]
  }
}

GET Get translatable business data

Retrieves a list of data that the business module needs to translate.

Access scope

Requires ANY of the following access scopes: read_translate

Endpoint

GET /api/202412/translate/business/{domainName} 

Request Params

queryParameterstring
Query parameters of business data.
idsnumber
Unique identifiers of business data. Different business data identifiers are separated by commas (,).
targetLanguagestringrequired
Target language for translation.
limitnumberrequired
Query limit: The default is 50, and the maximum allowed is 250.
pageTokenstring
The encrypted request parameter used for pagination (previous page, next page). The corresponding page data can be accessed by parsing this field.

Response Data

businessobjectrequired
The object of business data.
- Hide child properties
totalnumberrequired
Total number of business data.
listarrayrequired
The list of business data.
+ Show child properties
bash
curl -X GET \ 
https://{shop}.genmystore.com/api/202412/translate/business/{domainName}" \ 
-H "X-Genstore-Access-Token: {access_token}" \
json
HTTP/1.1 200 OK
{
  "business": {
    "total": "10000",
    "list": [
      {
        "bizName": "Foxconn",
        "bizId": "100001",
        "bizDataList": [
          {
            "reference": "苹果",
            "groupName": "Product Options",
            "fieldName": "goodsName",
            "targetVal": "apple",
            "titleName": "collection1",
            "extraTransData": "flag1",
            "richText": "false"
          }
        ],
        "bizImg": "data:image/png;base64,iVBORw0KGgoAAAANSUhEUgAAAEUAAABFCAYAAAAcjSspAAAAAXNSR0IArs4c6QAAAARnQU1BAACxjwv8YQUAAAAJcEhZcwAAEnQAABJ0Ad5mH3gAAAH2SURBVHhe7ZjNjcIwEEa3Hi5bBRUg0QA1cKIAyoALfbCiEqAQLyQT1iQvXv+QQKTvSXMIINvzMp44fDnRQVIASQEkBZAUQFIASQEkBZAUQFIASQEkBZAUQFIASQEkBZAUQFKA90o5bt3se+7WR7v+EJKk/GzmbrY52dULGEDKdb9ys+XBXe06hwQp59uEdRKL/dk+K2QIKbcxF7cxS27esxRbZGlEJ5kj5XKoky6Krfux4QiQsnK7i12nYgseQ8orq6tNj5Sz2y3JcCDu+3hkKVX/aOaPinCFNCQ12pczRKX0fF8LLJViC46NbvM9uTX8Li+8ZN4vJaa/1MlnPZEKKqUrLi1Ccw5YKRFMc/t8bqW8R8oYZEupb9aIT5+SBpl4xsmR4lVwJaV9pLdKaZ9oG4Exc/VKwe0QKt3o7eaRIaW9Dar3Mb8CmjVubD1Hk9RExHvR5CqlktBK7PGi2lSJjdlUR2q/m1il8NoevYVO1TZHbD+5My0pT3N4ryJ+/8A1er/9hO1T7/mC8BL++z+nThJvXFC05faPmLRKCZFTKUnc19Uzvol4REQ1hAApQlIASQEkBZAUQFIASQEkBZAUQFIASQEkBZAUQFIASQEkBZAUQFIASQEkBZAUQFIASQEkBZAUQFIASQEkBZAUQFIASQEkpYNzv/VNGFHwk0kpAAAAAElFTkSuQmCC"
      }
    ]
  }
}

GET Get translatable business types

Get the business categories the store supports for translation.

Access scope

Requires ANY of the following access scopes: read_translate

Endpoint

GET /api/202412/translate/business 

Request Params

{}

Response Data

businessarrayrequired
Types of business.
- Hide child properties
namestringrequired
The name of the business type.
sortnumberrequired
Business categories are displayed in order, with the lowest value first.
childarrayrequired
The secondary category of the business type.
+ Show child properties
bash
curl -X GET \ 
https://{shop}.genmystore.com/api/202412/translate/business" \ 
-H "X-Genstore-Access-Token: {access_token}" \
json
HTTP/1.1 200 OK
{
  "business": [
    {
      "name": "Settings",
      "sort": "0",
      "child": [
        {
          "domainName": "notifactions",
          "name": "Notifications",
          "sort": "0",
          "queryParameter": [
            {
              "name": "上架",
              "value": "active",
              "key": "status"
            }
          ]
        }
      ]
    }
  ]
}