Req #45833 [Com]: Enable MessageFormatter to select custom currency

From: Date: Sun, 13 Sep 2015 21:25:51 +0000
Subject: Req #45833 [Com]: Enable MessageFormatter to select custom currency
References: 1  Groups: php.bugs 
Request: Send a blank email to php-bugs+get-195985@lists.php.net to get a copy of this message
Edit report at https://bugs.php.net/bug.php?id=45833&edit=1 ID: 45833 Comment by: sam at rmcreative dot ru Reported by: mathieuk at gmail dot com Summary: Enable MessageFormatter to select custom currency Status: Open Type: Feature/Change Request Package: Feature/Change Request Operating System: MacOSX PHP Version: 5.3.0alpha1 Block user comment: N Private report: N New Comment: Do you mean any of existing currencies? If so, you can do it via specifying it in locale string via "@currency". See http://gostash.it/ru/stashes/327. Previous Comments: ------------------------------------------------------------------------ [2008-08-16 09:32:33] mathieuk at gmail dot com Description: ------------ Feature Request for the intl extension The MessageFormatter is capable of formatting a number in a currency format. This is only marginally useful because it always uses the currency symbol for the locale given to it. It probably wouldn't be uncommon to want to display a currency in your own currency format, but using a different currency symbol. Reproduce code: --------------- <?php $msgfmt = MessageFormatter::create('nl_NL', 'Price (USD): {0,number,currency}'); /* I'm assuming the format {0,number,currency} is not editable to something like {0,number,currency,USD} because it is defined in a underlying library. So I propose the following new method: */ $msgfmt->setCurrency('USD'); echo $msgfmt->format(array(15.95)); ?> Expected result: ---------------- Price (USD): $ 15,00 Actual result: -------------- (without the imagined setCurrency call) Price (USD): € 15,00 ------------------------------------------------------------------------ -- Edit this bug report at https://bugs.php.net/bug.php?id=45833&edit=1

« previous php.bugs (#195985) next »