1--TEST-- 2Test dgettext() functionality 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_MESSAGES, 'en_US.UTF-8'); 15setlocale(LC_ALL, 'en_US.UTF-8'); 16bindtextdomain('dgettextTest', './locale'); 17bindtextdomain('dgettextTest_switch', './locale'); 18textdomain('dgettextTest'); 19 20var_dump(gettext('item')); 21var_dump(dgettext('dgettextTest_switch', 'item')); 22var_dump(gettext('item')); 23?> 24--EXPECT-- 25string(7) "Produkt" 26string(16) "Produkt_switched" 27string(7) "Produkt" 28--CREDITS-- 29Moritz Neuhaeuser, info@xcompile.net 30PHP Testfest Berlin 2009-05-09 31