Skip to content
New Webhooks added: Inventory and Order modifications. Check the changelog →
Cartly Developers

Translations & Localization

Translate your store content into 15 languages using the Admin Translations API with optional AI-powered auto-translate.

Overview

Cartly uses two complementary translation layers:

  • DB Entity Translations — per-entity, per-locale strings stored in the translation table. Covers products, collections, pages, articles, menus, and metafields.
  • Static Locale Files — storefront UI strings compiled into locales/*.json and rendered via the {{ ' key' | t }} Liquid filter. Managed per-theme.

Entity Translations API

Use the Translations API to read and write translated content for any entity. All endpoints require admin JWT authentication.

MethodPathDescription
GET/admin/translations/:type/:entityIdGet all locales for an entity
GET/admin/translations/:type/:entityId/:localeGet translations for one locale
PUT/admin/translations/:type/:entityId/:localeSave specific field translations
DELETE/admin/translations/:type/:entityId/:localeDelete a locale translation
POST/admin/translations/auto-translateAI auto-translate one field for one entity+locale

Supported Entity Types

product, variant, collection, page, article, menu, metafield

GET /admin/translations/product/:entityId/:locale

bash
curl -X GET "https://cartly.pro/admin/translations/product/PRODUCT_ID/de" \
  -H "Authorization: Bearer ADMIN_JWT"

# Response
# {
#   "locale": "de",
#   "fields": {
#     "title": "Klassisches T-Shirt",
#     "description": "Ein bequemes Baumwoll-T-Shirt"
#   }
# }

PUT /admin/translations/:type/:entityId/:locale

bash
curl -X PUT "https://cartly.pro/admin/translations/product/PRODUCT_ID/de" \
  -H "Authorization: Bearer ADMIN_JWT" \
  -H "Content-Type: application/json" \
  -d '{
    "title": "Klassisches T-Shirt",
    "description": "Ein bequemes Baumwoll-T-Shirt in mehreren Farben"
  }'

AI Auto-Translate

The POST /admin/translations/auto-translate endpoint uses the platform AI to translate or generate the chosen fields into each target locale and saves the result.

Request Body

FieldTypeDescription
entity_typestringproduct, collection, page or article
entity_idstring (UUID)Target entity ID
target_localesstring[]Target locales (e.g. ["de", "fr"]); the source locale is skipped
fieldsstring[]title, description, meta_title, meta_description, body_html
source_localestringOptional; defaults to the primary market's locale
modestringtranslate (preserve meaning) or generate (SEO-optimized)

Billing

AI translation uses the plan's AI credits, charged per locale by the AI's actual usage. Refusals return 402:

  • ai_plan_required — AI features require a paid plan
  • ai_credits_exhausted — this month's AI credits are used up; the body has resets_at and topup_url

503 means AI translation is temporarily unavailable. A locale that could not be translated carries an error in the response and nothing is saved for it.

Audit Logging

Every call is recorded in the shop's audit log with the entity, locales and AI credits charged; every model call is recorded in ai_audit_logs with token count and latency.

POST /admin/translations/auto-translate

bash
curl -X POST "https://cartly.pro/admin/translations/auto-translate" \
  -H "Authorization: Bearer ADMIN_JWT" \
  -H "Content-Type: application/json" \
  -d '{
    "entity_type": "product",
    "entity_id": "PRODUCT_UUID",
    "target_locales": ["de"],
    "fields": ["title"],
    "mode": "translate"
  }'

# Response — translations are saved; a locale that failed carries "error"
# { "data": [{ "locale": "de", "translations": { "title": "Klassisches T-Shirt" } }], "credits_milli": 120 }

Integration Workflow

  1. Fetch existing product: GET /admin/products/:id
  2. Translate and save fields: POST /admin/translations/auto-translate with mode: translate
  3. Adjust a translation by hand: PUT /admin/translations/product/:id/:locale
  4. Storefront automatically serves translated content when the Accept-Language or market locale matches

Supported Locales

Built-in storefront locales: en, ru, de, fr, es, uk. Additional AI-translation targets: zh, ja, ko, ar, pt, it, nl, pl, tr.