Right now we're using the previous branch of intl. The new branch brings us many improvements:

- New CurrencyFormatter (split off from NumberFormatter) which accepts a currency code instead of a currency object (we have a ton of @todos wishing for that in our code), and is a proper service (no need for a factory anymore)
- Better number formatting performance (number formats now in PHP, no longer need to be cached in the db; much faster locale resolving)
- New CLDR release (updated currency list, number format rules)
- Fix for #2947013: Price is 0,00 when using Bulgarian language.

We are postponed on Address, which needs a release for commerceguys/addressing v1.0. That will remove commerceguys/intl from the Address dependencies, making it possible for us to bump the intl requirement here without a conflict.

Once that happens, we need to do the following:
- Update commerceguys/intl in composer.json and ludwig.json
- Update NumberFormatRepository for the new structure (no more caching, event fired from processDefinition()).
- Deprecate NumberFormatEvent (can't be fired anymore, the NumberFormat object is no longer mutable), introduce a NumberFormatDefinitionEvent that acts on the definition array.
- Remove usage of CurrencyEntityInterface, add setters to our own CurrencyInterface.
- Implement a CurrencyRepository (commerce_price.currency_repository), powered by our entity data.
- Create a CurrencyFormatter (commerce_price.currency_formatter) which inherits the library class, sets the defaultLocale.
- Deprecate commerce_price.number_formatter_factory
- Create a LegacyNumberFormatter class (with a deprecation trigger_error), which has formatCurrency($number, $currency), and proxies to the real CurrencyFormatter. Return it from the number formatter factory. Confirm that old code still works.

Once all of that is done and the tests are green, we can convert all usage of the number formatter factory (formatters, etc), resolving our @todos in the process.

Comments

bojanz created an issue. See original summary.

bojanz’s picture

Status: Active » Needs review

This was a big one!

A bonus point is that the formatters now work even if the currency was deleted (by falling back to using the currency code in the formatted number), fixing half of #2895457: Guard against deleted currencies.

Change record created.

Commit: https://github.com/drupalcommerce/commerce/commit/50e710a1cbfaf910f3b4b5...
Travis run: https://travis-ci.org/drupalcommerce/commerce/jobs/384533896

  • bojanz committed 4abaae7 on 8.x-2.x
    Issue #2971732: Update for commerceguys/intl v1.0
    
bojanz’s picture

Status: Needs review » Fixed

Status: Fixed » Closed (fixed)

Automatically closed - issue fixed for 2 weeks with no activity.