msgfmt_bug70484.phpt 2.2 KB

12345678910111213141516171819202122232425262728293031323334353637383940414243444546474849505152535455565758596061626364656667686970717273747576777879808182838485868788899091929394959697
  1. --TEST--
  2. Bug #70484 selectordinal doesn't work with named parameters
  3. --SKIPIF--
  4. <?php
  5. if (!extension_loaded('intl'))
  6. die('skip intl extension not enabled');
  7. if (version_compare(INTL_ICU_VERSION, '5.0') < 0)
  8. die('skip for ICU 5.0+');
  9. --FILE--
  10. <?php
  11. $locale = array("de", "fr", "en", "ru",);
  12. $data = array(42, 42.42, 2147483643, 2147483643.12345, 5);
  13. foreach ($locale as $lc) {
  14. echo "$lc string key\n";
  15. $m = new MessageFormatter($lc, "{n, selectordinal, =5 {five} zero {#-zero} one {#-one} two {#-two} few {#-few} many {#-many} other {#-other}}");
  16. foreach ($data as $i) {
  17. var_dump($m->format(array("n" => $i)));
  18. if ($m->getErrorCode()) {
  19. echo "$lc $i ", $m->getErrorMessage();
  20. }
  21. }
  22. echo "\n";
  23. echo "$lc numeric key\n";
  24. $m = new MessageFormatter($lc, "{0, selectordinal, =5 {five} zero {#-zero} one {#-one} two {#-two} few {#-few} many {#-many} other {#-other}}");
  25. foreach ($data as $i) {
  26. var_dump($m->format(array($i)));
  27. if ($m->getErrorCode()) {
  28. echo "$lc $i ", $m->getErrorMessage();
  29. }
  30. }
  31. echo "\n";
  32. }
  33. ?>
  34. ==DONE==
  35. --EXPECT--
  36. de string key
  37. string(8) "42-other"
  38. string(11) "42,42-other"
  39. string(19) "2.147.483.643-other"
  40. string(23) "2.147.483.643,123-other"
  41. string(4) "five"
  42. de numeric key
  43. string(8) "42-other"
  44. string(11) "42,42-other"
  45. string(19) "2.147.483.643-other"
  46. string(23) "2.147.483.643,123-other"
  47. string(4) "five"
  48. fr string key
  49. string(8) "42-other"
  50. string(11) "42,42-other"
  51. string(22) "2 147 483 643-other"
  52. string(26) "2 147 483 643,123-other"
  53. string(4) "five"
  54. fr numeric key
  55. string(8) "42-other"
  56. string(11) "42,42-other"
  57. string(22) "2 147 483 643-other"
  58. string(26) "2 147 483 643,123-other"
  59. string(4) "five"
  60. en string key
  61. string(6) "42-two"
  62. string(11) "42.42-other"
  63. string(17) "2,147,483,643-few"
  64. string(23) "2,147,483,643.123-other"
  65. string(4) "five"
  66. en numeric key
  67. string(6) "42-two"
  68. string(11) "42.42-other"
  69. string(17) "2,147,483,643-few"
  70. string(23) "2,147,483,643.123-other"
  71. string(4) "five"
  72. ru string key
  73. string(8) "42-other"
  74. string(11) "42,42-other"
  75. string(22) "2 147 483 643-other"
  76. string(26) "2 147 483 643,123-other"
  77. string(4) "five"
  78. ru numeric key
  79. string(8) "42-other"
  80. string(11) "42,42-other"
  81. string(22) "2 147 483 643-other"
  82. string(26) "2 147 483 643,123-other"
  83. string(4) "five"
  84. ==DONE==