Multi-language & currencies

Reach global customers with clean locale routing, localized currencies and dates, right-to-left layout support, and database schemas decoupled from display text.

Internationalization vs localization

Serving international visitors starts by separating two clean concerns. Internationalization (`i18n`) is the structural groundwork: storing neutral codes in your database, moving interface text into locale dictionaries, and formatting numbers and dates dynamically.

Localization (`l10n`) adapts that groundwork per market — translating UI copy into Spanish or Japanese, pricing plans in Euros or Yen, adapting date formats, and mirroring right-to-left layouts for Arabic or Hebrew.

Setting up clean i18n architecture early makes every additional market fast to launch instead of forcing fragile database and UI rewrites later.

Keeping database records language-independent

The fastest way to corrupt a multi-language app is storing translated display words in core columns. If an English checkout writes status = "Confirmed" while a Spanish checkout writes status = "Confirmado", admin filters and revenue reports break immediately.

Store canonical neutral values in Cloud and translate labels only when rendering screens or emails.

Data typeFragile localized storageClean language-independent storage
Status & roles"Confirmado", "En attente"Canonical lowercase codes: "confirmed", "pending", "canceled"
Prices & money"$19.99" or float 19.99Integer minor units + ISO 4217 currency: amount_minor = 1999, currency = "USD"
Dates & bookings"03/04/2026 2:00 PM"UTC ISO-8601 timestamp (starts_at) plus IANA time zone ("Europe/Berlin")
Catalog copyMultiplying title_en, title_es columnsChild product_translations table keyed by (product_id, locale)
User preferenceGuessing solely from headersBCP-47 locale tag ("en", "es", "ja", "ar") on users.preferred_locale
json
{
  "products": { "id": "prod_104", "sku": "MATCHA-100G", "status": "active" },
  "product_translations": [
    { "product_id": "prod_104", "locale": "en", "title": "Ceremonial Matcha 100g" },
    { "product_id": "prod_104", "locale": "ja", "title": "宇治抹茶 100g" },
    { "product_id": "prod_104", "locale": "es", "title": "Matcha Ceremonial 100g" }
  ],
  "product_prices": [
    { "product_id": "prod_104", "currency": "USD", "amount_minor": 3400, "stripe_price_id": "price_usd_..." },
    { "product_id": "prod_104", "currency": "EUR", "amount_minor": 3100, "stripe_price_id": "price_eur_..." }
  ]
}

Always fall back cleanly to your default locale (en) when a newly added record lacks a secondary translation so visitors never see blank titles or raw dictionary keys.

Choosing clean locale routing and persistence

Pick a routing strategy matched to whether pages must rank in regional search results or sit behind user sign-in.

Routing strategyExample URLBest suited forSEO & UX trade-off
URL path prefixesyourdomain.com/es/pricing, /ja/pricingPublic sites, stores, blogs, booking storefrontsStrongest SEO; pairs cleanly with hreflang and shareable links
Regional subdomainses.yourdomain.com, jp.yourdomain.comDistinct regional storefronts or legal entitiesRequires extra DNS setup; see Subdomains & redirects
Profile + cookieyourdomain.com/dashboardAuthenticated SaaS dashboards and private portalsClean single URL; remembers each user's preference across devices

Add reciprocal hreflang tags and canonical links on prefixed public routes so Google serves the right regional page. See Technical SEO & sitemaps.

Formatting currencies, dates, and Stripe Checkout

Never glue symbols manually ("$" + amount) or assume every currency divides by 100. Zero-decimal currencies such as Japanese Yen (JPY) and Korean Won (KRW) have no cents, and European locales swap commas and periods.

Standard `Intl` formatting

Use native Intl.NumberFormat and Intl.DateTimeFormat so decimal separators, symbol placement, and local date styles stay accurate with zero extra dependencies:

