#45833 [NEW]: Enable MessageFormatter to select custom currency

[email protected] ("mathieuk at gmail dot com")
Newsgroups php.bugs
Message-ID <[email protected]>
From:             mathieuk at gmail dot com
Operating system: MacOSX
PHP version:      5.3.0alpha1
PHP Bug Type:     Feature/Change Request
Bug description:  Enable MessageFormatter to select custom currency

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 bug report at http://bugs.php.net/?id=45833&edit=1
-- 
Try a CVS snapshot (PHP 5.2): http://bugs.php.net/fix.php?id=45833&r=trysnapshot52
Try a CVS snapshot (PHP 5.3): http://bugs.php.net/fix.php?id=45833&r=trysnapshot53
Try a CVS snapshot (PHP 6.0): http://bugs.php.net/fix.php?id=45833&r=trysnapshot60
Fixed in CVS:                 http://bugs.php.net/fix.php?id=45833&r=fixedcvs
Fixed in release:             http://bugs.php.net/fix.php?id=45833&r=alreadyfixed
Need backtrace:               http://bugs.php.net/fix.php?id=45833&r=needtrace
Need Reproduce Script:        http://bugs.php.net/fix.php?id=45833&r=needscript
Try newer version:            http://bugs.php.net/fix.php?id=45833&r=oldversion
Not developer issue:          http://bugs.php.net/fix.php?id=45833&r=support
Expected behavior:            http://bugs.php.net/fix.php?id=45833&r=notwrong
Not enough info:              http://bugs.php.net/fix.php?id=45833&r=notenoughinfo
Submitted twice:              http://bugs.php.net/fix.php?id=45833&r=submittedtwice
register_globals:             http://bugs.php.net/fix.php?id=45833&r=globals
PHP 4 support discontinued:   http://bugs.php.net/fix.php?id=45833&r=php4
Daylight Savings:             http://bugs.php.net/fix.php?id=45833&r=dst
IIS Stability:                http://bugs.php.net/fix.php?id=45833&r=isapi
Install GNU Sed:              http://bugs.php.net/fix.php?id=45833&r=gnused
Floating point limitations:   http://bugs.php.net/fix.php?id=45833&r=float
No Zend Extensions:           http://bugs.php.net/fix.php?id=45833&r=nozend
MySQL Configuration Error:    http://bugs.php.net/fix.php?id=45833&r=mysqlcfg
lmpx.com only provides a reader for public news (NNTP) servers. It is not affiliated with the servers or forums shown here and is not responsible for the content of articles, which is written by their respective authors.