note 112661 added to messageformatter.formatmessage
| From: | zlobnygrif at gmail dot com | Date: | Wed, 10 Jul 2013 05:59:19 +0000 |
| Subject: | note 112661 added to messageformatter.formatmessage | ||
| Groups: | php.notes | ||
| Request: | Send a blank email to php-notes+get-195555@lists.php.net to get a copy of this message | ||
<?php
var_dump(
msgfmt_format_message('ru_RU', 'The value of {somekey} is {0, choice, 0 #less 12|
12 #between 12 and 32| 32 #more than 32}', ['SomeAnotherKey' => -1]),
msgfmt_format_message('ru_RU', 'The value of {somekey} is {0, choice, 0 #less 12|
12 #between 12 and 32| 32 #more than 32}', [14]),
msgfmt_format_message('ru_RU', 'The value of {somekey} is {0, choice, 0 #less 12|
12 #between 12 and 32| 32 #more than 32}', [133]),
msgfmt_format_message('ru_RU', '{0, plural, =0{Zero}=1{One}other{Unknown #}}',
[0]),
msgfmt_format_message('ru_RU', '{0, plural, =0{Zero}=1{One}other{Unknown #}}',
[1]),
msgfmt_format_message('ru_RU', '{0, plural, =0{Zero}=1{One}other{Unknown #}}',
[2]),
msgfmt_format_message('ru_RU', '{0, select, somevalue{This is some value}
other{Unknown value}}', ['somevalue']),
msgfmt_format_message('ru_RU', '{0, select, somevalue{This is some value}
other{Unknown value "{0}"}}', ['somevalue2'])
);
var_dump(
msgfmt_format_message('en_GB', 'Peter has {0, plural, =0{no cat} =1{a cat} other{#
cats}}', [0]),
msgfmt_format_message('en_GB', 'Peter has {0, plural, =0{no cat} =1{a cat} other{#
cats}}', [1]),
msgfmt_format_message('en_GB', 'Peter has {0, plural, =0{no cat} =1{a cat} other{#
cats}}', [2])
);
?>
Output (PHP 5.4.17RC1)
==========================
string 'The value of -1 is less 12' (length=26)
string 'The value of 14 is between 12 and 32' (length=36)
string 'The value of 133 is more than 32' (length=32)
string 'Zero' (length=4)
string 'One' (length=3)
string 'Unknown 2' (length=9)
string 'This is some value' (length=18)
string 'Unknown value "somevalue2"' (length=26)
string 'Peter has no cat' (length=16)
string 'Peter has a cat' (length=15)
string 'Peter has 2 cats' (length=16)
----
Server IP: 69.147.83.199
Probable Submitter: 91.215.129.130
----
Manual Page -- http://php.net/manual/en/messageformatter.formatmessage.php
Edit -- https://master.php.net/note/edit/112661
Del: integrated -- https://master.php.net/note/delete/112661/integrated
Del: useless -- https://master.php.net/note/delete/112661/useless
Del: bad code -- https://master.php.net/note/delete/112661/bad+code
Del: spam -- https://master.php.net/note/delete/112661/spam
Del: non-english -- https://master.php.net/note/delete/112661/non-english
Del: in docs -- https://master.php.net/note/delete/112661/in+docs
Del: other reasons-- https://master.php.net/note/delete/112661
Reject -- https://master.php.net/note/reject/112661
Search -- https://master.php.net/manage/user-notes.php