php.net |  support |  documentation |  report a bug |  advanced search |  search howto |  statistics |  random bug |  login
Request #65627 Support select for MessageFormatter
Submitted: 2013-09-06 01:10 UTC Modified: 2013-10-16 23:28 UTC
Votes:5
Avg. Score:3.8 ± 1.0
Reproduced:2 of 5 (40.0%)
Same Version:2 (100.0%)
Same OS:2 (100.0%)
From: f21 dot groups at gmail dot com Assigned:
Status: Closed Package: intl (PECL)
PHP Version: 5.5.3 OS: Ubuntu 13.04 64-bit
Private report: No CVE-ID: None
Welcome back! If you're the original bug submitter, here's where you can edit the bug or add additional notes.
If you forgot your password, you can retrieve your password here.
Password:
Status:
Package:
Bug Type:
Summary:
From: f21 dot groups at gmail dot com
New email:
PHP Version: OS:

 

 [2013-09-06 01:10 UTC] f21 dot groups at gmail dot com
Description:
------------
The choice conditional selector has been deprecated in ICU.

Instead, it is now recommended to use select, which does not seem to be supported.

$fmt = new MessageFormatter("fr_FR", "{0} est {1, select, female {allée} other {allé}}");

var_dump($fmt); //null


Test script:
---------------
<?php

$fmt = new MessageFormatter("fr_FR", "{0} est {1, select, female {allée} other {allé}}");

var_dump($fmt); //null


Expected result:
----------------
$fmt should not be null and should work propertly.

Actual result:
--------------
$fmt is null

Patches

Pull Requests

History

AllCommentsChangesGit/SVN commitsRelated reports
 [2013-10-16 21:19 UTC] sam at rmcreative dot ru
Select format is definitely supported. I've copy-pasted your code and it works just fine with 5.3, 5.4 and 5.5.

$fmt = new \MessageFormatter("fr_FR", "{0} est {1, select, female {allée} other {allé}}");
echo $fmt->format(array('Eugenia', 'female'));

// result is 'Eugenia est allée'

I guess the issue is that pattern should be in UTF-8 and you're using something else.
 [2013-10-16 23:28 UTC] f21 dot groups at gmail dot com
-Status: Open +Status: Closed
 [2013-10-16 23:28 UTC] f21 dot groups at gmail dot com
You are right!
 
PHP Copyright © 2001-2024 The PHP Group
All rights reserved.
Last updated: Tue Oct 15 10:01:27 2024 UTC