|
Knowledgebase
EnterprisePlatform
PlatformAPI
React (MCP)React (Lingo Compiler)
Alpha
CLIIntegrations
GuidesChangelog

Synchronous

  • How it works
  • Localize
  • Recognize
  • ProvisionEnterprise

AsynchronousEnterprise

  • How it works
  • Queue
  • Webhooks
  • WebSocket

Localize

Max PrilutskiyMax Prilutskiy·Updated 1 day ago·3 min read

Translates a set of key-value pairs from one locale to another using a configured localization engine.

Request#

text
POST /process/localize
ParameterTypeDescription
engineIdstring (optional)The localization engine ID (eng_...). Uses the default engine if omitted.
sourceLocalestringBCP-47 source locale (e.g., en)
targetLocalestringBCP-47 target locale (e.g., de)
dataobjectKey-value pairs to translate
json
{
  "engineId": "eng_abc123",
  "sourceLocale": "en",
  "targetLocale": "de",
  "data": {
    "greeting": "Hello, world!",
    "cta": "Get started"
  }
}

Response#

Returns the same structure with translated values.

json
{
  "sourceLocale": "en",
  "targetLocale": "de",
  "data": {
    "greeting": "Hallo, Welt!",
    "cta": "Jetzt starten"
  }
}

Examples#

javascript
const response = await fetch(
  "https://api.lingo.dev/process/localize",
  {
    method: "POST",
    headers: {
      "X-API-Key": "your_api_key",
      "Content-Type": "application/json",
    },
    body: JSON.stringify({
      engineId: "eng_abc123",
      sourceLocale: "en",
      targetLocale: "de",
      data: {
        greeting: "Hello, world!",
        cta: "Get started",
      },
    }),
  }
);

const { data } = await response.json();
// { greeting: "Hallo, Welt!", cta: "Jetzt starten" }

What happens during localization#

When a request hits the localize endpoint, the engine applies its full configuration:

  1. Model selection - Selects the highest-priority LLM model matching the locale pair. Locale-specific models take precedence over wildcard (*) models. If the primary model fails, the engine falls through to the next ranked model automatically.

  2. Brand voice - Loads the brand voice for the target locale (falls back to the wildcard brand voice if no locale-specific one exists).

  3. Instructions - Loads all instructions matching the target locale, including wildcard instructions.

  4. Glossary lookup - Splits input values into searchable chunks, generates embeddings, and performs a vector similarity search against the engine's glossary. Matched terms enforce exact translations or mark terms as non-translatable.

  5. Generation - Sends the composed prompt to the selected model. Parses and validates the JSON response.

Fallback behavior

If the primary model fails, the engine automatically attempts the next model in rank order. This happens transparently - the response includes the same structure regardless of which model produced it.

Next Steps#

Recognize
Detect the language of arbitrary text
LLM Models
Configure per-locale model selection and fallback chains
Glossaries
Map source terms to exact translations per locale
Brand Voices
Define how your product speaks in each language

Was this page helpful?