1.4. Special Locale Keys for Price Representation
Interchange honors the standard POSIX keys:
mon_decimal_point or decimal_point mon_thousands_sep or thousands_sep currency_symbol or int_currency_symbol frac_digits or p_cs_precedes
See the POSIX setlocale(3) man page for more information. These keys will be used for formatting prices and approximates the number format used in most countries. To set a custom price format, use these special keys:
price_picture
-
Interchange will format a currency number based on a "picture" given to it. The basic form is:
Locale en_US price_picture "$ ###,###,###.##"
-
The en_US locale, for the United States, would display 4452.3 as $ 4,452.30. The same display can be achieved with:
Locale en_US mon_thousands_sep , Locale en_US mon_decimal_point . Locale en_US p_cs_precedes 1 Locale en_US currency_symbol $
-
A common price_picture for European countries would be ###.###.###,##, which would display that same number as 4.452,30. To add a franc notation at the end for the locale fr_FR, use the setting:
Locale fr_FR price_picture "##.###,## fr"
IMPORTANT NOTE: The decimal point in use, set by mon_decimal_point, and the thousands separator, set by mon_thousands_sep must match the settings in the price_picture. The frac_digits setting is not used in this case. It is derived from the location of the decimal (if any).
-
The same setting for fr_FR above can be achieved with:
Locale fr_FR mon_thousands_sep . Locale fr_FR mon_decimal_point , Locale fr_FR p_cs_precedes 0 Locale fr_FR currency_symbol fr
-
If the number of digits is greater than the # locations in the price_picture, the digits will be changed to asterisks. An overflow number above would show as **.***,** fr.
picture
-
Same as price_picture, but sets the value returned if the [currency] tag is not used. If the number of digits is greater than the # locations in the picture, the digits will be changed to asterisks, displaying something like **,***.**.