public function testsetLocale() { $locale = 'en_US'; $translateObj = new \Box_Translate(); $translateObj->setLocale($locale); $result = $translateObj->getLocale(); $this->assertEquals($locale, $result); }
return $service; }); $di['ftp'] = $di->protect(function ($params) use($di) { return new \Box_Ftp($params); }); $di['pdf'] = function () use($di) { include BB_PATH_LIBRARY . '/PDF_ImageAlpha.php'; return new \PDF_ImageAlpha(); }; $di['geoip'] = function () use($di) { return new \GeoIp2\Database\Reader(BB_PATH_LIBRARY . '/GeoLite2-Country.mmdb'); }; $di['password'] = function () use($di) { return new Box_Password(); }; $di['translate'] = $di->protect(function ($textDomain = '') use($di) { $tr = new Box_Translate(); if (!empty($textDomain)) { $tr->setDomain($textDomain); } $cookieBBlang = $di['cookie']->get('BBLANG'); $locale = !empty($cookieBBlang) ? $cookieBBlang : $di['config']['locale']; $tr->setDi($di); $tr->setLocale($locale); $tr->setup(); return $tr; }); $di['array_get'] = $di->protect(function (array $array, $key, $default = null) use($di) { return isset($array[$key]) ? $array[$key] : $default; }); return $di;