Skip to content
This repository has been archived by the owner on Apr 12, 2024. It is now read-only.

Negative currency amount is displayed as $-xxx,xxx.xx for en-us culture #10158

Closed
clement911 opened this issue Nov 21, 2014 · 6 comments
Closed

Comments

@clement911
Copy link

Shouldn't a negative currency amount be displayed -$xxx,xxx.xx for en-us ?

With that commit it will show as $-xxx,xxx.xx which is kind of weird...

@petebacondarwin
Copy link
Member

I believe that this is because the en-us locale info in CLDR does not provide a specific negative pattern and so we "guess" at it on this line: https://github.com/angular/angular.js/blob/master/i18n/src/parser.js#L59

@shwei
Copy link
Contributor

shwei commented Nov 22, 2014

@clement911 Using currency filter, the current display of negative US currency is wrapped around by parenthesis. e.g. ($1234.56) . Sample: http://plnkr.co/edit/w16eMG8LzJ1pe4iuPaum?p=preview

Don't know how you did it so I can reproduce it. Can you please provide a Plnkr? Thanks!

@petebacondarwin
Copy link
Member

@shwei - you need to load the en-US locale. See http://plnkr.co/edit/Gz9GcM1CarYuD4YRV5VB?p=preview

@clement911
Copy link
Author

I'm pretty sure this line is where the regression is:
https://github.com/angular/angular.js/blob/master/src/ngLocale/angular-locale_en-us.js#L105

By the way, this issue affects other cultures too, for example en-au.

@clement911
Copy link
Author

@petebacondarwin when "guessing" the negative pattern would it be more appropriate to use
p.negPre = '-' + p.posPre;
instead of
p.negPre = p.posPre + '-';

@shwei
Copy link
Contributor

shwei commented Nov 30, 2014

Thanks for the clarification, @clement911 and @petebacondarwin. I think in en-us '-' + p.posPre makes more sense.

Based on CLDR's documentation, displaying negative currency with a parenthesis around the number is a currency-accounting type. http://cldr.unicode.org/translation/number-patterns They changed the default display of a negative currency from a number in a parenthesis to prefixing it with a minus sign. A number in a parenthesis for negative currency is considered an accounting form based on this ticket: http://unicode.org/cldr/trac/ticket/5674

So for en-us, should we make negative currency to be displayed like -$123.45?

@lgalfaso lgalfaso removed their assignment Dec 16, 2014
petebacondarwin added a commit to petebacondarwin/angular.js that referenced this issue Jul 16, 2015
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
petebacondarwin added a commit to petebacondarwin/angular.js that referenced this issue Jul 16, 2015
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 and
http://unicode.org/cldr/trac/ticket/5674

Closes angular#10158
@petebacondarwin petebacondarwin self-assigned this Jul 16, 2015
petebacondarwin added a commit to petebacondarwin/angular.js that referenced this issue Jul 16, 2015
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 and
http://unicode.org/cldr/trac/ticket/5674

Closes angular#10158
petebacondarwin added a commit to petebacondarwin/angular.js that referenced this issue Jul 16, 2015
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 and
http://unicode.org/cldr/trac/ticket/5674

Closes angular#10158
petebacondarwin added a commit that referenced this issue Jul 27, 2015
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 and
http://unicode.org/cldr/trac/ticket/5674

Closes #10158
netman92 pushed a commit to netman92/angular.js that referenced this issue Aug 8, 2015
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 and
http://unicode.org/cldr/trac/ticket/5674

Closes angular#10158
netman92 pushed a commit to netman92/angular.js that referenced this issue Aug 8, 2015
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 and
http://unicode.org/cldr/trac/ticket/5674

Closes angular#10158
ggershoni pushed a commit to ggershoni/angular.js that referenced this issue Sep 29, 2015
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 and
http://unicode.org/cldr/trac/ticket/5674

Closes angular#10158
ggershoni pushed a commit to ggershoni/angular.js that referenced this issue Sep 29, 2015
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 and
http://unicode.org/cldr/trac/ticket/5674

Closes angular#10158
Sign up for free to subscribe to this conversation on GitHub. Already have an account? Sign in.