1--TEST-- 2Test if dngettext() returns the correct translations (optionally plural). 3--SKIPIF-- 4<?php 5if (!extension_loaded("gettext")) { 6 die("skip gettext extension is not loaded.\n"); 7} 8if (!setlocale(LC_ALL, 'en_US.UTF-8')) { 9 die("skip en_US.UTF-8 locale not supported."); 10} 11--FILE-- 12<?php 13chdir(dirname(__FILE__)); 14setlocale(LC_ALL, 'en_US.UTF-8'); 15bindtextdomain('dngettextTest', './locale'); 16 17var_dump(dngettext('dngettextTest', 'item', 'items', 1)); 18var_dump(dngettext('dngettextTest', 'item', 'items', 2)); 19--EXPECT-- 20string(7) "Produkt" 21string(8) "Produkte" 22--CREDITS-- 23Till Klampaeckel, till@php.net 24PHP Testfest Berlin 2009-05-09