gettext_ngettext.phpt 574 B

123456789101112131415161718192021222324252627
  1. --TEST--
  2. Test ngettext() functionality
  3. --EXTENSIONS--
  4. gettext
  5. --SKIPIF--
  6. <?php
  7. if (!setlocale(LC_ALL, 'en_US.UTF-8')) {
  8. die("SKIP en_US.UTF-8 locale not supported.");
  9. }
  10. ?>
  11. --FILE--
  12. <?php
  13. chdir(__DIR__);
  14. putenv('LC_ALL=en_US.UTF-8');
  15. setlocale(LC_ALL, 'en_US.UTF-8');
  16. bindtextdomain('dngettextTest', './locale');
  17. textdomain('dngettextTest');
  18. var_dump(ngettext('item', 'items', 1));
  19. var_dump(ngettext('item', 'items', 2));
  20. ?>
  21. --EXPECT--
  22. string(7) "Produkt"
  23. string(8) "Produkte"
  24. --CREDITS--
  25. Christian Weiske, cweiske@php.net
  26. PHP Testfest Berlin 2009-05-09