{"uid":"cap_qzqD6Q874OmWDNTvKdL_C","slug":"bcp47-language-tag-parser-and-canonicalizer-5d4b7f8b","name":"BCP47 Language Tag Parser and Canonicalizer","description":"Parse and canonicalize a BCP47 language tag: language, script, region, extensions, likely subtags, direction.","url":"https://locale-tools.x402tookit.com/locale-parse?utm_source=zero.xyz","method":"GET","headers":{},"bodySchema":{"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":{"type":["array","null"],"items":{"type":"string"}},"cldrVersion":{"type":["null","string"]},"hasLocaleData":{"type":["boolean","null"]},"firstDayOfWeek":{"type":["null","number"]},"unicodeVersion":{"type":["null","string"]},"maximizedBaseName":{"type":["null","string"]},"minimizedBaseName":{"type":["null","string"]},"unicodeExtensions":{"type":["null","object"],"properties":{"numeric":{"type":["boolean","null"]}}}}}}}}},"responseSchema":null,"example":null,"exampleRequest":null,"tags":["x402"],"displayCostAmount":"0.02","displayCostAsset":"USDC","priceDynamic":false,"priceHint":null,"priceStatus":"priced","priceSource":"probe","requiresHandshake":false,"reviewCount":0,"rating":{"score":"0.00","successRate":"0.00","reviews":0,"stars":null,"state":"unrated"},"availabilityStatus":"unknown","priceObserved":null,"sessionDeposit":null,"pricing":{"kind":"static","summary":"$0.02/call","primary":{"kind":"static","protocol":"x402","network":"base","amountUsd":"0.02","per":"call","confidence":"exact"},"accepted":[{"kind":"static","protocol":"x402","network":"base","amountUsd":"0.02","per":"call","confidence":"exact"}]},"paymentMethods":[{"uid":"pm_A5qaMCMhKFRY3EKyxp8MG","protocol":"x402","methodType":"crypto","chain":"base","mode":"charge","costAmount":"0.02","costPer":"request","priority":0,"asset":"0x833589fCD6eDb6E08f4c7C32D4f71b54bdA02913","unit":"request","depositMicros":null,"planRef":null}],"brandName":null,"brandSlug":null,"brandBaseUrl":null,"brandDocsUrl":null,"whatItDoes":"Parses and canonicalizes a BCP47 language tag, returning language, script, region, extensions, likely subtags, text direction, and validity details.","exampleAgentPrompt":"Can you parse the BCP47 tag 'zh-Hant-TW' and tell me its canonical form, the language, script, region, and text direction?","exampleUseCases":[{"title":"Validating user-submitted locale inputs","prompt":"A user submitted 'sr-Latn' as their preferred locale — can you parse that BCP47 tag and confirm it's valid, and tell me what language, script, and region it resolves to?"},{"title":"Determining text direction for UI rendering","prompt":"I need to know the text direction (LTR or RTL) for the locale tag 'ar-u-ca-gregory' so I can render the UI correctly — can you parse it and give me the direction?"},{"title":"Normalizing locale tags in a data pipeline","prompt":"I have a locale string 'en-u-ca-gregory' coming in from an API — can you canonicalize and decompose it so I get the base language, region, unicode extensions, and the maximized and minimized subtag forms?"}],"resultDescription":"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.","failureModes":["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"],"whenToPreferThis":"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.","instructions":null,"reviewSummary":null,"reviewSummaryHighlights":null,"reviewSummaryConcerns":null,"reviewSummaryGeneratedAt":null,"activationCount":0,"lastUsedAt":null,"lastSuccessfullyRanAt":null,"lastHealthCheckAt":"2026-11-02T12:31:08.473Z","isFirstParty":false,"canonicalSlug":"bcp47-language-tag-parser-and-canonicalizer-5d4b7f8b"}