Fix arabic comma issue in IE11
IE11 adds a regular comma rather than the Arabic comma. Fix this.
by David Storey
JavaScript
var locale = "ar",
formatter = new Intl.NumberFormat(locale),
usedLocale = formatter.resolvedOptions().locale,
formattedNum = formatter.format(100000000000.100);
console.log("Original:" + formattedNum);
// need to test for "ar" and "ar-*" seperately, as "ar" will also match "arn"
// check to see if the locale is "ar" OR starts with "ar-" AND that a comma is present
if ((usedLocale === "ar" || usedLocale.indexOf("ar-") === 0) && formattedNum.indexOf(",") !== -1) {
formattedNum = formattedNum.replace(/,/g, "٬");
}
console.log("Fixed: " + formattedNum);