From 11412144502bf113a8fe043a0e4b5beaae401c30 Mon Sep 17 00:00:00 2001 From: Kevin Deng Date: Thu, 20 Aug 2026 15:04:16 +0900 Subject: [PATCH] Use Intl.NumberFormat for Han numeral formatting (#19) --- app/utils/han-number.ts | 8 +++++--- 1 file changed, 5 insertions(+), 3 deletions(-) diff --git a/app/utils/han-number.ts b/app/utils/han-number.ts index 8104aed..d021285 100644 --- a/app/utils/han-number.ts +++ b/app/utils/han-number.ts @@ -4,9 +4,11 @@ * Every interface language here is written in Han script and spells these the * same way, so the numeral is a formatting detail rather than a message of its * own: 三地同形 reads in Chinese exactly as 三つの字形 reads in Japanese. - * Anything past the handful of columns a row can have falls back to figures. */ -const HAN_DIGITS = ['〇', '一', '二', '三', '四', '五'] +const hanNumberFormat = new Intl.NumberFormat('zh', { + numberingSystem: 'hanidec', + useGrouping: false, +}) export const hanNumber = (value: number): string => - HAN_DIGITS[value] ?? String(value) + hanNumberFormat.format(value) -- 2.51.2