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:

  1. The country code set using CurrencyLocalePattern::setCountryCode() and the current page language.
  2. The site's default country (configured at Home » Administration » Configuration » Regional and language » Regional settings) and the current page language.
  3. 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.