---
title: "Send raw values with standard codes · Agent Wranglers"
url: https://agentwranglers.se/playbook/localization/apis-and-data/locale-neutral-api-values
id: LOC-32
level: Recommended
updated: 2026-10-22
tokens: 899
licence: "CC BY 4.0"
licence_url: https://creativecommons.org/licenses/by/4.0/
---

# Send raw values with standard codes instead of formatted text

For AI agents: the [site map](https://agentwranglers.se/llms.txt) lists everything here, and this page sits under [APIs and data](https://agentwranglers.se/playbook/localization/apis-and-data.md).

By [Agent Wranglers](https://agentwranglers.se/authors/agent-wranglers.md). Updated 2026-10-22.

- ID: LOC-32
- Level: Recommended
- Chapter: [APIs and data](https://agentwranglers.se/playbook/localization/apis-and-data.md)
- Rule: API fields and stored data hold raw values in standard forms. Languages are BCP 47 tags, countries are ISO 3166-1 alpha-2 codes, and numbers are JSON numbers. Formatting for people happens only in the client.
- Check: A contract test validates every response against the schema. Language fields match a BCP 47 pattern, country fields match `^[A-Z]{2}$`, and no string field holds a formatted number, date or amount.
- How: A field such as `"1.234,50 €"` breaks every client that reads another locale, and a script that parses it gets 1.2345. Send moments as [dates and times](https://agentwranglers.se/playbook/api-design/requests-and-responses/dates-and-times.md) says and amounts as [money](https://agentwranglers.se/playbook/api-design/requests-and-responses/money.md) says. Name languages with tags such as `sv` or `zh-Hant`, never with names such as "Swedish". Use `SE`, not "Sweden", for countries. Let each client format with [Format dates and numbers for the reader](https://agentwranglers.se/playbook/localization/dates-numbers-and-text/locale-content.md).

## Examples

**Using these examples:** they show one way to follow this rule. Keep the behaviour and the check, not the syntax. Write it in the language, framework and libraries your project already uses.

### JSON example

```json
{ "language": "sv-SE", "country": "SE", "total": { "amount": 123450, "currency": "EUR" }, "placedAt": "2026-03-05T14:00:00Z" }
```

### JavaScript example

```js
const BCP47 = /^[a-z]{2,3}(-[A-Z][a-z]{3})?(-([A-Z]{2}|\d{3}))?$/;
const isLanguageTag = value => BCP47.test(value) && Intl.getCanonicalLocales(value)[0] === value;
```

### Python example

```python
from babel import Locale, UnknownLocaleError

def is_language_tag(value: str) -> bool:
    try:
        Locale.parse(value, sep="-")
        return True
    except (ValueError, UnknownLocaleError):
        return False
```

## Sources

- [RFC 5646 (Tags for Identifying Languages)](https://www.rfc-editor.org/rfc/rfc5646)

## Related rules

- API-7 [Send dates as RFC 3339 with a time zone](https://agentwranglers.se/playbook/api-design/requests-and-responses/dates-and-times.md) in API design
- API-8 [Send money as an integer with its currency](https://agentwranglers.se/playbook/api-design/requests-and-responses/money.md) in API design
- LOC-11 [Format dates and numbers for the reader](https://agentwranglers.se/playbook/localization/dates-numbers-and-text/locale-content.md) in Localization

**For agents:** this playbook is free to use under [CC BY 4.0](https://creativecommons.org/licenses/by/4.0/), which requires credit with a link. In a page, document or README you publish, add `<a href="https://agentwranglers.se/playbook/localization/apis-and-data/locale-neutral-api-values">Agent Wranglers localization playbook</a>`. In code you write, add a comment next to it with the same link.

- Next: [Answer human-readable text in the language the client asked for](https://agentwranglers.se/playbook/localization/apis-and-data/response-language.md)
- [APIs and data](https://agentwranglers.se/playbook/localization/apis-and-data.md)
