Skip to main content

Squillify development is paused indefinitely. Read why, and discover what this experiment achieved. Read the story

MicroSkills Reference

Negotiate Locale

localization.locale_negotiate

ProductionEngine wrapper (Class A)Deterministicstrictfastv1.0.0
No network

Overview

You send the locales you can serve and either an ordered requestedLocales list with quality values or a single acceptLanguage string, never both. LOOKUP walks each requested tag by dropping subtags. BEST_FIT uses ICU locale matching. A range with q=0 is skipped. defaultLocale is used only when nothing matches and must itself be available. We do not guess from an IP address or from content. A successful call costs 1 execution credit.

Agents guess Accept-Language matching. RFC 4647 lookup and ICU best-fit are mechanical, versioned answers.

Reliability

Same lists, same strategy, same ICU version, same answer. LOCALE_INVALID — trigger: an available or requested tag is POSIX or ill-formed; retryable: no; next: send hyphenated BCP 47 tags. ACCEPT_LANGUAGE_INVALID — trigger: the header cannot be parsed; retryable: no; next: send a standard Accept-Language value. REQUEST_SHAPE_INVALID — trigger: both or neither of requestedLocales and acceptLanguage; retryable: no; next: send exactly one. DEFAULT_LOCALE_UNAVAILABLE — trigger: defaultLocale is not in availableLocales; retryable: no; next: add it to the available list. ITEM_LIMIT_EXCEEDED — trigger: more than 500 available locales; retryable: no; next: shrink the list.

Context footprint

Short locale lists in. A successful call costs 1 execution credit.

When to use it

When you hold the locales you ship and a request list or Accept-Language header.

When you only need to canonicalize one tag, or to detect language from text.

Powered by ICU4J locale lookup (com.ibm.icu:icu4j).

Scope

Note
Selects one available locale from an ordered request or an Accept-Language value using LOOKUP or BEST_FIT.

Non-goals

  • Does not detect language from content
  • Does not look up a locale from an IP address or user profile
  • Does not return a ranked list of resources

Properties

IdempotentRetry safeStreaming supportedFile input supportedRequires external service

Capabilities

normalization

Cost & billing

Flat rate per invocation

MetercallsBillable onsuccessCost per call1 credit

File handling

Accepts file_refProduces file_refMax input64 KB

How we handle your data

Sensitive input, safe output
What this means

This skill may receive sensitive content, but it does not target sensitive data and returns only a structured non-sensitive result.

Squillify guarantees
  • Runs inside Squillify
  • This skill runs inside Squillify.
  • Payloads are not sent to an external service by this skill.
  • Squillify does not permanently store submitted payloads.
  • Telemetry records metadata only, not submitted content.
  • Submitted payloads are not used for training.
  • Submitted payloads are not reviewed by humans.
  • This skill does not target sensitive data.
  • The response does not contain submitted content.
Your responsibility

Squillify does not determine whether submitted content is sensitive. Your application is responsible for deciding what data it is allowed to submit. Your application is responsible for securing the response.

Read the Microskill Data Handling Policy

Input schema

FieldTypeRequiredDescription
requestedLocalesarrayNoFrom 1 through 50 closed requested ranges in caller order, later sorted by q then order. Omit it when acceptLanguage is sent.
acceptLanguagestringNoOne HTTP Accept-Language header value. Omit it when requestedLocales is sent.
availableLocalesarrayYesFrom 1 through 501 available locales you can serve; 501 hits ITEM_LIMIT_EXCEEDED.
strategystringNoLOOKUP walks by dropping subtags; BEST_FIT uses ICU matching. Omit it for LOOKUP.
defaultLocalestringNoFallback tag that must be available; omit it and a miss omits selected.

Output schema

FieldTypeRequiredDescription
selectedstringNoChosen canonical tag; omit it when nothing matched.
matchedRequeststringNoRequested range that produced the match; omit it when the default applied.
qualitynumberNoq-value of the matched request; omit it when the default applied.
strategystringYesLOOKUP or BEST_FIT as actually applied for this negotiation.
fallbackChainarrayYesFrom 0 through 32 tags tried in order; empty when nothing was attempted.
_metaobjectYesClosed ICU and CLDR versions used for this answer, with icuVersion and cldrVersion strings.

API contract

