-
Notifications
You must be signed in to change notification settings - Fork 27.5k
Trailing space issue in Angular Locale #15018
Comments
This is kind of expected and is not specific to the According to the You won't see the same problem with the default The easy way out is to trim the output before returning it to the user, but I am not sure if there are valid usecases for having leading/trailing whitespace characters. Does anyone happen to have any insights on that? Obviously, it is very easy to work-around it yourself - if you are sure you don't need the extra space - by:
EDIT: These are suggested as work-arounds for people to use in their apps, until this is properly fixed in core. |
I think it make sense to have the currency filter do the trimming in core itself, as it sounds like it is unintended behavior in this case. The overhead added should be minimal, and it would be easy to address without impacting anyone. |
The only thing I am concerned/unsure about, is whether there is some locale that requires a space before/after its values. (I doubt it, but I am not sure either.) |
From a quick search through the i18n files I didn't find any locale for which the trimming would be problematic. This is more involved though, because there is another usecase that suffers from the same issue, but won't be solved by trimming: negative values for locales that have the currency symbol before the number. E.g.: // Assuming a locale that formats `10` as `X 10.00` and `-10` as `-X 10`
// (where `X` is the currency symbol):
// Desired
currencyFilter(-10, '') // --> '-10'
// Actual
currencyFilter(-10, '') // --> '- 10' (space between `-` and `10`) |
I want to thank you guys for the involvement on this matter. |
In most locales, this won't make a difference (since they do not have whotespace around their currency symbols). In locales where there is a whitespace separating the currency symbol from the number, it makes sense to also remove such whitespace if the user specified an empty currency symbol (indicating they just want the number). Fixes angular#15018 Closes angular#15085
In most locales, this won't make a difference (since they do not have whotespace around their currency symbols). In locales where there is a whitespace separating the currency symbol from the number, it makes sense to also remove such whitespace if the user specified an empty currency symbol (indicating they just want the number). Fixes angular#15018 Closes angular#15085
In most locales, this won't make a difference (since they do not have whitespace around their currency symbols). In locales where there is a whitespace separating the currency symbol from the number, it makes sense to also remove such whitespace if the user specified an empty currency symbol (indicating they just want the number). Fixes #15018 Closes #15085 Closes #15105
Note: for support questions, please use one of these channels: https://github.com/angular/angular.js/blob/master/CONTRIBUTING.md#question. This repository's issues are reserved for feature requests and bug reports.
Do you want to request a feature or report a bug?
Reporting a bug
What is the current behavior?
A trailing space is added to RO and IT angular locale, maybe in similar locales as well.
If the current behavior is a bug, please provide the steps to reproduce and if possible a minimal demo of the problem via https://plnkr.co or similar (template: http://plnkr.co/edit/tpl:yBpEi4).
DEMO: http://jsfiddle.net/4gyjtu8g/245/
What is the expected behavior?
There should be no trailing space, like the EN angular locale
What is the motivation / use case for changing the behavior?
To fix a general bug
Which versions of Angular, and which browser / OS are affected by this issue? Did this work in previous versions of Angular? Please also test with the latest stable and snapshot (https://code.angularjs.org/snapshot/) versions.
http://ajax.googleapis.com/ajax/libs/angularjs/1.3.0/angular.min.js
https://cdnjs.cloudflare.com/ajax/libs/angular-i18n/1.5.8/angular-locale_ro.js
Other information (e.g. stacktraces, related issues, suggestions how to fix)
The text was updated successfully, but these errors were encountered: