Locale Engine

๐Ÿ”ข Not translation. This formats values โ€” how a number, price, or date is written per region โ€” independent of page language. Pair with the Language Engine for the words; use this for the shapes.

๐Ÿงฎ Try a Format

Result:

โ€”
๐Ÿ“ฎ Reference, not a live composer. Address field order varies enough by country (name-first vs. postal-code-first, RTL layouts, etc.) that this tab shows the correct order per country โ€” wire it into your own address form logic.

๐Ÿ“ Address Field Order by Country

United States (US)

  1. Recipient
  2. Street address
  3. City, State ZIP
  4. Country
Jane Doe
123 Main St
Springfield, IL 62704
United States

United Kingdom (GB)

  1. Recipient
  2. Street address
  3. Town/City
  4. Postcode
  5. Country
Jane Doe
45 High Street
Manchester
M1 4WP
United Kingdom

Kenya (KE)

  1. Recipient
  2. P.O. Box / Street
  3. City
  4. Postal code
  5. Country
Jane Wanjiru
P.O. Box 12345-00100
Nairobi
00100
Kenya

Nigeria (NG)

  1. Recipient
  2. Street address
  3. City, State
  4. Postal code
  5. Country
Jane Okafor
12 Adeola Odeku St
Lagos, Lagos State
101241
Nigeria

Germany (DE)

  1. Recipient
  2. Street address
  3. Postal code + City
  4. Country
Jane Muster
MusterstraรŸe 12
10115 Berlin
Germany

France (FR)

  1. Recipient
  2. Street address
  3. Postal code + City
  4. Country
Jane Dupont
12 Rue de Paris
75001 Paris
France

Japan (JP)

  1. Postal code
  2. Prefecture + City
  3. Ward/Block/Building (largest to smallest)
  4. Recipient
ใ€’100-0001
Tokyo, Chiyoda-ku
1-1 Marunouchi
Jane Yamada

China (CN)

  1. Province + City
  2. District + Street (largest to smallest)
  3. Recipient
  4. Postal code
Beijing, Chaoyang District
Jianguomenwai Street 1
Jane Li
100004

India (IN)

  1. Recipient
  2. Street/Locality
  3. City, State
  4. PIN code
  5. Country
Jane Sharma
12 MG Road, Indiranagar
Bengaluru, Karnataka
560038
India

Brazil (BR)

  1. Recipient
  2. Street + Number
  3. Neighborhood
  4. City - State
  5. Postal code
  6. Country
Jane Silva
Rua Augusta, 123
Consolaรงรฃo
Sรฃo Paulo - SP
01305-000
Brazil

Saudi Arabia (RTL) (SA)

  1. Recipient
  2. Street address
  3. District
  4. City + Postal code
  5. Country
ุฌูŠู† ุงู„ุฏูˆุณุฑูŠ
ุดุงุฑุน ุงู„ู…ู„ูƒ ูู‡ุฏ
ุญูŠ ุงู„ุนู„ูŠุง
ุงู„ุฑูŠุงุถ 12211
Saudi Arabia

Australia (AU)

  1. Recipient
  2. Street address
  3. Suburb State Postcode
  4. Country
Jane Smith
12 George St
Sydney NSW 2000
Australia

๐Ÿ”Œ Web Integration

fetch('https://dev.xcojo.com/Locale/?type=currency&value=49.99¤cy=USD&locale=de-DE')
    .then(r => r.json())
    .then(data => console.log(data.result)); // "49,99 $"

Response Shape

{
  "status": "success",
  "type": "currency",
  "locale": "de-DE",
  "currency": "USD",
  "input": "49.99",
  "result": "49,99 $"
}

Address Format Template (JSON)

https://dev.xcojo.com/Locale/?type=address&locale=JP&format=template

โš™๏ธ Why This Is Server-Side PHP intl, Not a Third-Party API

Number, currency, and date formatting rules are standardized in Unicode's CLDR dataset, and PHP ships a built-in wrapper for it (NumberFormatter, IntlDateFormatter) via ext-intl. That means:

The one requirement: ext-intl must be enabled in PHP. It's on by default on most managed hosts, but check via php -m | grep intl or phpinfo() if formatting requests come back with an error.

README & Developer Guide

Welcome to the Xcojo Locale & Formatting Engine. Where the Language Engine translates words, this engine formats values โ€” numbers, prices, dates, and address layouts โ€” the way a given region actually writes them.

API Parameters

Sample Locales Covered in the Demo

English (United States) (en-US), English (United Kingdom) (en-GB), English (Kenya) (en-KE), Swahili (Kenya) (sw-KE), German (Germany) (de-DE), French (France) (fr-FR), Spanish (Mexico) (es-MX), Portuguese (Brazil) (pt-BR), Japanese (Japan) (ja-JP), Chinese (China) (zh-CN), Hindi (India) (hi-IN), Arabic (Saudi Arabia) (ar-SA)

Any valid CLDR locale code works via the API even if it's not in the demo dropdown above โ€” the dropdown is just a curated starting set.

Cross-Origin Integration (CORS)

All endpoints include automatic CORS headers (Access-Control-Allow-Origin: *) enabling cross-domain usage across xcojo.com subdomains.