|
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

Recognize

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

Detects the language of a given text and returns structured locale metadata.

Request#

text
POST /process/recognize
ParameterTypeDescription
textstringThe text to analyze
labelLocalestring (optional)Locale for the human-readable label (default: en)
json
{
  "text": "Bonjour le monde",
  "labelLocale": "en"
}

Response#

json
{
  "locale": "fr",
  "language": "fr",
  "region": null,
  "script": null,
  "label": "French",
  "direction": "ltr"
}
FieldTypeDescription
localestringBCP-47 locale code at the most specific level of confidence
languagestringISO 639 language subtag
regionstring | nullISO 3166 region subtag, or null if indistinguishable
scriptstring | nullISO 15924 script subtag, or null if default for the language
labelstringHuman-readable locale name in the requested labelLocale
direction"ltr" | "rtl"Text direction

Examples#

javascript
const response = await fetch(
  "https://api.lingo.dev/process/recognize",
  {
    method: "POST",
    headers: {
      "X-API-Key": "your_api_key",
      "Content-Type": "application/json",
    },
    body: JSON.stringify({
      text: "Bonjour le monde",
      labelLocale: "en",
    }),
  }
);

const result = await response.json();
// { locale: "fr", language: "fr", label: "French", direction: "ltr", ... }

When regional markers are present in the text (e.g., Brazilian Portuguese vocabulary), the response includes the full tag (pt-BR). When the regional variant is indistinguishable, only the language subtag is returned (pt).

Next Steps#

Localize
Translate key-value pairs through a configured localization engine
Provision
Create and configure localization engines programmatically
API Keys
Generate and manage API keys for your organization

Was this page helpful?