Skip to content

Formatting and language

Every number, amount and date on screen goes through a few helper functions. Change the locale, currency or time zone in config/site.config.ts and the whole app follows.

1. Settings

locale: "en-US",                 // number and date style
currency: "USD",                 // any ISO 4217 code: "INR", "EUR", "GBP", "JPY", …
timeZone: "local",               // the viewer's own zone, or any IANA zone: "Asia/Kolkata", "Europe/London", …
weekStartsOn: 1,                 // 1 = Monday, 0 = Sunday (calendars)

Some combinations:

You want locale currency Shows
India en-IN INR ₹84,320.00 · 48,215 · 26 Nov 2026
Germany de-DE EUR 84.320,00 € · 48.215 · 26. Nov. 2026
UK en-GB GBP £84,320.00 · 26 Nov 2026
Japan ja-JP JPY ¥84,320 (no decimals)

The sample data is in US cents. If you switch to a currency with different decimals (like JPY), regenerate your own data or convert it in the API.

2. The helpers

Import from @pulze/lib (in the downloaded projects, src/lib/format):

Helper Example Result
formatMoney(minor) formatMoney(8432000) $84,320.00
formatMoney(minor, { whole: true }) formatMoney(8432000, { whole: true }) $84,320
formatMoney(minor, { compact: true }) formatMoney(8432000, { compact: true }) $84.3K
formatNumber(n) formatNumber(48215) 48,215
formatCompact(n) formatCompact(48215) 48.2K
formatPercent(ratio) formatPercent(0.0384) 3.84%
delta(now, before) delta(110, 100) 0.1 (use with formatPercent)
formatDate(d, style) see below
formatRelative(d) 12 minutes ago "12 minutes ago", "yesterday", "in 3 days"
formatDuration(seconds) formatDuration(252) 4m 12s
formatBytes(bytes) formatBytes(4404019) 4.2 MB
initials(name) initials("Maya Patel") MP

Date styles

Style Example
"short" Nov 26
"medium" (default) Nov 26, 2026
"long" Thursday, November 26, 2026
"time" 2:30 PM
"datetime" Nov 26, 2:30 PM
"weekday" Thu
"month" November 2026

Every helper also takes an optional last argument to override the settings for one call:

formatMoney(4900, { currency: "EUR", locale: "de-DE" }) // 49,00 €

3. Rules that keep things consistent

  • Never format numbers or dates by hand (toFixed, string templates). Always use a helper, so a settings change reaches everything.
  • Money is stored in minor units (cents). Only formatMoney divides it.
  • Dates are stored as ISO strings and shown in siteConfig.timeZone ("local" = each viewer's own time zone, which is what the calendar uses for its grid too).

4. Translating the interface

Numbers, money and dates already follow locale (section 1). Interface text (menu labels, buttons, headings) is written in English inside each page file, which keeps the pages easy to read and edit.

One language other than English: edit the text in place. Menu labels are in config/nav.ts, page titles in config/routes.ts, and everything else in the page files under src/screens/. Set locale to match.

Several languages: add a translation library. use-intl works in both versions because Pulze's pages are plain React:

  1. Install it: pnpm add use-intl.

  2. Put each language in a file, for example src/messages/en.json and src/messages/de.json:

    { "kanban": { "title": "Kanban", "addCard": "Add card" } }
    
  3. Wrap the app once, next to the other providers (app/providers.tsx in Next.js, src/main.tsx in Vite):

    import { IntlProvider } from "use-intl"
    import de from "../messages/de.json"
    
    ;<IntlProvider locale="de" messages={de}>
      {children}
    </IntlProvider>
    
  4. In a page, swap the English text for keys:

    import { useTranslations } from "use-intl"
    
    const t = useTranslations("kanban")
    <Button>{t("addCard")}</Button>
    
  5. Pick the language from a setting, the browser (navigator.language) or the URL, and pass the matching messages.

Do it one page at a time; untranslated pages keep working in English.

5. Right-to-left languages

Planned for v1.1: layouts that mirror for Arabic, Hebrew and Persian. Until then, dir="rtl" on <html> flips the text but not every layout detail.