angular-l10n
Advanced tools
Comparing version 8.1.0 to 8.1.1-beta.0
@@ -166,5 +166,8 @@ /** | ||
const unicodeChars = []; | ||
for (let i = 0; i <= 7; i++) { | ||
for (let i = 0; i < localeValue.length; i++) { | ||
unicodeChars.push(this.toUnicode(localeValue.charAt(i))); | ||
} | ||
/** @type {?} */ | ||
const thousandSeparator = localeValue.length >= 8 ? true : false; | ||
// Expected positions. | ||
// Right to left: | ||
@@ -175,30 +178,21 @@ // checks Unicode characters 'RIGHT-TO-LEFT MARK' (U+200F) & 'Arabic Letter Mark' (U+061C), | ||
// checks Unicode character 'LEFT-TO-RIGHT MARK' (U+200E). | ||
/** @type {?} */ | ||
let positions; | ||
if (unicodeChars[0] == "\\u200F" || unicodeChars[0] == "\\u061C") { | ||
decimalCode = { | ||
minusSign: unicodeChars[1], | ||
decimalSeparator: unicodeChars[7], | ||
thousandSeparator: unicodeChars[3] | ||
}; | ||
positions = thousandSeparator ? [1, 7, 3] : [1, 6]; | ||
} | ||
else if (unicodeChars[0] == this.toUnicode(this.locale.formatDecimal(1, '1.0-0', defaultLocale))) { | ||
decimalCode = { | ||
minusSign: unicodeChars[7], | ||
decimalSeparator: unicodeChars[5], | ||
thousandSeparator: unicodeChars[1] | ||
}; | ||
positions = thousandSeparator ? [7, 5, 1] : [6, 4]; | ||
} | ||
else if (unicodeChars[0] == "\\u200E") { | ||
decimalCode = { | ||
minusSign: unicodeChars[1], | ||
decimalSeparator: unicodeChars[7], | ||
thousandSeparator: unicodeChars[3] | ||
}; | ||
positions = thousandSeparator ? [1, 7, 3] : [1, 6]; | ||
} | ||
else { | ||
decimalCode = { | ||
minusSign: unicodeChars[0], | ||
decimalSeparator: unicodeChars[6], | ||
thousandSeparator: unicodeChars[2] | ||
}; | ||
positions = thousandSeparator ? [0, 6, 2] : [0, 5]; | ||
} | ||
decimalCode = { | ||
minusSign: unicodeChars[positions[0]], | ||
decimalSeparator: unicodeChars[positions[1]], | ||
thousandSeparator: thousandSeparator ? unicodeChars[positions[2]] : "" | ||
}; | ||
} | ||
@@ -238,3 +232,8 @@ return decimalCode; | ||
toUnicode(c) { | ||
return "\\u" + this.toHex(c.charCodeAt(0)); | ||
/** @type {?} */ | ||
let unicode = "\\u" + this.toHex(c.charCodeAt(0)); | ||
// Replaces NO-BREAK SPACE | ||
unicode = unicode.replace("\\u202F", "\\u0020"); | ||
unicode = unicode.replace("\\u00A0", "\\u0020"); | ||
return unicode; | ||
} | ||
@@ -241,0 +240,0 @@ /** |
@@ -188,5 +188,8 @@ /** | ||
var unicodeChars = []; | ||
for (var i = 0; i <= 7; i++) { | ||
for (var i = 0; i < localeValue.length; i++) { | ||
unicodeChars.push(this.toUnicode(localeValue.charAt(i))); | ||
} | ||
/** @type {?} */ | ||
var thousandSeparator = localeValue.length >= 8 ? true : false; | ||
// Expected positions. | ||
// Right to left: | ||
@@ -197,30 +200,21 @@ // checks Unicode characters 'RIGHT-TO-LEFT MARK' (U+200F) & 'Arabic Letter Mark' (U+061C), | ||
// checks Unicode character 'LEFT-TO-RIGHT MARK' (U+200E). | ||
/** @type {?} */ | ||
var positions = void 0; | ||
if (unicodeChars[0] == "\\u200F" || unicodeChars[0] == "\\u061C") { | ||
decimalCode = { | ||
minusSign: unicodeChars[1], | ||
decimalSeparator: unicodeChars[7], | ||
thousandSeparator: unicodeChars[3] | ||
}; | ||
positions = thousandSeparator ? [1, 7, 3] : [1, 6]; | ||
} | ||
else if (unicodeChars[0] == this.toUnicode(this.locale.formatDecimal(1, '1.0-0', defaultLocale))) { | ||
decimalCode = { | ||
minusSign: unicodeChars[7], | ||
decimalSeparator: unicodeChars[5], | ||
thousandSeparator: unicodeChars[1] | ||
}; | ||
positions = thousandSeparator ? [7, 5, 1] : [6, 4]; | ||
} | ||
else if (unicodeChars[0] == "\\u200E") { | ||
decimalCode = { | ||
minusSign: unicodeChars[1], | ||
decimalSeparator: unicodeChars[7], | ||
thousandSeparator: unicodeChars[3] | ||
}; | ||
positions = thousandSeparator ? [1, 7, 3] : [1, 6]; | ||
} | ||
else { | ||
decimalCode = { | ||
minusSign: unicodeChars[0], | ||
decimalSeparator: unicodeChars[6], | ||
thousandSeparator: unicodeChars[2] | ||
}; | ||
positions = thousandSeparator ? [0, 6, 2] : [0, 5]; | ||
} | ||
decimalCode = { | ||
minusSign: unicodeChars[positions[0]], | ||
decimalSeparator: unicodeChars[positions[1]], | ||
thousandSeparator: thousandSeparator ? unicodeChars[positions[2]] : "" | ||
}; | ||
} | ||
@@ -272,3 +266,8 @@ return decimalCode; | ||
function (c) { | ||
return "\\u" + this.toHex(c.charCodeAt(0)); | ||
/** @type {?} */ | ||
var unicode = "\\u" + this.toHex(c.charCodeAt(0)); | ||
// Replaces NO-BREAK SPACE | ||
unicode = unicode.replace("\\u202F", "\\u0020"); | ||
unicode = unicode.replace("\\u00A0", "\\u0020"); | ||
return unicode; | ||
}; | ||
@@ -275,0 +274,0 @@ /** |
{ | ||
"name": "angular-l10n", | ||
"private": false, | ||
"version": "8.1.0", | ||
"version": "8.1.1-beta.0", | ||
"description": "An Angular library to translate messages, dates and numbers", | ||
@@ -6,0 +6,0 @@ "main": "./bundles/angular-l10n.umd.js", |
Sorry, the diff of this file is too big to display
Sorry, the diff of this file is not supported yet
Sorry, the diff of this file is too big to display
Sorry, the diff of this file is not supported yet
Sorry, the diff of this file is not supported yet
Sorry, the diff of this file is not supported yet
Sorry, the diff of this file is too big to display
Sorry, the diff of this file is not supported yet
Sorry, the diff of this file is too big to display
Sorry, the diff of this file is not supported yet
License Policy Violation
LicenseThis package is not allowed per your license policy. Review the package's license to ensure compliance.
Found 1 instance in 1 package
No v1
QualityPackage is not semver >=1. This means it is not stable and does not support ^ ranges.
Found 1 instance in 1 package
License Policy Violation
LicenseThis package is not allowed per your license policy. Review the package's license to ensure compliance.
Found 1 instance in 1 package
2506891
28111
2