Skip to content
HALOWERK

Textwerk

locale format

Uses the Intl APIs of the runtime (CLDR 48 via ICU 78) to format the given values per locale and returns formatToParts-derived conventions: decimal and group separator, currency symbol position and spacing, percent sign spacing, numbering system, calendar, hour cycle, first day of week and weekend (Intl.Locale week info). Dates are ISO 8601 strings: a plain date is shown as that calendar date, a date-time with offset as that instant in time_zone, a date-time without offset as wall-clock time.

POST https://text.halowerk.com/v1/locale-format

Inputs

Fields of the published input schema
FieldTypeRequiredDescription
localesarrayYesBCP 47 locales, e.g. de-DE, en-US, fr-CH.
numbernumberNoNumber to format.
currencyobjectNoAmount to format as currency.
percentnumberNoFraction, 0.25 = 25 %.
datestringNoISO 8601 date or date-time.
time_zonestringNoIANA time zone for date-times, e.g. Europe/Berlin.
date_stylestringNoCLDR date style.
unitobjectNoMeasure to format with a unit.
listarrayNoItems to join as a conjunction list.
relativeobjectNoRelative time, e.g. -1 day.
Show full input schema
{
  "type": "object",
  "additionalProperties": false,
  "required": [
    "locales"
  ],
  "properties": {
    "locales": {
      "type": "array",
      "minItems": 1,
      "maxItems": 20,
      "items": {
        "type": "string",
        "maxLength": 35
      },
      "description": "BCP 47 locales, e.g. de-DE, en-US, fr-CH."
    },
    "number": {
      "type": "number",
      "description": "Number to format."
    },
    "currency": {
      "type": "object",
      "additionalProperties": false,
      "required": [
        "amount",
        "code"
      ],
      "description": "Amount to format as currency.",
      "properties": {
        "amount": {
          "type": "number",
          "description": "Amount."
        },
        "code": {
          "type": "string",
          "pattern": "^[A-Z]{3}$",
          "description": "ISO 4217 currency code."
        }
      }
    },
    "percent": {
      "type": "number",
      "description": "Fraction, 0.25 = 25 %."
    },
    "date": {
      "type": "string",
      "maxLength": 40,
      "description": "ISO 8601 date or date-time."
    },
    "time_zone": {
      "type": "string",
      "maxLength": 60,
      "default": "UTC",
      "description": "IANA time zone for date-times, e.g. Europe/Berlin."
    },
    "date_style": {
      "type": "string",
      "enum": [
        "full",
        "long",
        "medium",
        "short"
      ],
      "default": "medium",
      "description": "CLDR date style."
    },
    "unit": {
      "type": "object",
      "additionalProperties": false,
      "required": [
        "value",
        "unit"
      ],
      "description": "Measure to format with a unit.",
      "properties": {
        "value": {
          "type": "number",
          "description": "Value."
        },
        "unit": {
          "type": "string",
          "maxLength": 40,
          "description": "ECMA-402 unit identifier, e.g. kilometer, kilogram, celsius."
        }
      }
    },
    "list": {
      "type": "array",
      "maxItems": 50,
      "items": {
        "type": "string",
        "maxLength": 200
      },
      "description": "Items to join as a conjunction list."
    },
    "relative": {
      "type": "object",
      "additionalProperties": false,
      "required": [
        "value",
        "unit"
      ],
      "description": "Relative time, e.g. -1 day.",
      "properties": {
        "value": {
          "type": "number",
          "description": "Offset; negative values lie in the past."
        },
        "unit": {
          "type": "string",
          "enum": [
            "second",
            "minute",
            "hour",
            "day",
            "week",
            "month",
            "quarter",
            "year"
          ],
          "description": "Unit of the offset."
        }
      }
    }
  }
}

Open original schema

Published input example

{
  "locales": [
    "de-DE",
    "en-US",
    "fr-FR"
  ],
  "number": 1234567.891,
  "currency": {
    "amount": 1234.5,
    "code": "EUR"
  },
  "date": "2026-10-31T12:00:00Z",
  "time_zone": "Europe/Berlin"
}

Result & documentation

Machine-readable documentation of this hub

Source of this page: the published HALOWERK catalog. Updated: 2026-11-17 UTC.

More endpoints in this hub

All endpoints in this hub →