text
Formatting Examples (same underlying records)
- en-US + USD (4900 cents):   $49.00
- de-DE + EUR (4500 cents):   45,00 €
- ja-JP + JPY (7200 yen):     ¥7,200
- en-US date (UTC -> local):  May 14, 2026, 2:30 PM
- fr-FR date (UTC -> local):  14 mai 2026 à 14:30

Multi-currency Stripe payments

Never show an estimated frontend currency conversion while silently charging a different currency at checkout. Bind each supported currency to its own real Stripe Price ID in product_prices (ExaSpark always charges 0% platform fee on top of standard Stripe processing fees).

When a visitor picks EUR, launch Stripe Checkout with your EUR Price ID and persist the confirmed amount_minor and currency from the verified Stripe webhook. See Payments with Stripe.

Supporting right-to-left (RTL) layouts

Serving Arabic (ar), Hebrew (he), Persian (fa), or Urdu (ur) requires mirroring layout geometry alongside translated text:

  • Toggle document direction dynamically. Set both lang and dir="rtl" (or dir="ltr") on the root <html> element whenever locale switches.
  • Use CSS logical properties. Write margin-inline-start, padding-inline-end, and text-align: start instead of hardcoded left and right so sidebars and forms mirror automatically.
  • Mirror directional icons selectively. Flip back arrows and drawer chevrons in RTL while keeping brand logos, checkmarks, and numeric sequences unmirrored.
  • Plan for European text expansion. German, French, and Spanish buttons often run 25%–35% wider than English. Check narrow frames in Browser Device Lab to prevent clipped labels.

Adding a new language step by step

  1. Extract copy into typed locale dictionaries

    Move nav labels, form placeholders, validation errors, and empty states into locales/en.json and per-locale JSON files with automatic English fallback.

  2. Audit database codes and currency units

    Confirm statuses use canonical enums, timestamps store UTC, and prices store integer minor units plus ISO currency codes.

  3. Wire locale routing and switcher

    Add URL prefixes for public pages, persist preferred_locale for signed-in users, and add a clean header/footer language and currency switcher.

  4. Localize transactional emails

    Pass each customer's preferred_locale into booking confirmation, receipt, and password templates so emails match the storefront.

  5. Verify layout expansion, RTL, and checkout in Preview

    Inspect every locale across phone frames in Browser Device Lab and run one Stripe Test checkout per currency.

Starter prompt · App

Add English (en), Spanish (es), and Japanese (ja) support. Move UI copy, validation errors, and email templates into typed JSON locale files with automatic fallback to English. Add /en, /es, and /ja URL prefixes with hreflang tags on public pages, save preferred_locale on users, add a header language and currency switcher (USD, EUR, JPY), format prices and dates via Intl (treating JPY as zero-decimal), and store canonical lowercase status enums in Cloud.

Starter prompt · App

Add Arabic (ar) support with dynamic html dir="rtl" switching. Refactor hardcoded left/right spacing and alignments to CSS logical properties (margin-inline, padding-inline, text-align: start), mirror directional chevron icons in RTL, and confirm mobile drawers and forms have zero horizontal overflow.

Common mistakes and troubleshooting

SymptomRoot causeExact fix
Buttons render raw keys like `nav.book`Secondary locale lacks the key with no fallback helperReturn the default en translation whenever a key is missing
Japanese Yen displays `100x` offFormatter divided JPY by 100 assuming two decimalsTrack decimal precision per currency (0 for JPY/KRW, 2 for USD/EUR)
Admin filters miss non-English ordersDatabase stored translated status wordsStore canonical enums (confirmed, pending) and map display labels only in UI
Spanish or German nav wraps or clipsFixed button widths sized tightly around EnglishUse flexible padding, tighten verbose strings, and inspect narrow mobile frames
Receipt emails arrive in EnglishCheckout ignored buyer's active localeSave locale on the order or user row and pass it into email templates

Next steps

Still have a question?Ask our team and other builders on Discord.

From the blog