# BCP47 Language Tag Parser and Canonicalizer

> BCP47 Language Tag Parser and Canonicalizer is a paid API for AI agents from locale-tools.x402tookit.com, paid per call via x402, $0.02/call, status unknown (last checked 2026-11-02).

Parses and canonicalizes a BCP47 language tag, returning language, script, region, extensions, likely subtags, text direction, and validity details.

## Facts

- Endpoint: GET https://locale-tools.x402tookit.com/locale-parse?utm_source=zero.xyz
- Price: $0.02/call
- Payment: x402
- Status: unknown
- Last checked: 2026-11-02
- Activations on Zero: 0
- Tags: x402
- Canonical page: https://www.zero.xyz/c/bcp47-language-tag-parser-and-canonicalizer-5d4b7f8b
- Structured record (JSON): https://api.zero.xyz/v1/capabilities/cap_qzqD6Q874OmWDNTvKdL_C

Status and success rate cover calls made through Zero and Zero's own probes. Third-party monitors may report differently.

## How to call it through Zero

Zero handles the 402 payment challenge and records the run. With the Zero CLI installed (`npm i -g @zeroxyz/cli`):

```sh
zero fetch --capability bcp47-language-tag-parser-and-canonicalizer-5d4b7f8b
```

Example prompt: Can you parse the BCP47 tag 'zh-Hant-TW' and tell me its canonical form, the language, script, region, and text direction?

## When to prefer this

Choose this endpoint when you need to programmatically parse, validate, or canonicalize a BCP47 language tag and extract its components (language, script, region, direction, likely subtags). It is ideal for i18n pipelines, locale normalization, UI text-direction detection, and verifying user-submitted locale strings. It provides richer output than a simple validator by including ICU/CLDR metadata and unicode extension parsing.

## Known failure modes

- Tag exceeds 60 characters — request rejected
- Malformed or unparseable BCP47 tag — valid:false with reasons array populated
- Unknown or unregistered subtag — may return degraded:true with partial results
- Missing required 'tag' query parameter — error response

## How this service works

Parse and canonicalize a BCP47 language tag: language, script, region, extensions, likely subtags, direction.

## Output

Returns a structured object including the parsed language, script, region, variants, canonical tag, maximized and minimized forms, text direction, first day of week, validity flag, reasons for invalidity, unicode extensions, whether locale data exists, and CLDR/ICU/Unicode version metadata.

## Request schema (JSON Schema)

```json
{
 "type": "object",
 "$schema": "https://json-schema.org/draft/2020-12/schema",
 "required": [
  "input"
 ],
 "properties": {
  "input": {
   "type": "object",
   "required": [
    "type",
    "method"
   ],
   "properties": {
    "type": {
     "type": "string",
     "const": "http"
    },
    "method": {
     "enum": [
      "GET"
     ],
     "type": "string"
    },
    "queryParams": {
     "type": "object",
     "required": [
      "tag"
     ],
     "properties": {
      "tag": {
       "type": "string",
       "description": "BCP47 tag such as zh-TW, en-u-ca-gregory or sr-Latn (up to 60 characters)"
      }
     }
    }
   },
   "additionalProperties": false
  },
  "output": {
   "type": "object",
   "required": [
    "type"
   ],
   "properties": {
    "type": {
     "type": "string"
    },
    "example": {
     "type": "object",
     "properties": {
      "asOf": {
       "type": [
        "null",
        "string"
       ]
      },
      "input": {
       "type": [
        "null",
        "string"
       ]
      },
      "valid": {
       "type": [
        "boolean",
        "null"
       ]
      },
      "region": {
       "type": [
        "null",
        "string"
       ]
      },
      "script": {},
      "source": {
       "type": [
        "null",
        "string"
       ]
      },
      "reasons": {
       "type": [
        "array",
        "null"
       ]
      },
      "summary": {
       "type": [
        "null",
        "string"
       ]
      },
      "verdict": {
       "type": [
        "null",
        "string"
       ]
      },
      "baseName": {
       "type": [
        "null",
        "string"
       ]
      },
      "degraded": {
       "type": [
        "boolean",
        "null"
       ]
      },
      "language": {
       "type": [
        "null",
        "string"
       ]
      },
      "variants": {
       "type": [
        "array",
        "null"
       ]
      },
      "canonical": {
       "type": [
        "null",
        "string"
       ]
      },
      "direction": {
       "type": [
        "null",
        "string"
       ]
      },
      "maximized": {
       "type": [
        "null",
        "string"
       ]
      },
      "minimized": {
       "type": [
        "null",
        "string"
       ]
      },
      "disclaimer": {
       "type": [
        "null",
        "string"
       ]
      },
      "icuVersion": {
       "type": [
        "null",
        "string"
       ]
      },
      "notChecked": {
       "typ
… (truncated)
```

## More

- Live health (JSON, refreshed every minute): https://www.zero.xyz/c/bcp47-language-tag-parser-and-canonicalizer-5d4b7f8b/health.json
- [Zero catalog index](https://www.zero.xyz/llms.txt)
- [Other services from locale-tools.x402tookit.com](https://www.zero.xyz/host/locale-tools.x402tookit.com/llms.txt)
