Edit report at https://bugs.php.net/bug.php?id=63724&edit=1

 ID:                 63724
 Updated by:         fel...@php.net
 Reported by:        eskwayrd at gmail dot com
 Summary:            MessageFormatter buggy when using select formats
                     with nested parameters
-Status:             Open
+Status:             Not a bug
 Type:               Bug
 Package:            I18N and L10N related
 Operating System:   Linux
 PHP Version:        5.4.9
 Block user comment: N
 Private report:     N

 New Comment:

If it's really a problem, it occurred on ICU. See a related bug #62673

Using "{1, select, k {{0, number} kB} M {{0, number, #.##} MB} other {{0, 
number} B}}" does the job, somehow just like suggested in the bug I pointed out 
above.


Previous Comments:
------------------------------------------------------------------------
[2012-12-07 23:11:49] eskwayrd at gmail dot com

Description:
------------
When a message formatter formats selects with nested variables, its behaviour 
is 
buggy.

Test script:
---------------
// attempting to translate file size
$locale = 'en_US';
$args = array(1.23435, 'M');
$format = "{1, select, k {{0} kB} M {{0} MB} other {{0} B}}";
echo "#1: ". msgfmt_format_message($locale, $format, $args) ."\n";

$format = "{1, select, k {{0} kB} M {{0, number, #.##} MB} other {{0} B}}";
echo "#2: ". msgfmt_format_message($locale, $format, $args) ."\n";
echo "Error? ". intl_get_error_message() ."\n";

Expected result:
----------------
#1: 1.23435 MB
#2: 1.23 MB
Error? U_ZERO_ERROR


Actual result:
--------------
#1: 1.23435 MB
#2: 
Error? Creating message formatter failed: U_ARGUMENT_TYPE_MISMATCH


------------------------------------------------------------------------



-- 
Edit this bug report at https://bugs.php.net/bug.php?id=63724&edit=1

Reply via email to