Skip to content

Commit bbd4c4e

Browse files
fix(i18n): by default put negative sign before currency symbol
It seems that the case where the negative sign goes between the currency symbol and the numeric value is actually the special case and that locales that require this have it built in. So we should default to having the negative sign before the symbol. See http://cldr.unicode.org/translation/number-patterns Closes angular#10158
1 parent 137b255 commit bbd4c4e

File tree

2 files changed

+4
-4
lines changed

2 files changed

+4
-4
lines changed

i18n/spec/parserSpec.js

+3-3
Original file line numberDiff line numberDiff line change
@@ -38,16 +38,16 @@ describe('parsePattern', function() {
3838
parseAndExpect('#,##,##0.00\u00A4', '', '-', '\u00A4', '\u00A4', 1, 2, 2, 2, 3);
3939
parseAndExpect('#,##,##0.00\u00A4;(#,##,##0.00\u00A4)',
4040
'', '(', '\u00A4', '\u00A4)', 1, 2, 2, 2, 3);
41-
parseAndExpect('\u00A4#,##0.00', '\u00A4', '\u00A4-', '', '', 1, 2, 2, 3, 3);
41+
parseAndExpect('\u00A4#,##0.00', '\u00A4', '-\u00A4', '', '', 1, 2, 2, 3, 3);
4242
parseAndExpect('\u00A4#,##0.00;(\u00A4#,##0.00)',
4343
'\u00A4', '(\u00A4', '', ')', 1, 2, 2, 3, 3);
4444
parseAndExpect('\u00A4#,##0.00;\u00A4-#,##0.00',
4545
'\u00A4', '\u00A4-', '', '', 1, 2, 2, 3, 3);
46-
parseAndExpect('\u00A4 #,##0.00', '\u00A4 ', '\u00A4 -', '', '', 1, 2, 2, 3, 3);
46+
parseAndExpect('\u00A4 #,##0.00', '\u00A4 ', '-\u00A4 ', '', '', 1, 2, 2, 3, 3);
4747
parseAndExpect('\u00A4 #,##0.00;\u00A4-#,##0.00',
4848
'\u00A4 ', '\u00A4-', '', '', 1, 2, 2, 3, 3);
4949
parseAndExpect('\u00A4 #,##0.00;\u00A4 #,##0.00-',
5050
'\u00A4 ', '\u00A4 ', '', '-', 1, 2, 2, 3, 3);
51-
parseAndExpect('\u00A4 #,##,##0.00', '\u00A4 ', '\u00A4 -', '', '', 1, 2, 2, 2, 3);
51+
parseAndExpect('\u00A4 #,##,##0.00', '\u00A4 ', '-\u00A4 ', '', '', 1, 2, 2, 2, 3);
5252
});
5353
});

i18n/src/parser.js

+1-1
Original file line numberDiff line numberDiff line change
@@ -56,7 +56,7 @@ function parsePattern(pattern) {
5656
p.negSuf = negative.substr(pos + trunkLen).replace(/\'/g, '');
5757
} else {
5858
// hardcoded '-' sign is fine as all locale use '-' as MINUS_SIGN. (\u2212 is the same as '-')
59-
p.negPre = p.posPre + '-';
59+
p.negPre = '-' + p.posPre;
6060
p.negSuf = p.posSuf;
6161
}
6262

0 commit comments

Comments
 (0)