1<?php 2 3/** 4 * This file is part of the Phalcon Framework. 5 * 6 * (c) Phalcon Team <team@phalcon.io> 7 * 8 * For the full copyright and license information, please view the LICENSE.txt 9 * file that was distributed with this source code. 10 */ 11 12declare(strict_types=1); 13 14namespace Phalcon\Test\Fixtures\Traits; 15 16use UnitTester; 17use function dataDir; 18 19trait TranslateGettextTrait 20{ 21 /** 22 * Executed before each test 23 */ 24 public function _before(UnitTester $I, $scenario) 25 { 26 $I->checkExtensionIsLoaded('gettext'); 27 28 if (!setlocale(LC_ALL, 'en_US.utf8')) { 29 $scenario->skip('Locale en_US.utf8 not enabled'); 30 } 31 } 32 33 protected function getGettextConfig(): array 34 { 35 return [ 36 'locale' => 'en_US.utf8', 37 'defaultDomain' => 'messages', 38 'directory' => dataDir('assets/translation/gettext'), 39 'category' => LC_MESSAGES, 40 ]; 41 } 42} 43