Skip to content

Conversation

@Ayesh
Copy link
Member

@Ayesh Ayesh commented Mar 9, 2025

ICU 54 and 56 add the following formatters1 for currency formatting:

  • CURRENCY_ISO2: ISO currency code, e.g., "USD1.00"
  • CURRENCY_PLURAL3: pluralized currency name, e.g., "1.00 US dollar" and "3.00 US dollars"
  • CASH_CURRENCY4: currency symbol given CASH usage, e.g., "NT$3" instead of "NT$3.23"
  • CURRENCY_STANDARD5: currency symbol, e.g., "$1.00", using non-accounting style for negative values (e.g. minus sign)

Ref: https://unicode-org.github.io/icu-docs/apidoc/dev/icu4c/unum_8h.html

This adds support for all four of them to ext/intl, along with tests.

Footnotes

  1. https://unicode-org.github.io/icu-docs/apidoc/dev/icu4c/unum_8h.html

  2. https://unicode-org.github.io/icu-docs/apidoc/dev/icu4c/unum_8h.html#a4eb4d3ff13bd506e7078b2be4052266daae232c48e579c727525855cd21571033

  3. https://unicode-org.github.io/icu-docs/apidoc/dev/icu4c/unum_8h.html#a4eb4d3ff13bd506e7078b2be4052266da3916bb92d0784396ea2331d4f04c03f5

  4. https://unicode-org.github.io/icu-docs/apidoc/dev/icu4c/unum_8h.html#a4eb4d3ff13bd506e7078b2be4052266da8da9eba1a27d5734599709c137c3b82f

  5. https://unicode-org.github.io/icu-docs/apidoc/dev/icu4c/unum_8h.html#a4eb4d3ff13bd506e7078b2be4052266dac57cfff1b245d11774e8b109b98eedc2

@devnexen
Copy link
Member

devnexen commented Mar 9, 2025

Looking good so far, thanks. I ll be back at it a bit later.

@Ayesh Ayesh force-pushed the icu-56-currency branch 2 times, most recently from 43cb2ca to 6a92900 Compare March 9, 2025 17:27
@Ayesh Ayesh force-pushed the icu-56-currency branch from 6a92900 to 24db79b Compare April 4, 2025 13:57
…nd `CASH_CURRENCY`

ICU 54 and 56 adds the following formatters[^1] for currency formatting:

 - `CURRENCY_ISO`[^2]: ISO currency code, e.g., "USD1.00"
 - `CURRENCY_PLURAL`[^3]: pluralized currency name, e.g., "1.00 US dollar" and "3.00 US dollars"
 - `CASH_CURRENCY`[^4]: currency symbol given CASH usage, e.g., "NT$3" instead of "NT$3.23"
 - `CURRENCY_STANDARD`[^5]: currency symbol, e.g., "$1.00", using non-accounting style for negative values (e.g. minus sign)

Ref: https://unicode-org.github.io/icu-docs/apidoc/dev/icu4c/unum_8h.html

This adds support for all four of them to ext/intl, along with tests.

[^1]: https://unicode-org.github.io/icu-docs/apidoc/dev/icu4c/unum_8h.html
[^2]: https://unicode-org.github.io/icu-docs/apidoc/dev/icu4c/unum_8h.html#a4eb4d3ff13bd506e7078b2be4052266daae232c48e579c727525855cd21571033
[^3]: https://unicode-org.github.io/icu-docs/apidoc/dev/icu4c/unum_8h.html#a4eb4d3ff13bd506e7078b2be4052266da3916bb92d0784396ea2331d4f04c03f5
[^4]: https://unicode-org.github.io/icu-docs/apidoc/dev/icu4c/unum_8h.html#a4eb4d3ff13bd506e7078b2be4052266da8da9eba1a27d5734599709c137c3b82f
[^5]: https://unicode-org.github.io/icu-docs/apidoc/dev/icu4c/unum_8h.html#a4eb4d3ff13bd506e7078b2be4052266dac57cfff1b245d11774e8b109b98eedc2
@Ayesh Ayesh force-pushed the icu-56-currency branch from 24db79b to 6f987c2 Compare April 8, 2025 22:37
@Ayesh Ayesh merged commit c20b429 into php:master Apr 8, 2025
8 of 9 checks passed
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Projects

None yet

Development

Successfully merging this pull request may close these issues.

2 participants