-
Notifications
You must be signed in to change notification settings - Fork 51
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
"amount" template filter ignores LC_NUMERIC environment variable #66
Comments
It is a valid output for both I've also verified that with the Unicode CLDR database. Javascript behaves the same: console.log((11.49).toLocaleString("ru", {style: "currency", currency: "USD"}))
// "11,49 $" |
Sorry, yes, both versions are valid for Russian. But $ as prefix is more common for prices in e-commerce. Introducing optional |
Wouldn't using LC_NUMERIC override the format for all languages? There are systems where that variable is exported by the OS which would force the user to explicitly override it which I'm sure would result in bugs being filed against Saleor. What about the decimal point character being different? |
You're right. If
Using dot as decimal separator for USD prices in Russian is OK and even more common. Everyone is used to see USD prices in English formatting in e-commerce. Comma as separator and suffix notation is more common for rubles prices: 10,000 RUB. So, there is no easy solution to include in core. It's better for me to override "amount" filter implementing my custom logic there (maybe via dict in settings which will override numeric locale for some languages). Now I realize that this feature is redundant for core functionality. Sorry for erroneous report |
What if there was a way to override certain settings on a per-locale setting? For example to say that you want to use |
It will be great feature and it'll completely resolve the problem |
Hi.
There is a problem using Saleor/django-prices in case with some default locales:
e.g:
Usage:
{{ price|amount:'html' }}
Output: 11,49 $
It is not valid output for USD currency (even for RU locale). The valid one is classic $11.49
Reason:
"|amount" template filter forces currency format by passing the current language to Babel as locale (see templatetags/prices_i18n.py:42).
Babel supports overriding numeric locale via LC_NUMERIC env.
It will be very useful if get_locale_data() in prices_i18n.py will be checking this env before passing currency locale to Babel.
The text was updated successfully, but these errors were encountered: