__() public method

Return the translated string
public __ ( string $str, string | array $params = null )
$str string
$params string | array
Beispiel #1
0
 public function testConstructor()
 {
     define('POP_LANG', 'fr_FR');
     $l = new I18n();
     $this->assertEquals('Ce champ est obligatoire.', $l->__('This field is required.'));
     $this->assertEquals('La valeur ne doit pas faire partie du 127.0.0 de sous-réseau.', $l->__('The value must not be part of the subnet %1.', '127.0.0'));
     $this->assertEquals('La valeur ne doit pas faire partie du 127.0.0 de sous-réseau.', $l->__('The value must not be part of the subnet %1.', array('127.0.0')));
     $this->assertEquals('fr', $l->getLanguage());
     $this->assertEquals('FR', $l->getLocale());
 }
 /**
  * Error method
  *
  * @return void
  */
 public function error()
 {
     $install = new Model\Install(array('title' => $this->i18n->__('404 Error') . ' > ' . $this->i18n->__('Page Not Found')));
     $this->view = View::factory($this->viewPath . '/error.phtml', $install->getData());
     $this->view->set('i18n', $this->i18n);
     $this->send(404);
 }
Beispiel #3
0
 /**
  * Get the init field values
  *
  * @return array
  */
 protected function getInitFields()
 {
     $check = Version::check(Version::DATA);
     foreach ($check as $key => $value) {
         if (strpos($key, 'db') !== false) {
             if ($value == 'Yes' && stripos($key, 'sqlsrv') === false && stripos($key, 'oracle') === false) {
                 $db = str_replace('db', '', $key);
                 if (strpos($db, 'Pdo') !== false && $db != 'Pdo') {
                     $db = 'Pdo\\' . ucfirst(strtolower(str_replace('Pdo', '', $db)));
                     $this->dbAdapters[$db] = $db;
                 } else {
                     if ($db != 'Pdo') {
                         $db = ucfirst(strtolower($db));
                         if ($db != 'Mysql') {
                             $this->dbAdapters[$db] = $db;
                         }
                     }
                 }
             }
         }
     }
     $langs = I18n::getLanguages(__DIR__ . '/../../../data/assets/i18n');
     foreach ($langs as $key => $value) {
         $langs[$key] = substr($value, 0, strpos($value, ' ('));
     }
     $fields = array('language' => array('type' => 'select', 'label' => $this->i18n->__('Language'), 'value' => $langs, 'marked' => POP_LANG, 'attributes' => array('onchange' => "changeLanguage(this);", 'style' => 'width: 260px;')), 'db_adapter' => array('type' => 'select', 'label' => $this->i18n->__('DB Adapter'), 'required' => true, 'value' => $this->dbAdapters, 'attributes' => array('style' => 'width: 260px;')), 'db_name' => array('type' => 'text', 'label' => $this->i18n->__('DB Name'), 'attributes' => array('size' => 30)), 'db_username' => array('type' => 'text', 'label' => $this->i18n->__('DB Username'), 'attributes' => array('size' => 30)), 'db_password' => array('type' => 'text', 'label' => $this->i18n->__('DB Password'), 'attributes' => array('size' => 30)), 'db_host' => array('type' => 'text', 'label' => $this->i18n->__('DB Host'), 'attributes' => array('size' => 30), 'value' => 'localhost'), 'db_prefix' => array('type' => 'text', 'name' => 'db_prefix', 'label' => $this->i18n->__('DB Table Prefix'), 'attributes' => array('size' => 30), 'value' => 'ph_'), 'app_uri' => array('type' => 'text', 'label' => $this->i18n->__('Application URI') . '<br /><em style="font-size: 0.9em; color: #666; font-weight: normal;">(' . $this->i18n->__('How you will access the system') . ')</em>', 'attributes' => array('size' => 30), 'value' => APP_URI), 'content_path' => array('type' => 'text', 'label' => $this->i18n->__('Content Path') . '<br /><em style="font-size: 0.9em; color: #666; font-weight: normal;">(' . $this->i18n->__('Where assets will be located') . ')</em>', 'required' => true, 'attributes' => array('size' => 30), 'value' => CONTENT_PATH), 'password_encryption' => array('type' => 'hidden', 'value' => 4), 'submit' => array('type' => 'submit', 'label' => '&nbsp;', 'value' => $this->i18n->__('NEXT'), 'attributes' => array('class' => 'install-btn')));
     return $fields;
 }