Support for Drupal 7 is ending on 5 January 2025—it’s time to migrate to Drupal 10! Learn about the many benefits of Drupal 10 and find migration tools in our resource center.
Currency 2 displays prices/amounts based on users' locales, so they are formatted in a way that is familiar to them. The different formats can be configured at Home » Administration » Configuration » Regional and language » Currency localization. Locales consist of a language and a country, and formatting patterns are configured per locale. Currency tries the following combinations to find a formatting pattern:
- The country code set using
CurrencyLocalePattern::setCountryCode()
and the current page language. - The site's default country (configured at Home » Administration » Configuration » Regional and language » Regional settings) and the current page language.
- English and the United States of America.
This means that if you want to use your own country detection mechanism, your module will have to call CurrencyLocalePattern::setCountryCode()
every single page request.