Giter Site home page Giter Site logo

Comments (5)

ryelle avatar ryelle commented on September 25, 2024 1

Looks like there's a core javascript function we can use for this: Intl.NumberFormat() – and we only need to know the currency of the number + locale code 👍 Seems well supported in browsers too.

from woocommerce-admin.

timmyc avatar timmyc commented on September 25, 2024

For context, JetPack uses i18n-calypso

Seems reasonable to use it here as well.

from woocommerce-admin.

timmyc avatar timmyc commented on September 25, 2024

Chatted a bit with @ryelle about this topic today, and she brought up an excellent point that is might be a good instance where we could potentially contribute something back to Gutenberg/Core. JavaScript i18n is still in development in core, and numberFormat as you noted is missing right now.

So in lieu of taking the easy road by using i18n-calypso.numberFormat() we could consider porting the logic ( which appears pretty simple ) to wp.i18n.

Seems like the items needed can be groked from $wp_locale. Counterpart wp core code can be seen here

from woocommerce-admin.

timmyc avatar timmyc commented on September 25, 2024

Did a quick look at gutenberg again today to see if there was any hidden features around this, and at least in the word count component, there is no i18n on numbers happening:

no-number-i18n-gutenberg

from woocommerce-admin.

timmyc avatar timmyc commented on September 25, 2024

Great find @ryelle - since we only need to support IE11 and > # I think this will work perfectly - going to close out this issue

from woocommerce-admin.

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.