Skip to content

Pet profile language and locale ​

locale is a request-level display language and is never written permanently to a pet profile. It only affects display fields that the platform has already localized; currently that means breed_display_name explicitly.

Currently Supported Languages

Currently, pet profiles only support the following two languages:

  • zh-CN (Simplified Chinese, default)
  • en-US (English)

Rules at a glance ​

RuleDescription
Defaultzh-CN.
Supported languagesOnly zh-CN (Simplified Chinese) and en-US (English) are supported.
FormatFull BCP 47: lowercase language, uppercase region (e.g. zh-CN, en-US).
A correct format is not enoughThe language must be enabled in the current environment; when a breed_code is present, that breed must also already have a translation for the language.
No silent fallbackWhen an unsupported language is requested or a translation is missing, a business error is returned; it never quietly switches to Chinese and never returns an empty display name.
No automatic translationRaw business text such as name, pet_variety, and the title / content of extension records is returned unchanged.

Endpoints that support locale ​

EndpointEffect
POST /pet-profiles?locale=...Returns breed_display_name in that language after creation.
GET /pet-profiles?locale=...Localizes the breed display name in the list.
GET /pet-profiles/{pet_profile_id}?locale=...Localizes the breed display name in the detail response.
PATCH /pet-profiles/{pet_profile_id}?locale=...Returns the breed display name in that language after the update.

Examples ​

Examples are based on the same profile (the gateway base URL is https://open-api.habitaxx.com/v1/ms-ai-fast):

json
{
  "id": 44,
  "name": "团子",
  "pet_type": 2,
  "breed_code": "dog.shiba-inu",
  "pet_variety": "柴犬",
  "weight": "10.10kg"
}

1. Simplified Chinese GET /pet-profiles/44?locale=zh-CN ​

json
{
  "code": 200,
  "message": "success",
  "data": {
    "id": 44,
    "name": "团子",
    "pet_type": 2,
    "breed_code": "dog.shiba-inu",
    "breed_display_name": "柴犬",
    "pet_variety": "柴犬",
    "weight": "10.10kg",
    "locale": "zh-CN"
  }
}

2. English GET /pet-profiles/44?locale=en-US ​

When en-US is correctly formatted and the breed already has an English translation:

json
{
  "code": 200,
  "message": "success",
  "data": {
    "id": 44,
    "name": "团子",
    "pet_type": 2,
    "breed_code": "dog.shiba-inu",
    "breed_display_name": "Shiba Inu",
    "pet_variety": "柴犬",
    "weight": "10.10kg",
    "locale": "en-US"
  }
}

name: "团子" and pet_variety: "柴犬" stay unchanged: when multilingual pet nicknames or custom breed text are needed, the integrator maintains the corresponding business fields; do not rely on locale for automatic translation.

Common errors and handling ​

SituationExampleHandling
Malformed languagezh-cn, en-usA format validation error is returned; correct the casing per BCP 47 and retry.
Unsupported / not enabled languageAny language other than zh-CN or en-USA business error is returned; do not expect an automatic fallback to zh-CN.
Breed translation missingen-US is specified, but there is no English translation for that breed_codeA business error is returned; add the translation before calling again.
Expecting user text to be translatedname, pet_variety, title, contentNot translated; the original value submitted by the caller is always returned.
最近更新

Qijie Open Platform · API Documentation