Display eastern arabic numerals on Iridium / OpenBSD
With Iridium running on OpenBSD, '1.toLocaleString("ar")' does not return an eastern arabic numeral. The more specific locale, "ar-SA", works as expected.
This commit is contained in:
parent
41c459e694
commit
7f4c8f723d
1 changed files with 4 additions and 1 deletions
|
@ -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(' ');
|
||||
}
|
||||
|
|
Loading…
Reference in a new issue