How do I display prices and receipts in Haitian gourdes correctly?

poze a month ago382 gadeen

3

I've seen gourde prices written as 'HTG 1500', '1 500 G', 'G 1,500.00' and '1500 gdes'. Is there a correct way to format amounts in my app, in both French and Kreyòl interfaces?

Dyagnostik IA

Se IA ki fè l. Se pa yon repons — kominote a anba a konfime oswa korije l. Toujou verifye anvan ou fye l.

1 Repons

8
✓
✓ Repons yo aksepte

Let Intl.NumberFormat handle separators and symbol placement from the ISO currency code HTG, and pick the locale from the interface language:

export function formatHtg(cents: number, lang: "fr" | "ht" | "en"): string {
  const locale = lang === "en" ? "en-US" : "fr-HT"; // Kreyòl UI: French-style number formatting
  return new Intl.NumberFormat(locale, {
    style: "currency",
    currency: "HTG",
    minimumFractionDigits: cents % 100 === 0 ? 0 : 2, // hide ",00" on whole amounts
  }).format(cents / 100);
}
 
formatHtg(150000, "fr"); // "1 500 G" (narrow no-break spaces, symbol after)
formatHtg(150000, "en"); // "HTG 1,500"

Guidelines:

  • One consistent format per language across the app, emails, SMS and PDF receipts. Mixed formats look untrustworthy on a payment page.
  • Format on the edge, store raw. The database keeps integer cents plus the currency code. Formatting happens only when displaying.
  • SMS: some phones render the narrow no-break space as a box. For SMS text, replace it with a plain space.
  • On receipts show the transaction reference, date and time in America/Port-au-Prince, and the payment method (MonCash, NatCash). Those are exactly what customers read back to support.
  • If you show USD too, always label both amounts, like "1 500 G (≈ $11.40)", and say which exchange rate and date the conversion used.

Konekte pou di lòt moun si li te mache.

answered a month ago

Sign in and verify your email to post an answer.