POST /v1/execute
curl
curl -sS -X POST "$BASE/v1/execute" -H "Authorization: Bearer $KEY" -H 'Content-Type: application/json' -d '{"skillKey":"localization.locale_negotiate","input":{"requestedLocales":[{"locale":"fr-CA","q":1}],"availableLocales":["fr","en"],"strategy":"LOOKUP"}}'
Integrations
TypeScript SDK
import { Squillify } from "@squillify/sdk";

const sq = new Squillify({ apiKey: process.env.SQUILLIFY_API_KEY });

const { output } = await sq.execute("localization.locale_negotiate", {"requestedLocales":[{"locale":"fr-CA","q":1}],"strategy":"LOOKUP","availableLocales":["fr","en"]});

Errors

CodeHTTPRetryableDescription
VALIDATION_ERROR400NoThe request payload failed schema validation.
UNAUTHORIZED401NoMissing or invalid API key.
SKILL_NOT_ACCESSIBLE403NoThe API key is not granted access to this skill.
SKILL_NOT_AVAILABLE_FOR_PLAN403NoThis skill is not included in your current plan.
PLAN_ELIGIBILITY_UNAVAILABLE503YesPlan eligibility could not be decided. Retry after backoff.
SKILL_NOT_FOUND404NoThe requested skill or version does not exist.
TENANT_RATE_LIMITED429YesRequest rate limit exceeded. Retry after backoff.
QUOTA_EXCEEDED429YesPlan quota exhausted. Retryable once the quota period resets.
EXECUTION_TIMEOUT504YesExecution exceeded the allowed time budget.
LOCALE_INVALID400NoThe request payload failed this skill's input validation.
ACCEPT_LANGUAGE_INVALID400NoThe request payload failed this skill's input validation.
REQUEST_SHAPE_INVALID400NoThe request payload failed this skill's input validation.
DEFAULT_LOCALE_UNAVAILABLE400NoThe request payload failed this skill's input validation.
ITEM_LIMIT_EXCEEDED429NoA size, quota, rate, or time limit was exceeded.

Other limits

LimitValue
Recommended inline bytes32 KiB

Limitations

  • Does not detect language from content
  • Does not look up a locale from an IP address or user profile
  • Does not return a ranked list of resources
  • Guessing language from a paragraph of source text
  • Canonicalizing a single tag you already hold

How to call

POST /v1/execute (requires authentication)

Request bodyjson
{
  "skillKey": "localization.locale_negotiate",
  "input": {
    "requestedLocales": [
      {
        "locale": "fr-CA",
        "q": 1
      }
    ],
    "strategy": "LOOKUP",
    "availableLocales": [
      "fr",
      "en"
    ]
  }
}

Examples

Region fallback with lookup

Inputjson
{
  "requestedLocales": [
    {
      "locale": "fr-CA",
      "q": 1
    }
  ],
  "strategy": "LOOKUP",
  "availableLocales": [
    "fr",
    "en"
  ]
}
Expected outputjson
{
  "_meta": {
    "icuVersion": "76.1",
    "cldrVersion": "46.0"
  },
  "selected": "fr",
  "matchedRequest": "fr-CA",
  "strategy": "LOOKUP",
  "fallbackChain": [
    "fr-CA",
    "fr"
  ],
  "quality": 1
}
Tip
LOOKUP drops CA and selects fr

Accept-Language with q zero

Inputjson
{
  "defaultLocale": "en",
  "acceptLanguage": "en-US,fr;q=0,en;q=0.8",
  "availableLocales": [
    "fr",
    "en"
  ],
  "strategy": "LOOKUP"
}
Expected outputjson
{
  "_meta": {
    "icuVersion": "76.1",
    "cldrVersion": "46.0"
  },
  "selected": "en",
  "matchedRequest": "en-US",
  "strategy": "LOOKUP",
  "fallbackChain": [
    "en-US",
    "en"
  ],
  "quality": 1
}
Tip
fr is excluded at q=0 so English is selected
  • Choosing fr-FR from Accept-Language when you only ship fr
  • Excluding a range the caller sent with q=0

Avoid for

  • Guessing language from a paragraph of source text
  • Canonicalizing a single tag you already hold

Composable with

Safety & privacy

  • Runs without calling any external service.
  • Your payloads are never stored permanently.
  • Telemetry captures metadata only — never your payload contents.
  • We never train models on your payloads.
  • No human reviews your payloads.

Tags

normalizationi18naccept-languagelocale