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