Coder Social home page Coder Social logo

Comments (6)

patrys avatar patrys commented on July 17, 2024

It is a valid output for both ru and ru-RU locales. Comma is used as a decimal separator and currency code is properly placed as a suffix.

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 $"

from django-prices.

BredoGen avatar BredoGen commented on July 17, 2024

It is a valid output for both ru and ru-RU locales. Comma is used as a decimal separator and currency code is properly placed as a suffix.

Sorry, yes, both versions are valid for Russian. But $ as prefix is more common for prices in e-commerce.

Introducing optional LC_NUMERIC env will give a chance to use different LANGUAGE and NUMERIC locale for such cases (Babel already uses it in format_currency() method).

from django-prices.

patrys avatar patrys commented on July 17, 2024

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?

from django-prices.

BredoGen avatar BredoGen commented on July 17, 2024

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.

You're right. If LC_NUMERIC will be exported by the OS - it'll break multi-language currency localization setup.

What about the decimal point character being different?

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

from django-prices.

patrys avatar patrys commented on July 17, 2024

What if there was a way to override certain settings on a per-locale setting? For example to say that you want to use ¤ #,##0.00 for US dollars in Russian.

from django-prices.

BredoGen avatar BredoGen commented on July 17, 2024

What if there was a way to override certain settings on a per-locale setting? For example to say that you want to use ¤ #,##0.00 for US dollars in Russian.

It will be great feature and it'll completely resolve the problem

from django-prices.

Related Issues (20)

Recommend Projects

  • React photo React

    A declarative, efficient, and flexible JavaScript library for building user interfaces.

  • Vue.js photo Vue.js

    🖖 Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.

  • Typescript photo Typescript

    TypeScript is a superset of JavaScript that compiles to clean JavaScript output.

  • TensorFlow photo TensorFlow

    An Open Source Machine Learning Framework for Everyone

  • Django photo Django

    The Web framework for perfectionists with deadlines.

  • D3 photo D3

    Bring data to life with SVG, Canvas and HTML. 📊📈🎉

Recommend Topics

  • javascript

    JavaScript (JS) is a lightweight interpreted programming language with first-class functions.

  • web

    Some thing interesting about web. New door for the world.

  • server

    A server is a program made to process requests and deliver data to clients.

  • Machine learning

    Machine learning is a way of modeling and interpreting data that allows a piece of software to respond intelligently.

  • Game

    Some thing interesting about game, make everyone happy.

Recommend Org

  • Facebook photo Facebook

    We are working to build community through open source technology. NB: members must have two-factor auth.

  • Microsoft photo Microsoft

    Open source projects and samples from Microsoft.

  • Google photo Google

    Google ❤️ Open Source for everyone.

  • D3 photo D3

    Data-Driven Documents codes.