Add locale-based currency formatting

Comments

xano’s picture

Status: Active » Needs review
xano’s picture

StatusFileSize
new11.74 KB
xano’s picture

StatusFileSize
new16.96 KB

This patch depends on #1868952: Update bartfeenstra/cldr.

This patch adds:
- Currency locale patterns that are a combination of locale information and a CLDR number pattern.
- Methods to format amounts using a locale pattern: CurrencyLocaleFormat::format() and Currency::format().
- A delegator to load the right pattern based on environment variables. It tries global $language->currency_country_code first, then variable_get('site_default_country'), both in combination with global $language->language. If these fail, then it loads the pattern for en_US (which is predefined and is consistent with Drupal's default language).
- Tests!

Status: Needs review » Needs work

The last submitted patch, currency_1848030_01.patch, failed testing.

xano’s picture

That weight property shouldn't be there.

xano’s picture

Status: Needs work » Needs review

#3: currency_1848030_01.patch queued for re-testing.

xano’s picture

#3: currency_1848030_01.patch queued for re-testing.

Status: Needs review » Needs work

The last submitted patch, currency_1848030_01.patch, failed testing.

amateescu’s picture

Status: Needs work » Needs review

#3: currency_1848030_01.patch queued for re-testing.

Status: Needs review » Needs work

The last submitted patch, currency_1848030_01.patch, failed testing.

xano’s picture

Yeah, working on this as we speak. Will probably finish it tomorrow as it's already late.

xano’s picture

Status: Needs work » Needs review
StatusFileSize
new16.77 KB
xano’s picture

FYI: I'll ad a follow-up issue to expand the list of number patterns for locale based on CLDR data. This means that if we commit this patch now, we can continue with at least three other issues that depend on this API, but not on specific number patterns being available.

amateescu’s picture

Status: Needs review » Fixed

Done! Committed to 7.x-2.x.

Status: Fixed » Closed (fixed)

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

xano’s picture

Assigned: xano » Unassigned