Created
October 2, 2013 16:08
-
-
Save blar/6796150 to your computer and use it in GitHub Desktop.
INTL MessageFormatter mit benannten Parametern
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
| <?php | |
| $formatter = new MessageFormatter('de', '{comments, plural, =0 {Keine Kommentare} =1 {# Kommentar} other {# Kommentare}}'); | |
| for($comments = 0; $comments < 10; $comments++) { | |
| var_dump($formatter->format(array( | |
| 'comments' => $comments | |
| ))); | |
| } | |
| string(16) "Keine Kommentare" | |
| string(11) "1 Kommentar" | |
| string(12) "2 Kommentare" | |
| string(12) "3 Kommentare" | |
| string(12) "4 Kommentare" | |
| string(12) "5 Kommentare" | |
| string(12) "6 Kommentare" | |
| string(12) "7 Kommentare" | |
| string(12) "8 Kommentare" | |
| string(12) "9 Kommentare" |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment