fittings-lang-bcp47

Compare original and translation side by side

🇺🇸

Original

English
🇨🇳

Translation

Chinese

BCP 47 language tag parse and validate

BCP 47语言标签解析与验证

lang.bcp47
on
https://fittings.sh
. One endpoint, deterministic compute.
Parses a BCP 47 language tag into language, extlang, script, region, variant, extension and private-use subtags, validates each against the IANA registry, and returns the canonical form.
lang.bcp47
部署于
https://fittings.sh
。单端点服务,计算结果确定。
将BCP 47语言标签解析为语言、扩展语言、文字、区域、变体、扩展和私有使用子标签,对照IANA注册表验证每个子标签,并返回规范形式。

The call

调用方式

GET https://fittings.sh/v1/lang/bcp47
FieldTypeRequiredNotes
tag
stringyesLanguage tag, e.g. zh-Hant-HK, at most 100 characters
Example input:
json
{
  "tag": "zh-Hant-HK"
}
GET https://fittings.sh/v1/lang/bcp47
字段类型是否必填说明
tag
string是语言标签,例如 zh-Hant-HK,最多100个字符
示例输入:
json
{
  "tag": "zh-Hant-HK"
}

Cost and provenance

费用与来源

Price$0.003
SourceIANA Language Subtag Registry, parsed per BCP 47 / RFC 5646
Licencepermissive
AttributionSubtag data from the IANA Language Subtag Registry
价格$0.003
数据源IANA语言子标签注册表,依据BCP 47 / RFC 5646解析
许可证宽松许可
归属声明子标签数据来自IANA语言子标签注册表

Why call it rather than answer from memory

为何选择调用该服务而非自行实现

Locale strings arrive from users, feeds and file names, and a wrong one silently mis-routes content rather than failing. Checking a tag properly means holding a 730KB registry and implementing the RFC 5646 grammar; almost nobody does either, so tags like en-UK and zh-CN-Hans ship broken.
区域设置字符串来自用户、数据源和文件名,错误的标签会悄悄导致内容路由错误而非直接失败。正确验证标签需要存储730KB的注册表并实现RFC 5646语法;几乎没人能同时做到这两点,因此像en-UK和zh-CN-Hans这类标签常存在问题。

Calling it

调用指南

A skill is loaded on its own, so this document has to be enough by itself. It does not assume the general
fittings
skill is also loaded.
call.mjs
ships alongside this file; if it is missing (this document reached you without the rest of the skill), fetch it once with
curl -sO https://fittings.sh/skill/call.mjs
.
Free, and needs no wallet. Read the schema and see what a call would cost:
bash
curl -s https://fittings.sh/catalog/lang.bcp47 | jq
Paying. The endpoint answers
402 Payment Required
with a signed quote, you sign an authorization, and a facilitator settles it — you never send a transaction and never pay gas. Before it spends anything, the client checks its own hash against the gateway and refuses rather than sign with logic the gateway has moved past:
bash
undefined
该服务为独立加载的Skill,因此本文档可独立使用,无需依赖通用的
fittings
Skill。
call.mjs
文件与本文档一同提供;若缺失(本文档未随完整Skill包送达),可通过以下命令一次性获取:
curl -sO https://fittings.sh/skill/call.mjs
。
免费调用,无需钱包。查看接口Schema及调用费用:
bash
curl -s https://fittings.sh/catalog/lang.bcp47 | jq
付费调用。该端点会返回
402 Payment Required
状态码及签名报价,您需签署授权信息,由服务商完成结算——您无需发送交易,也无需支付Gas费。在产生实际费用前,客户端会将自身哈希与网关进行比对,若网关逻辑已更新则会拒绝签署:
bash
undefined

Dry run. Prints the quote and pays nothing, because no key is set.

试运行。仅打印报价,无需支付费用,因为未设置密钥。

node call.mjs lang.bcp47 tag=zh-Hant-HK
node call.mjs lang.bcp47 tag=zh-Hant-HK

For real: a wallet holding USDC on Base, and nothing else.

实际调用:需持有Base网络上的USDC钱包,无需其他资产。

export FITTINGS_PRIVATE_KEY=0x... node call.mjs lang.bcp47 tag=zh-Hant-HK

Spending is never a side effect of curiosity: with no `FITTINGS_PRIVATE_KEY`
the client fetches the quote and stops. `FITTINGS_MAX_PRICE` caps what it will
pay without asking, and defaults to $0.05.

**Use a throwaway wallet holding a few dollars, not a main one.** The key sits
in plaintext wherever the agent runs, and the whole cost of entry is USDC on
Base — no account, no API key, and no ETH, because the payer signs off-chain and
the facilitator broadcasts and pays the gas.

Writing your own client instead of using this one? `@x402/core` and
`@x402/evm` on npm, and the `fittings` skill records the two things that cost
real debugging time: the challenge is in a response header rather than the body,
and it must be re-signed from the exact request being retried.

If this is not the right service, `https://fittings.sh/catalog/search?q=...`
searches all of them for free.
export FITTINGS_PRIVATE_KEY=0x... node call.mjs lang.bcp47 tag=zh-Hant-HK

仅在明确授权时才会产生费用:未设置`FITTINGS_PRIVATE_KEY`时,客户端仅获取报价即停止操作。`FITTINGS_MAX_PRICE`用于设置无需确认的最高支付限额,默认值为0.05美元。

**请使用仅持有少量资金的临时钱包,勿使用主钱包**。密钥以明文形式存储在Agent运行环境中,参与该服务仅需持有Base网络上的USDC——无需账户、API密钥或ETH,因为付款方进行链下签名,由服务商负责广播交易并支付Gas费。

若不想使用该客户端,可自行开发:npm上提供`@x402/core`和`@x402/evm`包,`fittings` Skill记录了两个易导致调试耗时的要点:挑战信息位于响应头而非响应体中,且重试时必须针对精确的请求重新签名。

若该服务不符合需求,可通过`https://fittings.sh/catalog/search?q=...`免费搜索所有可用服务。