Aller au contenu principal

Localization of results

Aztec-Calcs supports four locales: en-US, es-US, en-CA and fr-CA. This page says how each surface picks a locale and how numbers, currencies and dates reach your users.

Before you start​

Your cobrand has a default locale, which a customer admin sets in the portal. Every surface uses it when a request names no locale, and en-US applies when your cobrand has no default.

The platform never reads the browser's Accept-Language header.

Minimal example​

Ask for a result in Canadian French. The body locale chooses the language of the labels and the disclaimer. The query locale chooses the locale field and the Content-Language header of the response. This example sends both, so that all of them are in French. Each one works on its own:

export AZTEC_API_HOST="<your API host>"
export AZTEC_SECRET_KEY="<your secret key>"

curl -sS -i -X POST "https://$AZTEC_API_HOST/v1/calculators/auto-loan-payment/calculate?locale=fr-CA" \
-H "Authorization: Bearer $AZTEC_SECRET_KEY" \
-H "Content-Type: application/json" \
-d '{"inputs":{"vehiclePrice":30000,"downPayment":3000,"tradeInValue":0,"salesTaxRate":6,"apr":7,"termMonths":60},"locale":"fr-CA"}'
  • With only the body locale, the labels and the disclaimer are in French, and the response locale and Content-Language use your cobrand's default.
  • With only the query locale, the response locale and Content-Language are fr-CA, and the labels and disclaimer use your cobrand's default.

With both, the response has Content-Language: fr-CA, and the table labels and the disclaimer are in French.

Options​

SurfaceHow to choose the locale
REST calculateThe locale property of the body picks the language of labels and the disclaimer. The locale query parameter sets the locale field of the response and the Content-Language header.
REST schema and listThe locale query parameter sets the locale field and the Content-Language header.
Embed endpointsThe locale query parameter on GET requests, and the locale body property on calculate.
Embed loaderThe data-locale attribute. See Embed calculators with the loader.
Hosted pagesThe ?locale= query parameter or the language switcher on the page.
MCP endpointYour cobrand's default locale.

Each source is read on its own, and an absent or unusable value falls back to your cobrand's default, then en-US. The body and the query string don't override each other. In the query string, a value matches without regard to case and an underscore works as a hyphen, so FR_ca becomes fr-CA. The locale property of a request body must match exactly, for example fr-CA. An empty query value is the same as no value.

Format numbers and dates​

The API returns numbers as plain JSON numbers, such as 566.02, whatever the locale. They are never formatted strings, so you can compute with them. Format them for display in your own code using the locale's rules. Use the standard Intl.NumberFormat and Intl.DateTimeFormat in the browser, or your platform's equivalent.

new Intl.NumberFormat('fr-CA', { style: 'currency', currency: 'CAD' }).format(566.02);

The currency of a calculator comes from the calculator, not from the locale. The embedded and hosted calculators format numbers, currencies, percentages and dates for the active locale using the browser's locale data, and the MCP text uses the cobrand locale too.

Errors and limits​

SituationResult
REST calculate with an unsupported body localeA validation_failed error with a field error unsupported_locale on locale.
A locale query parameter that isn't one of the four locales, even after the case and underscore rulesThe request still works. The platform ignores the value and uses your cobrand's default locale. It isn't an error.
Embed calculate with an unsupported localeThe request falls back to your cobrand's default locale.
The loader's data-locale isn't one of the four localesThe loader warns UNSUPPORTED_LOCALE and uses your cobrand's default locale.
Two locale query parametersThe platform ignores them and uses your cobrand's default locale.
LimitValue
Localesen-US, es-US, en-CA, fr-CA
Locale value length35 characters
Validation messagesThe REST API and MCP endpoint return field messages in English. The embed endpoints return them in the request locale.