diff --git a/src/js/lib/i18n.ts b/src/js/lib/i18n.ts index 07597b2..3310f0a 100644 --- a/src/js/lib/i18n.ts +++ b/src/js/lib/i18n.ts @@ -34,7 +34,10 @@ export function i18n(json: string): TFunction { } export function formatNumber(number: number, locale: Quran.Locale): string { - return number.toLocaleString(locale, { maximumFractionDigits: 1 }) + const numLocale = locale === 'ar' ? 'ar-SA' : locale; + const options = { maximumFractionDigits: 1 }; + return new Intl.NumberFormat(numLocale, options) + .format(number) .split(/([^\d])/) .join(' '); }