Concepts
Localization
How locale arrays and the locales query parameter work in the DTPR API.
Localization
All user-facing text in the DTPR API is returned as locale arrays — arrays of objects containing a language code and the localized string value.
Locale array format
Every text field (titles, descriptions, prompts, labels, etc.) follows this pattern:
[
{ "locale": "en", "value": "Technology" },
{ "locale": "fr", "value": "Technologie" },
{ "locale": "es", "value": "Tecnolog\u00eda" }
]
Each object has:
locale— A language or region code (e.g.,en,fr,es,km,pt,tl,fr-CA)value— The localized text string
Available locales
The DTPR taxonomy currently includes content in these locales:
| Code | Language |
|---|---|
en | English |
fr | French |
es | Spanish |
pt | Portuguese |
tl | Tagalog |
km | Khmer |
Filtering with the locales parameter
All API endpoints accept an optional locales query parameter:
GET /api/dtpr/v1/elements?locales=en
GET /api/dtpr/v1/elements?locales=en,fr
GET /api/dtpr/v1/categories/device?locales=en,es
When provided, the API filters all locale arrays in the response to include only the requested locales. This affects:
- Element
title,description,citation - Element
icon.alt_text - Element variable
labelarrays - Category
name,description,prompt - Category
element_variables[].labelarrays
When omitted, all available locales are returned.
Implementation notes
- Locale codes are matched exactly —
enwill not matchen-US - If a requested locale doesn't exist for a field, that field's array will be empty
- The
localesparameter accepts a comma-separated list with no spaces