/** * testGet method * * @access public * @return void */ function testGet() { $l10n =& new L10n(); // Catalog Entry $l10n->get('en'); $this->assertEqual($l10n->language, 'English'); $this->assertEqual($l10n->languagePath, array('eng', 'eng')); $this->assertEqual($l10n->locale, 'eng'); // Map Entry $l10n->get('eng'); $this->assertEqual($l10n->language, 'English'); $this->assertEqual($l10n->languagePath, array('eng', 'eng')); $this->assertEqual($l10n->locale, 'eng'); // Catalog Entry $l10n->get('en-ca'); $this->assertEqual($l10n->language, 'English (Canadian)'); $this->assertEqual($l10n->languagePath, array('en_ca', 'eng')); $this->assertEqual($l10n->locale, 'en_ca'); // Default Entry define('DEFAULT_LANGUAGE', 'en-us'); $l10n->get('use_default'); $this->assertEqual($l10n->language, 'English (United States)'); $this->assertEqual($l10n->languagePath, array('en_us', 'eng')); $this->assertEqual($l10n->locale, 'en_us'); $l10n->get('es'); $l10n->get(''); $this->assertEqual($l10n->lang, 'en-us'); // Using $this->default $l10n = new L10n(); $l10n->get('use_default'); $this->assertEqual($l10n->language, 'English (United States)'); $this->assertEqual($l10n->languagePath, array('en_us', 'eng', 'eng')); $this->assertEqual($l10n->locale, 'en_us'); }
function i18n($params, $cache = false) { if (!is_array($params)) { $params = explode('/', trim($params, '/')); } $this->init(); $cacheFile = implode(DS, $params); $params = $this->normalize($params); $jsFile = $this->parseFile($params); $lang = $this->parseLang($params); $L10n = new L10n(); if (!$L10n->map($lang)) { $lang = null; } $L10n->get($lang); $sourceJsFile = $this->paths['source'] . $jsFile; if (file_exists($sourceJsFile)) { ob_start(); include $sourceJsFile; $js = ob_get_clean(); if ($cache) { $this->write($cacheFile, $js); } return $js; } return false; }
function testArrayGet() { global $langde; $l10n = new L10n('de'); $this->assertEqual($langde['admin'], $l10n->message('admin')); $this->assertEqual($langde['admin'], $l10n['admin']); $this->assertEqual('Undefined message!', $l10n['bla bla']); }
public static function localeList() { App::import("Lib", 'l10n'); $l10n = new L10n(); $lc = $l10n->catalog(); $locales = array(); foreach ($lc as $l) { $locales[$l['locale']] = $l['language']; } return $locales; }
/** * Used by the translation functions in basics.php * Can also be used like I18n::translate(); but only if the App::import('I18n'); has been used to load the class. * * @param string $singular String to translate * @param string $plural Plural string (if any) * @param string $domain Domain * @param string $category Category * @param integer $count Count * @return string translated strings. * @access public */ public static function translate($singular, $plural = null, $domain = null, $category = 6, $count = null) { self::init(); if (strpos($singular, "\r\n") !== false) { $singular = str_replace("\r\n", "\n", $singular); } if ($plural !== null && strpos($plural, "\r\n") !== false) { $plural = str_replace("\r\n", "\n", $plural); } if (is_numeric($category)) { self::$category = self::$__categories[$category]; } $language = Configure::read('Config.language'); if (!empty($_SESSION['Config']['language'])) { $language = $_SESSION['Config']['language']; } if (self::$__lang && self::$__lang !== $language || !self::$__lang) { self::$__lang = self::$L10n->get($language); } if (is_null($domain)) { $domain = 'default'; } self::$domain = $domain . '_' . self::$L10n->locale; if (empty(self::$__domains)) { self::$__domains = Cache::read(self::$domain, '_cake_core_'); } if (!isset(self::$__domains[self::$category][self::$__lang][$domain])) { self::__bindTextDomain($domain); self::$__cache = true; } if (!isset($count)) { $plurals = 0; } elseif (!empty(self::$__domains[self::$category][self::$__lang][$domain]["%plural-c"]) && self::$__noLocale === false) { $header = self::$__domains[self::$category][self::$__lang][$domain]["%plural-c"]; $plurals = self::__pluralGuess($header, $count); } else { if ($count != 1) { $plurals = 1; } else { $plurals = 0; } } if (!empty(self::$__domains[self::$category][self::$__lang][$domain][$singular])) { if (($trans = self::$__domains[self::$category][self::$__lang][$domain][$singular]) || $plurals && ($trans = self::$__domains[self::$category][self::$__lang][$domain][$plural])) { if (is_array($trans)) { if (isset($trans[$plurals])) { $trans = $trans[$plurals]; } } if (strlen($trans)) { $singular = $trans; return $singular; } } } if (!empty($plurals)) { return $plural; } return $singular; }
/** * PrivateSpaceルームの生成 * * @param array $data デフォルト値 * @return array PrivateSpaceルーム配列 */ public function createRoom($data = array()) { $this->loadModels(['Language' => 'M17n.Language', 'Room' => 'Rooms.Room', 'RoomsLanguage' => 'Rooms.RoomsLanguage']); $parentRoom = $this->Room->find('first', array('recursive' => -1, 'fields' => array('space_id', 'active', 'need_approval', 'page_layout_permitted'), 'conditions' => array('id' => Space::getRoomIdRoot(Space::PRIVATE_SPACE_ID)))); $result = $this->Room->create(Hash::merge(array('id' => null, 'root_id' => Space::getRoomIdRoot(Space::PRIVATE_SPACE_ID), 'parent_id' => Space::getRoomIdRoot(Space::PRIVATE_SPACE_ID), 'default_role_key' => Role::ROOM_ROLE_KEY_ROOM_ADMINISTRATOR, 'default_participation' => false), $parentRoom['Room'])); $languages = $this->Language->getLanguages(); App::uses('L10n', 'I18n'); $L10n = new L10n(); foreach ($languages as $i => $language) { $catalog = $L10n->catalog($language['Language']['code']); $roomsLanguage = $this->RoomsLanguage->create(array('id' => null, 'language_id' => $language['Language']['id'], 'room_id' => null, 'name' => __d('private_space', $catalog['language']))); $result['RoomsLanguage'][$i] = $roomsLanguage['RoomsLanguage']; } $result['Page']['parent_id'] = null; return $result; }
/** * make new translate */ protected function __construct() { $options = array('log' => Log::Log(), 'logUntranslated' => false); $locale = L10n::getInstance(); $supported = $locale->getBrowser(); arsort($supported, SORT_NUMERIC); $file = ''; foreach ($supported as $loc => $val) { if (file_exists(LOCALE_PATH . '/' . $loc . '/locale.php')) { $file = LOCALE_PATH . '/' . $loc . '/locale.php'; $locale->setLocale($loc); break; } } if ($file == '' && file_exists(LOCALE_PATH . '/en_US/locale.php')) { $file = LOCALE_PATH . '/en_US/locale.php'; $locale->setLocale('en_US'); } if ($file != '') { $this->translate = new Zend_Translate(Zend_Translate::AN_ARRAY, $file, $locale->getLanguage(), $options); #Log::Log()->debug('locale ' . $locale->getLanguage() . '_' .$locale->getRegion() . ' loaded'); } else { throw new Exception(__METHOD__ . ': no translation files available'); } }
/** * get already existing instance, make new instance or throw an exception * @return L10n */ public static function getInstance() { if (self::$instance === null) { self::$instance = new L10n(); } return self::$instance; }
public static function get() { if (!self::$inst) { $lang = L10n::get('messages')->getLanguage(); self::$inst = new self($lang); } return self::$inst; }
protected function getConf() { $conf = ['ID' => Core::ID, 'ajaxURL' => Url::getAjax(), 'lang' => ['loading' => L10n::__('Loading, please wait...'), 'error' => L10n::__('Sorry, server is busy now, can not respond your request, please try again later.'), 'close' => L10n::__('Close'), 'ok' => L10n::__('OK')]]; if (Condition::isAdmin()) { $conf['_nonce'] = Security::createNonce(); } return \apply_filters(Functions::buildActionName('dynamicConf'), $conf); }
private static function updateAllCitiesByCountryId($country_id) { if (empty($country_id)) { return; } $xml_resp = simplexml_load_file('http://xml.weather.ua/1.2/city/?country=' . $country_id); if (!$xml_resp) { throw new ErrorException("Couldn't load city xml for country " . $country_id); } $delay = 100000; foreach ($xml_resp->city as $city) { $geocode_pending = true; while ($geocode_pending) { $item = array(); $item['id'] = intval($city->attributes()->id); $db_city = Mysql::getInstance()->from('cities')->where(array('id' => $item['id']))->get()->first(); foreach ($city as $field => $val) { $item[$field] = strval($val); } $item['country'] = Mysql::getInstance()->from('countries')->where(array('id' => $item['country_id']))->get()->first('name_en'); $geocode_pending = false; if (empty($db_city['timezone'])) { try { $item['timezone'] = self::getTimezoneForCity($item['country'], $item['name_en']); } catch (GeoCodeException $ge) { echo "Bad status for country: " . $item['country'] . ", city: " . $item['name_en'] . "; Status: " . $ge->getMessage() . ";\n"; if ($ge->getMessage() == 'OVER_QUERY_LIMIT') { $delay += 100000; echo "Increasing the delay to " . $delay . " microseconds\n"; $geocode_pending = true; } } catch (GeoNamesException $gn) { echo "Bad status for country: " . $item['country'] . ", city: " . $item['name_en'] . "; Status: " . $gn->getMessage() . ";\n"; if ($gn->getCode() >= 18 && $gn->getCode() <= 20) { if (self::$geonames_username != 'demo') { self::$geonames_username = '******'; $geocode_pending = true; } else { throw new ErrorException("GeoNames credits exceeded"); } } } catch (Exception $e) { echo $e; } } if (!$geocode_pending) { if (empty($db_city['id'])) { Mysql::getInstance()->insert('cities', $item); } else { Mysql::getInstance()->update('cities', $item, array('id' => $db_city['id'])); } } usleep($delay); } } }
/** * Get available locales in locale directory * * @return array * @throws CakeException */ public static function getAvailableLocale() { if (!is_dir(APP . 'Locale')) { throw new CakeException('Locale directory not exist.'); } $dir = new Folder(APP . 'Locale'); if (!$dir->read()[0]) { throw new CakeException('Locale not exist.'); } $availableCatalog = []; $l10n = new L10n(); foreach ($dir->read()[0] as $locale) { $poFile = new File(APP . 'Locale' . self::DS . $locale . self::DS . 'LC_MESSAGES' . self::DS . 'hurad.po'); if ($poFile->exists()) { $catalog = $l10n->catalog($locale); if ($catalog) { $availableCatalog[$locale] = $catalog; } } } $availableCatalog = Hash::merge(['eng' => $l10n->catalog('eng')], $availableCatalog); return $availableCatalog; }
public function startup(Controller $controller) { $this->controller =& $controller; $this->Cookie->time = 3600 * 24 * 30; // expires after one month $languageOptions = array('ara' => 'العربية', 'chi' => '中文', 'eng' => 'English', 'fre' => 'Français', 'rus' => 'русский', 'spa' => 'español'); $l10n = new L10n(); $params = $controller->params; $ConfigItem = ClassRegistry::init('ConfigItem'); $showLanguage = $ConfigItem->getValue('language_menu'); $controller->set('showLanguage', $showLanguage); if (!empty($params->query['lang'])) { $lang = $params->query['lang']; } else { if ($this->Session->check('System.language')) { $lang = $this->Session->read('System.language'); } else { $lang = $ConfigItem->getValue('language'); } } if ($controller->name == 'Security' && $controller->action == 'login' && $controller->request->is('post') && isset($controller->request->data['submit']) && $controller->request->data['submit'] == 'reload') { $lang = $controller->request->data['SecurityUser']['language']; //$this->Cookie->write('System.language', $lang); } $locale = $l10n->map($lang); if ($locale == false) { $lang = 'eng'; $locale = $l10n->map($lang); } $catalog = $l10n->catalog($locale); $controller->set('lang_locale', $locale); $controller->set('lang_dir', $catalog['direction']); $controller->set('lang', $lang); $controller->set('languageOptions', $languageOptions); $this->Session->write('System.language', $lang); Configure::write('Config.language', $lang); }
public function initialize(Controller $Controller, $settings = array()) { $this->controller = $Controller; $this->isBrwPanel = (!empty($Controller->request->params['prefix']) and $Controller->request->params['prefix'] == 'brw' or $Controller->params['plugin'] == 'brownie'); ClassRegistry::init('BrwUser')->Behaviors->attach('Brownie.BrwUser'); ClassRegistry::init('BrwImage')->Behaviors->attach('Brownie.BrwUpload'); ClassRegistry::init('BrwFile')->Behaviors->attach('Brownie.BrwUpload'); if (!empty($Controller->request->params['prefix']) and $Controller->request->params['prefix'] == 'brw') { if (!class_exists('AuthComponent')) { $Controller->Components->load('Auth', Configure::read('brwAuthConfig')); } else { foreach (Configure::read('brwAuthConfig') as $key => $value) { $Controller->Auth->{$key} = $value; } } App::build(array('views' => ROOT . DS . APP_DIR . DS . 'Plugin' . DS . 'Brownie' . DS . 'View' . DS)); $Controller->helpers[] = 'Js'; $Controller->layout = 'brownie_default'; if (!empty($Controller->modelClass)) { $Controller->{$Controller->modelClass}->attachBackend(); } } if ($this->isBrwPanel) { AuthComponent::$sessionKey = 'Auth.BrwUserLogged'; $this->_menuConfig(); } if (Configure::read('Config.languages')) { $langs3chars = array(); $l10n = new L10n(); foreach ((array) Configure::read('Config.languages') as $lang) { $catalog = $l10n->catalog($lang); $langs3chars[$lang] = $catalog['localeFallback']; } Configure::write('Config.langs', $langs3chars); } }
function translateSpaceName($space_name) { global $charset; $_this =& L10n::getInstance(); if (preg_match('/[\\x80-\\xff]./', $space_name)) { //Convert To Kanji Pinyin. $space_name = preg_replace('/\\s(?=\\s)/', '', $space_name); $space_name = iconv($charset, "gb2312", $space_name); require LOCALE_PATH . "topinyin.class.php"; $cn = new ChineseSpell(); return str_replace(" ", "", $_this->normalize($cn->getFullSpell($space_name))); } else { return $_this->normalize($space_name); } }
/** * testGet method * * @access public * @return void */ function testGet() { $l10n =& new L10n(); // Catalog Entry $l10n->get('en'); $result = $l10n->language; $expected = 'English'; $this->assertEqual($result, $expected); $result = $l10n->languagePath; $expected = array('eng', 'eng'); $this->assertEqual($result, $expected); $result = $l10n->locale; $expected = 'eng'; $this->assertEqual($result, $expected); // Map Entry $l10n->get('eng'); $result = $l10n->language; $expected = 'English'; $this->assertEqual($result, $expected); $result = $l10n->languagePath; $expected = array('eng', 'eng'); $this->assertEqual($result, $expected); $result = $l10n->locale; $expected = 'eng'; $this->assertEqual($result, $expected); // Catalog Entry $l10n->get('en-ca'); $result = $l10n->language; $expected = 'English (Canadian)'; $this->assertEqual($result, $expected); $result = $l10n->languagePath; $expected = array('en_ca', 'eng'); $this->assertEqual($result, $expected); $result = $l10n->locale; $expected = 'en_ca'; $this->assertEqual($result, $expected); // Default Entry define('DEFAULT_LANGUAGE', 'en-us'); $l10n->get('use_default'); $result = $l10n->language; $expected = 'English (United States)'; $this->assertEqual($result, $expected); $result = $l10n->languagePath; $expected = array('en_us', 'eng'); $this->assertEqual($result, $expected); $result = $l10n->locale; $expected = 'en_us'; $this->assertEqual($result, $expected); // Using $this->default $l10n = new L10n(); $l10n->get('use_default'); $result = $l10n->language; $expected = 'English (United States)'; $this->assertEqual($result, $expected); $result = $l10n->languagePath; $expected = array('en_us', 'eng', 'eng'); $this->assertEqual($result, $expected); $result = $l10n->locale; $expected = 'en_us'; $this->assertEqual($result, $expected); }
/** * make singleton L10n (localization) object (set locale, convert date and * number formats) */ public function _initL10n() { $this->bootstrap('Config'); $L10n = L10n::getInstance(); }
} else { $vals['company_id'] = $pdb->GetOne("SELECT id FROM {$tb_prefix}companies WHERE name='" . $_POST['company_name'] . "'"); } } if (isset($_POST['brand']['username'])) { if (!pb_strcomp($_POST['brand']['username'], $_POST['username'])) { $vals['member_id'] = $pdb->GetOne("SELECT id FROM {$tb_prefix}members WHERE username='******'brand']['username'] . "'"); } else { $vals['member_id'] = $pdb->GetOne("SELECT id FROM {$tb_prefix}members WHERE username='******'username'] . "'"); } } $attachment->rename_file = "brand-" . ($brand->getMaxId() + 1); if (!empty($id)) { $attachment->rename_file = "brand-" . $id; } $vals['letter'] = L10n::getinitial($vals['name']); if (!empty($vals['description'])) { $vals['description'] = stripcslashes($vals['description']); } if (!empty($_FILES['pic']['name'])) { $attachment->upload_process(); $vals['picture'] = $attachment->file_full_url; } if (!empty($id)) { $result = $brand->save($vals, "update", $id); } else { $result = $brand->save($vals); } if (!$result) { flash(); }
* [PHPB2B] Copyright (C) 2007-2099, Ualink Inc. All Rights Reserved. * The contents of this file are subject to the License; you may not use this file except in compliance with the License. * * @version $Revision: 2075 $ */ require "../libraries/common.inc.php"; require "room.share.php"; uses("templet"); check_permission("space"); $templet = new Templets(); if (!$company->Validate($companyinfo)) { flash("pls_complete_company_info", "company.php", 0); } if (isset($_POST['updateSpaceName']) && !empty($_POST['data']['space_name'])) { $space_name = trim($_POST['data']['space_name']); $i18n = new L10n(); $space_name = $i18n->translateSpaceName($space_name); $result = $member->updateSpaceName(array("id" => $the_memberid), $space_name); if ($result) { $member->clearCache($the_memberid); $member->updateMemberCaches($the_memberid); flash("success"); } } if (isset($_POST['save']) && !empty($_POST['data']['member']['styleid'])) { $templet_id = intval($_POST['data']['member']['styleid']); $pdb->Execute("UPDATE {$tb_prefix}members SET templet_id=" . $templet_id . " WHERE id=" . $the_memberid); $member->clearCache($the_memberid); $member->updateMemberCaches($the_memberid); flash("success"); }
function Add() { global $_PB_CACHE, $memberfield, $phpb2b_auth_key, $if_need_check; $error_msg = array(); if (empty($this->params['data']['member']['username']) or empty($this->params['data']['member']['userpass']) or empty($this->params['data']['member']['email'])) { return false; } $space_name = $this->params['data']['member']['username']; $userpass = $this->params['data']['member']['userpass']; $this->params['data']['member']['userpass'] = $this->authPasswd($this->params['data']['member']['userpass']); $i18n = new L10n(); if (empty($this->params['data']['member']['space_name'])) { $this->params['data']['member']['space_name'] = $i18n->translateSpaceName($space_name); } //Todo: $uip = pb_ip2long(pb_getenv('REMOTE_ADDR')); if (empty($uip)) { pheader("location:" . URL . "redirect.php?message=" . urlencode(L('sys_error'))); } $this->params['data']['member']['last_login'] = $this->params['data']['member']['created'] = $this->params['data']['member']['modified'] = $this->timestamp; $this->params['data']['member']['last_ip'] = pb_get_client_ip('str'); $email_exists = $this->checkUserExistsByEmail($this->params['data']['member']['email']); if ($email_exists) { flash("email_exists", null, 0); } $if_exists = $this->checkUserExist($this->params['data']['member']['username']); if ($if_exists) { flash('member_has_exists', null, 0); } else { $this->save($this->params['data']['member']); $key = $this->table_name . "_id"; if ($this->ins_passport) { $this->passport(array($this->{$key}, $this->params['data']['member']['username'], $userpass, $this->params['data']['member']['email']), "reg"); } $memberfield->primaryKey = "member_id"; $memberfield->params['data']['memberfield']['member_id'] = $this->{$key}; $memberfield->params['data']['memberfield']['reg_ip'] = $this->params['data']['member']['last_ip']; $memberfield->save($memberfield->params['data']['memberfield']); if (!$if_need_check) { $user_info['id'] = $this->{$key}; $user_info['username'] = $this->params['data']['member']['username']; $user_info['userpass'] = $userpass; $user_info['useremail'] = $this->params['data']['member']['email']; $user_info['lifetime'] = $this->timestamp + 86400; $user_info['is_admin'] = 0; $this->putLoginStatus($user_info); } } return true; }
function iconv($in_charset, $out_charset = 'utf-8', $string) { return L10n::translate($in_charset, $out_charset, $string); }
/** * Returns the correct image from the language code * * @param string $lang Long language code * @param array $options Options with the following possible keys * - basePath: Base path for the flag images, with a trailing slash * @return string Image markup */ public function flagImage($lang, $options = array()) { static $L10n = null; if (is_null($L10n)) { App::import('Core', 'L10n'); $L10n = new L10n(); } $_defaults = array('basePath' => $this->basePath); $options = array_merge($_defaults, $options); return $this->Html->image($options['basePath'] . $L10n->map($lang) . '.png'); }
/** * 言語データタイプを取得 * * @return array DataTypes配列 */ public function getLanguages() { App::uses('L10n', 'I18n'); $L10n = new L10n(); $languages = $this->Language->getLanguage(); $results = array(); foreach ($languages as $lang) { $catalog = $L10n->catalog($lang['Language']['code']); $results[] = array('key' => $lang['Language']['code'], 'name' => __d('m17n', $catalog['language']), 'code' => $lang['Language']['code'], 'language_id' => $lang['Language']['id']); } return $results; }
/** * Returns a 2 letters language code compatible with Google Translate * * @param string $langCode Language code to convert * @return Two letters language code */ protected function _twoLettersCode($langCode) { static $L10n = null; if (strlen($langCode) == 3) { if (is_null($L10n)) { App::import('Core', 'L10n'); $L10n = new L10n(); } $langCode = $L10n->map($langCode); } return $langCode; }
* Component * * This plugin's Example component will be loaded in ALL controllers. */ Croogo::hookComponent('*', 'Example.Example'); /** * Helper * * This plugin's Example helper will be loaded via NodesController. */ Croogo::hookHelper('Nodes', 'Example.Example'); /** * Admin menu (navigation) */ CroogoNav::add('sidebar', 'extensions.children.example', array('title' => 'Example', 'url' => '#', 'children' => array('example1' => array('title' => 'Example 1', 'url' => array('admin' => true, 'plugin' => 'example', 'controller' => 'example', 'action' => 'index')), 'example2' => array('title' => 'Example 2 with a title that won\'t fit in the sidebar', 'url' => '#', 'children' => array('example-2-1' => array('title' => 'Example 2-1', 'url' => '#', 'children' => array('example-2-1-1' => array('title' => 'Example 2-1-1', 'url' => '#', 'children' => array('example-2-1-1-1' => array('title' => 'Example 2-1-1-1'))))))), 'example3' => array('title' => 'Chooser Example', 'url' => array('admin' => true, 'plugin' => 'example', 'controller' => 'example', 'action' => 'chooser')), 'example4' => array('title' => 'RTE Example', 'url' => array('admin' => true, 'plugin' => 'example', 'controller' => 'example', 'action' => 'rte_example'))))); $Localization = new L10n(); Croogo::mergeConfig('Wysiwyg.actions', array('Example/admin_rte_example' => array(array('elements' => 'ExampleBasic', 'preset' => 'basic'), array('elements' => 'ExampleStandard', 'preset' => 'standard', 'language' => 'ja'), array('elements' => 'ExampleFull', 'preset' => 'full', 'language' => $Localization->map(Configure::read('Site.locale'))), array('elements' => 'ExampleCustom', 'toolbar' => array(array('Format', 'Bold', 'Italic'), array('Copy', 'Paste')), 'uiColor' => '#ffe79a', 'language' => 'fr')))); /** * Admin row action * * When browsing the content list in admin panel (Content > List), * an extra link called 'Example' will be placed under 'Actions' column. */ Croogo::hookAdminRowAction('Nodes/admin_index', 'Example', 'plugin:example/controller:example/action:index/:id'); /* Row action with link options */ Croogo::hookAdminRowAction('Nodes/admin_index', 'Button with Icon', array('plugin:example/controller:example/action:index/:id' => array('options' => array('icon' => 'key', 'button' => 'success')))); /* Row action with icon */ Croogo::hookAdminRowAction('Nodes/admin_index', 'Icon Only', array('plugin:example/controller:example/action:index/:id' => array('title' => false, 'options' => array('icon' => 'picture', 'tooltip' => array('data-title' => 'A nice and simple action with tooltip', 'data-placement' => 'left'))))); /* Row action with confirm message */ Croogo::hookAdminRowAction('Nodes/admin_index', 'Reload Page', array('admin:true/plugin:nodes/controller:nodes/action:index' => array('title' => false, 'options' => array('icon' => 'refresh', 'tooltip' => 'Reload page'), 'confirmMessage' => 'Reload this page?'))); /**
$industry = new Industries(); $companyfield = new Companyfields(); $typeoption = new Typeoption(); $tpl_file = "company"; if (isset($_POST['do']) && !empty($_POST['data']['company'])) { pb_submit_check('data'); $vals = $_POST['data']['company']; $company->doValidation($vals); if (!empty($company->validationErrors)) { setvar("item", $vals); setvar("Errors", $validate->show($company)); template($tpl_file, true); } if (isset($companyinfo)) { if (empty($companyinfo['name'])) { $i18n = new L10n(); $space_name = $i18n->translateSpaceName($_POST['data']['company']['name']); $space_name = str_replace(' ', '', $space_name); $vals['cache_spacename'] = $space_name; $vals['first_letter'] = substr($space_name, 0, 1); $member->updateSpaceName(array("id" => $the_memberid), $space_name); if (isset($companyinfo['status']) && $companyinfo['status'] == 0) { $vals['name'] = strip_tags($_POST['data']['company']['name']); $vals['english_name'] = strip_tags($vals['english_name']); } } } $vals['employee_amount'] = $vals['employee_amount']; if (!empty($vals['found_date'])) { $vals['found_date'] = Times::dateConvert($vals['found_date']); }
/** * testCatalog method * * @return void */ public function testCatalog() { $localize = new L10n(); $result = $localize->catalog(array('af')); $expected = array('af' => array('language' => 'Afrikaans', 'locale' => 'afr', 'localeFallback' => 'afr', 'charset' => 'utf-8', 'direction' => 'ltr')); $this->assertEquals($expected, $result); $result = $localize->catalog(array('ar', 'ar-ae', 'ar-bh', 'ar-dz', 'ar-eg', 'ar-iq', 'ar-jo', 'ar-kw', 'ar-lb', 'ar-ly', 'ar-ma', 'ar-om', 'ar-qa', 'ar-sa', 'ar-sy', 'ar-tn', 'ar-ye')); $expected = array('ar' => array('language' => 'Arabic', 'locale' => 'ara', 'localeFallback' => 'ara', 'charset' => 'utf-8', 'direction' => 'rtl'), 'ar-ae' => array('language' => 'Arabic (U.A.E.)', 'locale' => 'ar_ae', 'localeFallback' => 'ara', 'charset' => 'utf-8', 'direction' => 'rtl'), 'ar-bh' => array('language' => 'Arabic (Bahrain)', 'locale' => 'ar_bh', 'localeFallback' => 'ara', 'charset' => 'utf-8', 'direction' => 'rtl'), 'ar-dz' => array('language' => 'Arabic (Algeria)', 'locale' => 'ar_dz', 'localeFallback' => 'ara', 'charset' => 'utf-8', 'direction' => 'rtl'), 'ar-eg' => array('language' => 'Arabic (Egypt)', 'locale' => 'ar_eg', 'localeFallback' => 'ara', 'charset' => 'utf-8', 'direction' => 'rtl'), 'ar-iq' => array('language' => 'Arabic (Iraq)', 'locale' => 'ar_iq', 'localeFallback' => 'ara', 'charset' => 'utf-8', 'direction' => 'rtl'), 'ar-jo' => array('language' => 'Arabic (Jordan)', 'locale' => 'ar_jo', 'localeFallback' => 'ara', 'charset' => 'utf-8', 'direction' => 'rtl'), 'ar-kw' => array('language' => 'Arabic (Kuwait)', 'locale' => 'ar_kw', 'localeFallback' => 'ara', 'charset' => 'utf-8', 'direction' => 'rtl'), 'ar-lb' => array('language' => 'Arabic (Lebanon)', 'locale' => 'ar_lb', 'localeFallback' => 'ara', 'charset' => 'utf-8', 'direction' => 'rtl'), 'ar-ly' => array('language' => 'Arabic (Libya)', 'locale' => 'ar_ly', 'localeFallback' => 'ara', 'charset' => 'utf-8', 'direction' => 'rtl'), 'ar-ma' => array('language' => 'Arabic (Morocco)', 'locale' => 'ar_ma', 'localeFallback' => 'ara', 'charset' => 'utf-8', 'direction' => 'rtl'), 'ar-om' => array('language' => 'Arabic (Oman)', 'locale' => 'ar_om', 'localeFallback' => 'ara', 'charset' => 'utf-8', 'direction' => 'rtl'), 'ar-qa' => array('language' => 'Arabic (Qatar)', 'locale' => 'ar_qa', 'localeFallback' => 'ara', 'charset' => 'utf-8', 'direction' => 'rtl'), 'ar-sa' => array('language' => 'Arabic (Saudi Arabia)', 'locale' => 'ar_sa', 'localeFallback' => 'ara', 'charset' => 'utf-8', 'direction' => 'rtl'), 'ar-sy' => array('language' => 'Arabic (Syria)', 'locale' => 'ar_sy', 'localeFallback' => 'ara', 'charset' => 'utf-8', 'direction' => 'rtl'), 'ar-tn' => array('language' => 'Arabic (Tunisia)', 'locale' => 'ar_tn', 'localeFallback' => 'ara', 'charset' => 'utf-8', 'direction' => 'rtl'), 'ar-ye' => array('language' => 'Arabic (Yemen)', 'locale' => 'ar_ye', 'localeFallback' => 'ara', 'charset' => 'utf-8', 'direction' => 'rtl')); $this->assertEquals($expected, $result); $result = $localize->catalog(array('be')); $expected = array('be' => array('language' => 'Byelorussian', 'locale' => 'bel', 'localeFallback' => 'bel', 'charset' => 'utf-8', 'direction' => 'ltr')); $this->assertEquals($expected, $result); $result = $localize->catalog(array('bg')); $expected = array('bg' => array('language' => 'Bulgarian', 'locale' => 'bul', 'localeFallback' => 'bul', 'charset' => 'utf-8', 'direction' => 'ltr')); $this->assertEquals($expected, $result); $result = $localize->catalog(array('bs')); $expected = array('bs' => array('language' => 'Bosnian', 'locale' => 'bos', 'localeFallback' => 'bos', 'charset' => 'utf-8', 'direction' => 'ltr')); $this->assertEquals($expected, $result); $result = $localize->catalog(array('ca')); $expected = array('ca' => array('language' => 'Catalan', 'locale' => 'cat', 'localeFallback' => 'cat', 'charset' => 'utf-8', 'direction' => 'ltr')); $this->assertEquals($expected, $result); $result = $localize->catalog(array('cs')); $expected = array('cs' => array('language' => 'Czech', 'locale' => 'ces', 'localeFallback' => 'ces', 'charset' => 'utf-8', 'direction' => 'ltr')); $this->assertEquals($expected, $result); $result = $localize->catalog(array('da')); $expected = array('da' => array('language' => 'Danish', 'locale' => 'dan', 'localeFallback' => 'dan', 'charset' => 'utf-8', 'direction' => 'ltr')); $this->assertEquals($expected, $result); $result = $localize->catalog(array('de', 'de-at', 'de-ch', 'de-de', 'de-li', 'de-lu')); $expected = array('de' => array('language' => 'German (Standard)', 'locale' => 'deu', 'localeFallback' => 'deu', 'charset' => 'utf-8', 'direction' => 'ltr'), 'de-at' => array('language' => 'German (Austria)', 'locale' => 'de_at', 'localeFallback' => 'deu', 'charset' => 'utf-8', 'direction' => 'ltr'), 'de-ch' => array('language' => 'German (Swiss)', 'locale' => 'de_ch', 'localeFallback' => 'deu', 'charset' => 'utf-8', 'direction' => 'ltr'), 'de-de' => array('language' => 'German (Germany)', 'locale' => 'de_de', 'localeFallback' => 'deu', 'charset' => 'utf-8', 'direction' => 'ltr'), 'de-li' => array('language' => 'German (Liechtenstein)', 'locale' => 'de_li', 'localeFallback' => 'deu', 'charset' => 'utf-8', 'direction' => 'ltr'), 'de-lu' => array('language' => 'German (Luxembourg)', 'locale' => 'de_lu', 'localeFallback' => 'deu', 'charset' => 'utf-8', 'direction' => 'ltr')); $this->assertEquals($expected, $result); $result = $localize->catalog(array('el')); $expected = array('el' => array('language' => 'Greek', 'locale' => 'ell', 'localeFallback' => 'ell', 'charset' => 'utf-8', 'direction' => 'ltr')); $this->assertEquals($expected, $result); $result = $localize->catalog(array('en', 'en-au', 'en-bz', 'en-ca', 'en-gb', 'en-ie', 'en-jm', 'en-nz', 'en-tt', 'en-us', 'en-za')); $expected = array('en' => array('language' => 'English', 'locale' => 'eng', 'localeFallback' => 'eng', 'charset' => 'utf-8', 'direction' => 'ltr'), 'en-au' => array('language' => 'English (Australian)', 'locale' => 'en_au', 'localeFallback' => 'eng', 'charset' => 'utf-8', 'direction' => 'ltr'), 'en-bz' => array('language' => 'English (Belize)', 'locale' => 'en_bz', 'localeFallback' => 'eng', 'charset' => 'utf-8', 'direction' => 'ltr'), 'en-ca' => array('language' => 'English (Canadian)', 'locale' => 'en_ca', 'localeFallback' => 'eng', 'charset' => 'utf-8', 'direction' => 'ltr'), 'en-gb' => array('language' => 'English (British)', 'locale' => 'en_gb', 'localeFallback' => 'eng', 'charset' => 'utf-8', 'direction' => 'ltr'), 'en-ie' => array('language' => 'English (Ireland)', 'locale' => 'en_ie', 'localeFallback' => 'eng', 'charset' => 'utf-8', 'direction' => 'ltr'), 'en-jm' => array('language' => 'English (Jamaica)', 'locale' => 'en_jm', 'localeFallback' => 'eng', 'charset' => 'utf-8', 'direction' => 'ltr'), 'en-nz' => array('language' => 'English (New Zealand)', 'locale' => 'en_nz', 'localeFallback' => 'eng', 'charset' => 'utf-8', 'direction' => 'ltr'), 'en-tt' => array('language' => 'English (Trinidad)', 'locale' => 'en_tt', 'localeFallback' => 'eng', 'charset' => 'utf-8', 'direction' => 'ltr'), 'en-us' => array('language' => 'English (United States)', 'locale' => 'en_us', 'localeFallback' => 'eng', 'charset' => 'utf-8', 'direction' => 'ltr'), 'en-za' => array('language' => 'English (South Africa)', 'locale' => 'en_za', 'localeFallback' => 'eng', 'charset' => 'utf-8', 'direction' => 'ltr')); $this->assertEquals($expected, $result); $result = $localize->catalog(array('es', 'es-ar', 'es-bo', 'es-cl', 'es-co', 'es-cr', 'es-do', 'es-ec', 'es-es', 'es-gt', 'es-hn', 'es-mx', 'es-ni', 'es-pa', 'es-pe', 'es-pr', 'es-py', 'es-sv', 'es-uy', 'es-ve')); $expected = array('es' => array('language' => 'Spanish (Spain - Traditional)', 'locale' => 'spa', 'localeFallback' => 'spa', 'charset' => 'utf-8', 'direction' => 'ltr'), 'es-ar' => array('language' => 'Spanish (Argentina)', 'locale' => 'es_ar', 'localeFallback' => 'spa', 'charset' => 'utf-8', 'direction' => 'ltr'), 'es-bo' => array('language' => 'Spanish (Bolivia)', 'locale' => 'es_bo', 'localeFallback' => 'spa', 'charset' => 'utf-8', 'direction' => 'ltr'), 'es-cl' => array('language' => 'Spanish (Chile)', 'locale' => 'es_cl', 'localeFallback' => 'spa', 'charset' => 'utf-8', 'direction' => 'ltr'), 'es-co' => array('language' => 'Spanish (Colombia)', 'locale' => 'es_co', 'localeFallback' => 'spa', 'charset' => 'utf-8', 'direction' => 'ltr'), 'es-cr' => array('language' => 'Spanish (Costa Rica)', 'locale' => 'es_cr', 'localeFallback' => 'spa', 'charset' => 'utf-8', 'direction' => 'ltr'), 'es-do' => array('language' => 'Spanish (Dominican Republic)', 'locale' => 'es_do', 'localeFallback' => 'spa', 'charset' => 'utf-8', 'direction' => 'ltr'), 'es-ec' => array('language' => 'Spanish (Ecuador)', 'locale' => 'es_ec', 'localeFallback' => 'spa', 'charset' => 'utf-8', 'direction' => 'ltr'), 'es-es' => array('language' => 'Spanish (Spain)', 'locale' => 'es_es', 'localeFallback' => 'spa', 'charset' => 'utf-8', 'direction' => 'ltr'), 'es-gt' => array('language' => 'Spanish (Guatemala)', 'locale' => 'es_gt', 'localeFallback' => 'spa', 'charset' => 'utf-8', 'direction' => 'ltr'), 'es-hn' => array('language' => 'Spanish (Honduras)', 'locale' => 'es_hn', 'localeFallback' => 'spa', 'charset' => 'utf-8', 'direction' => 'ltr'), 'es-mx' => array('language' => 'Spanish (Mexican)', 'locale' => 'es_mx', 'localeFallback' => 'spa', 'charset' => 'utf-8', 'direction' => 'ltr'), 'es-ni' => array('language' => 'Spanish (Nicaragua)', 'locale' => 'es_ni', 'localeFallback' => 'spa', 'charset' => 'utf-8', 'direction' => 'ltr'), 'es-pa' => array('language' => 'Spanish (Panama)', 'locale' => 'es_pa', 'localeFallback' => 'spa', 'charset' => 'utf-8', 'direction' => 'ltr'), 'es-pe' => array('language' => 'Spanish (Peru)', 'locale' => 'es_pe', 'localeFallback' => 'spa', 'charset' => 'utf-8', 'direction' => 'ltr'), 'es-pr' => array('language' => 'Spanish (Puerto Rico)', 'locale' => 'es_pr', 'localeFallback' => 'spa', 'charset' => 'utf-8', 'direction' => 'ltr'), 'es-py' => array('language' => 'Spanish (Paraguay)', 'locale' => 'es_py', 'localeFallback' => 'spa', 'charset' => 'utf-8', 'direction' => 'ltr'), 'es-sv' => array('language' => 'Spanish (El Salvador)', 'locale' => 'es_sv', 'localeFallback' => 'spa', 'charset' => 'utf-8', 'direction' => 'ltr'), 'es-uy' => array('language' => 'Spanish (Uruguay)', 'locale' => 'es_uy', 'localeFallback' => 'spa', 'charset' => 'utf-8', 'direction' => 'ltr'), 'es-ve' => array('language' => 'Spanish (Venezuela)', 'locale' => 'es_ve', 'localeFallback' => 'spa', 'charset' => 'utf-8', 'direction' => 'ltr')); $this->assertEquals($expected, $result); $result = $localize->catalog(array('et')); $expected = array('et' => array('language' => 'Estonian', 'locale' => 'est', 'localeFallback' => 'est', 'charset' => 'utf-8', 'direction' => 'ltr')); $this->assertEquals($expected, $result); $result = $localize->catalog(array('eu')); $expected = array('eu' => array('language' => 'Basque', 'locale' => 'eus', 'localeFallback' => 'eus', 'charset' => 'utf-8', 'direction' => 'ltr')); $this->assertEquals($expected, $result); $result = $localize->catalog(array('fa')); $expected = array('fa' => array('language' => 'Farsi', 'locale' => 'fas', 'localeFallback' => 'fas', 'charset' => 'utf-8', 'direction' => 'rtl')); $this->assertEquals($expected, $result); $result = $localize->catalog(array('fi')); $expected = array('fi' => array('language' => 'Finnish', 'locale' => 'fin', 'localeFallback' => 'fin', 'charset' => 'utf-8', 'direction' => 'ltr')); $this->assertEquals($expected, $result); $result = $localize->catalog(array('fo')); $expected = array('fo' => array('language' => 'Faeroese', 'locale' => 'fao', 'localeFallback' => 'fao', 'charset' => 'utf-8', 'direction' => 'ltr')); $this->assertEquals($expected, $result); $result = $localize->catalog(array('fr', 'fr-be', 'fr-ca', 'fr-ch', 'fr-fr', 'fr-lu')); $expected = array('fr' => array('language' => 'French (Standard)', 'locale' => 'fra', 'localeFallback' => 'fra', 'charset' => 'utf-8', 'direction' => 'ltr'), 'fr-be' => array('language' => 'French (Belgium)', 'locale' => 'fr_be', 'localeFallback' => 'fra', 'charset' => 'utf-8', 'direction' => 'ltr'), 'fr-ca' => array('language' => 'French (Canadian)', 'locale' => 'fr_ca', 'localeFallback' => 'fra', 'charset' => 'utf-8', 'direction' => 'ltr'), 'fr-ch' => array('language' => 'French (Swiss)', 'locale' => 'fr_ch', 'localeFallback' => 'fra', 'charset' => 'utf-8', 'direction' => 'ltr'), 'fr-fr' => array('language' => 'French (France)', 'locale' => 'fr_fr', 'localeFallback' => 'fra', 'charset' => 'utf-8', 'direction' => 'ltr'), 'fr-lu' => array('language' => 'French (Luxembourg)', 'locale' => 'fr_lu', 'localeFallback' => 'fra', 'charset' => 'utf-8', 'direction' => 'ltr')); $this->assertEquals($expected, $result); $result = $localize->catalog(array('ga')); $expected = array('ga' => array('language' => 'Irish', 'locale' => 'gle', 'localeFallback' => 'gle', 'charset' => 'utf-8', 'direction' => 'ltr')); $this->assertEquals($expected, $result); $result = $localize->catalog(array('gd', 'gd-ie')); $expected = array('gd' => array('language' => 'Gaelic (Scots)', 'locale' => 'gla', 'localeFallback' => 'gla', 'charset' => 'utf-8', 'direction' => 'ltr'), 'gd-ie' => array('language' => 'Gaelic (Irish)', 'locale' => 'gd_ie', 'localeFallback' => 'gla', 'charset' => 'utf-8', 'direction' => 'ltr')); $this->assertEquals($expected, $result); $result = $localize->catalog(array('gl')); $expected = array('gl' => array('language' => 'Galician', 'locale' => 'glg', 'localeFallback' => 'glg', 'charset' => 'utf-8', 'direction' => 'ltr')); $this->assertEquals($expected, $result); $result = $localize->catalog(array('he')); $expected = array('he' => array('language' => 'Hebrew', 'locale' => 'heb', 'localeFallback' => 'heb', 'charset' => 'utf-8', 'direction' => 'rtl')); $this->assertEquals($expected, $result); $result = $localize->catalog(array('hi')); $expected = array('hi' => array('language' => 'Hindi', 'locale' => 'hin', 'localeFallback' => 'hin', 'charset' => 'utf-8', 'direction' => 'ltr')); $this->assertEquals($expected, $result); $result = $localize->catalog(array('hr')); $expected = array('hr' => array('language' => 'Croatian', 'locale' => 'hrv', 'localeFallback' => 'hrv', 'charset' => 'utf-8', 'direction' => 'ltr')); $this->assertEquals($expected, $result); $result = $localize->catalog(array('hu')); $expected = array('hu' => array('language' => 'Hungarian', 'locale' => 'hun', 'localeFallback' => 'hun', 'charset' => 'utf-8', 'direction' => 'ltr')); $this->assertEquals($expected, $result); $result = $localize->catalog(array('hy')); $expected = array('hy' => array('language' => 'Armenian - Armenia', 'locale' => 'hye', 'localeFallback' => 'hye', 'charset' => 'utf-8', 'direction' => 'ltr')); $this->assertEquals($expected, $result); $result = $localize->catalog(array('id')); $expected = array('id' => array('language' => 'Indonesian', 'locale' => 'ind', 'localeFallback' => 'ind', 'charset' => 'utf-8', 'direction' => 'ltr')); $this->assertEquals($expected, $result); $result = $localize->catalog(array('is')); $expected = array('is' => array('language' => 'Icelandic', 'locale' => 'isl', 'localeFallback' => 'isl', 'charset' => 'utf-8', 'direction' => 'ltr')); $this->assertEquals($expected, $result); $result = $localize->catalog(array('it', 'it-ch')); $expected = array('it' => array('language' => 'Italian', 'locale' => 'ita', 'localeFallback' => 'ita', 'charset' => 'utf-8', 'direction' => 'ltr'), 'it-ch' => array('language' => 'Italian (Swiss) ', 'locale' => 'it_ch', 'localeFallback' => 'ita', 'charset' => 'utf-8', 'direction' => 'ltr')); $this->assertEquals($expected, $result); $result = $localize->catalog(array('ja')); $expected = array('ja' => array('language' => 'Japanese', 'locale' => 'jpn', 'localeFallback' => 'jpn', 'charset' => 'utf-8', 'direction' => 'ltr')); $this->assertEquals($expected, $result); $result = $localize->catalog(array('kk')); $expected = array('kk' => array('language' => 'Kazakh', 'locale' => 'kaz', 'localeFallback' => 'kaz', 'charset' => 'utf-8', 'direction' => 'ltr')); $this->assertEquals($expected, $result); $result = $localize->catalog(array('ko', 'ko-kp', 'ko-kr')); $expected = array('ko' => array('language' => 'Korean', 'locale' => 'kor', 'localeFallback' => 'kor', 'charset' => 'kr', 'direction' => 'ltr'), 'ko-kp' => array('language' => 'Korea (North)', 'locale' => 'ko_kp', 'localeFallback' => 'kor', 'charset' => 'kr', 'direction' => 'ltr'), 'ko-kr' => array('language' => 'Korea (South)', 'locale' => 'ko_kr', 'localeFallback' => 'kor', 'charset' => 'kr', 'direction' => 'ltr')); $this->assertEquals($expected, $result); $result = $localize->catalog(array('koi8-r', 'ru', 'ru-mo')); $expected = array('koi8-r' => array('language' => 'Russian', 'locale' => 'koi8_r', 'localeFallback' => 'rus', 'charset' => 'koi8-r', 'direction' => 'ltr'), 'ru' => array('language' => 'Russian', 'locale' => 'rus', 'localeFallback' => 'rus', 'charset' => 'utf-8', 'direction' => 'ltr'), 'ru-mo' => array('language' => 'Russian (Moldavia)', 'locale' => 'ru_mo', 'localeFallback' => 'rus', 'charset' => 'utf-8', 'direction' => 'ltr')); $this->assertEquals($expected, $result); $result = $localize->catalog(array('lt')); $expected = array('lt' => array('language' => 'Lithuanian', 'locale' => 'lit', 'localeFallback' => 'lit', 'charset' => 'utf-8', 'direction' => 'ltr')); $this->assertEquals($expected, $result); $result = $localize->catalog(array('lv')); $expected = array('lv' => array('language' => 'Latvian', 'locale' => 'lav', 'localeFallback' => 'lav', 'charset' => 'utf-8', 'direction' => 'ltr')); $this->assertEquals($expected, $result); $result = $localize->catalog(array('mk', 'mk-mk')); $expected = array('mk' => array('language' => 'FYRO Macedonian', 'locale' => 'mkd', 'localeFallback' => 'mkd', 'charset' => 'utf-8', 'direction' => 'ltr'), 'mk-mk' => array('language' => 'Macedonian', 'locale' => 'mk_mk', 'localeFallback' => 'mkd', 'charset' => 'utf-8', 'direction' => 'ltr')); $this->assertEquals($expected, $result); $result = $localize->catalog(array('ms')); $expected = array('ms' => array('language' => 'Malaysian', 'locale' => 'msa', 'localeFallback' => 'msa', 'charset' => 'utf-8', 'direction' => 'ltr')); $this->assertEquals($expected, $result); $result = $localize->catalog(array('mt')); $expected = array('mt' => array('language' => 'Maltese', 'locale' => 'mlt', 'localeFallback' => 'mlt', 'charset' => 'utf-8', 'direction' => 'ltr')); $this->assertEquals($expected, $result); $result = $localize->catalog(array('nl', 'nl-be')); $expected = array('nl' => array('language' => 'Dutch (Standard)', 'locale' => 'nld', 'localeFallback' => 'nld', 'charset' => 'utf-8', 'direction' => 'ltr'), 'nl-be' => array('language' => 'Dutch (Belgium)', 'locale' => 'nl_be', 'localeFallback' => 'nld', 'charset' => 'utf-8', 'direction' => 'ltr')); $this->assertEquals($expected, $result); $result = $localize->catalog('nl'); $expected = array('language' => 'Dutch (Standard)', 'locale' => 'nld', 'localeFallback' => 'nld', 'charset' => 'utf-8', 'direction' => 'ltr'); $this->assertEquals($expected, $result); $result = $localize->catalog('nld'); $expected = array('language' => 'Dutch (Standard)', 'locale' => 'nld', 'localeFallback' => 'nld', 'charset' => 'utf-8', 'direction' => 'ltr'); $this->assertEquals($expected, $result); $result = $localize->catalog('dut'); $expected = array('language' => 'Dutch (Standard)', 'locale' => 'nld', 'localeFallback' => 'nld', 'charset' => 'utf-8', 'direction' => 'ltr'); $this->assertEquals($expected, $result); $result = $localize->catalog(array('nb')); $expected = array('nb' => array('language' => 'Norwegian Bokmal', 'locale' => 'nob', 'localeFallback' => 'nor', 'charset' => 'utf-8', 'direction' => 'ltr')); $this->assertEquals($expected, $result); $result = $localize->catalog(array('nn', 'no')); $expected = array('nn' => array('language' => 'Norwegian Nynorsk', 'locale' => 'nno', 'localeFallback' => 'nor', 'charset' => 'utf-8', 'direction' => 'ltr'), 'no' => array('language' => 'Norwegian', 'locale' => 'nor', 'localeFallback' => 'nor', 'charset' => 'utf-8', 'direction' => 'ltr')); $this->assertEquals($expected, $result); $result = $localize->catalog(array('pl')); $expected = array('pl' => array('language' => 'Polish', 'locale' => 'pol', 'localeFallback' => 'pol', 'charset' => 'utf-8', 'direction' => 'ltr')); $this->assertEquals($expected, $result); $result = $localize->catalog(array('pt', 'pt-br')); $expected = array('pt' => array('language' => 'Portuguese (Portugal)', 'locale' => 'por', 'localeFallback' => 'por', 'charset' => 'utf-8', 'direction' => 'ltr'), 'pt-br' => array('language' => 'Portuguese (Brazil)', 'locale' => 'pt_br', 'localeFallback' => 'por', 'charset' => 'utf-8', 'direction' => 'ltr')); $this->assertEquals($expected, $result); $result = $localize->catalog(array('rm')); $expected = array('rm' => array('language' => 'Rhaeto-Romanic', 'locale' => 'roh', 'localeFallback' => 'roh', 'charset' => 'utf-8', 'direction' => 'ltr')); $this->assertEquals($expected, $result); $result = $localize->catalog(array('ro', 'ro-mo')); $expected = array('ro' => array('language' => 'Romanian', 'locale' => 'ron', 'localeFallback' => 'ron', 'charset' => 'utf-8', 'direction' => 'ltr'), 'ro-mo' => array('language' => 'Romanian (Moldavia)', 'locale' => 'ro_mo', 'localeFallback' => 'ron', 'charset' => 'utf-8', 'direction' => 'ltr')); $this->assertEquals($expected, $result); $result = $localize->catalog(array('sb')); $expected = array('sb' => array('language' => 'Sorbian', 'locale' => 'wen', 'localeFallback' => 'wen', 'charset' => 'utf-8', 'direction' => 'ltr')); $this->assertEquals($expected, $result); $result = $localize->catalog(array('sk')); $expected = array('sk' => array('language' => 'Slovak', 'locale' => 'slk', 'localeFallback' => 'slk', 'charset' => 'utf-8', 'direction' => 'ltr')); $this->assertEquals($expected, $result); $result = $localize->catalog(array('sl')); $expected = array('sl' => array('language' => 'Slovenian', 'locale' => 'slv', 'localeFallback' => 'slv', 'charset' => 'utf-8', 'direction' => 'ltr')); $this->assertEquals($expected, $result); $result = $localize->catalog(array('sq')); $expected = array('sq' => array('language' => 'Albanian', 'locale' => 'sqi', 'localeFallback' => 'sqi', 'charset' => 'utf-8', 'direction' => 'ltr')); $this->assertEquals($expected, $result); $result = $localize->catalog(array('sr')); $expected = array('sr' => array('language' => 'Serbian', 'locale' => 'srp', 'localeFallback' => 'srp', 'charset' => 'utf-8', 'direction' => 'ltr')); $this->assertEquals($expected, $result); $result = $localize->catalog(array('sv', 'sv-fi')); $expected = array('sv' => array('language' => 'Swedish', 'locale' => 'swe', 'localeFallback' => 'swe', 'charset' => 'utf-8', 'direction' => 'ltr'), 'sv-fi' => array('language' => 'Swedish (Finland)', 'locale' => 'sv_fi', 'localeFallback' => 'swe', 'charset' => 'utf-8', 'direction' => 'ltr')); $this->assertEquals($expected, $result); $result = $localize->catalog(array('se')); $expected = array('se' => array('language' => 'Sami', 'locale' => 'sme', 'localeFallback' => 'sme', 'charset' => 'utf-8', 'direction' => 'ltr')); $this->assertEquals($expected, $result); $result = $localize->catalog(array('th')); $expected = array('th' => array('language' => 'Thai', 'locale' => 'tha', 'localeFallback' => 'tha', 'charset' => 'utf-8', 'direction' => 'ltr')); $this->assertEquals($expected, $result); $result = $localize->catalog(array('tn')); $expected = array('tn' => array('language' => 'Tswana', 'locale' => 'tsn', 'localeFallback' => 'tsn', 'charset' => 'utf-8', 'direction' => 'ltr')); $this->assertEquals($expected, $result); $result = $localize->catalog(array('tr')); $expected = array('tr' => array('language' => 'Turkish', 'locale' => 'tur', 'localeFallback' => 'tur', 'charset' => 'utf-8', 'direction' => 'ltr')); $this->assertEquals($expected, $result); $result = $localize->catalog(array('ts')); $expected = array('ts' => array('language' => 'Tsonga', 'locale' => 'tso', 'localeFallback' => 'tso', 'charset' => 'utf-8', 'direction' => 'ltr')); $this->assertEquals($expected, $result); $result = $localize->catalog(array('uk')); $expected = array('uk' => array('language' => 'Ukrainian', 'locale' => 'ukr', 'localeFallback' => 'ukr', 'charset' => 'utf-8', 'direction' => 'ltr')); $this->assertEquals($expected, $result); $result = $localize->catalog(array('ur')); $expected = array('ur' => array('language' => 'Urdu', 'locale' => 'urd', 'localeFallback' => 'urd', 'charset' => 'utf-8', 'direction' => 'rtl')); $this->assertEquals($expected, $result); $result = $localize->catalog(array('ve')); $expected = array('ve' => array('language' => 'Venda', 'locale' => 'ven', 'localeFallback' => 'ven', 'charset' => 'utf-8', 'direction' => 'ltr')); $this->assertEquals($expected, $result); $result = $localize->catalog(array('vi')); $expected = array('vi' => array('language' => 'Vietnamese', 'locale' => 'vie', 'localeFallback' => 'vie', 'charset' => 'utf-8', 'direction' => 'ltr')); $this->assertEquals($expected, $result); $result = $localize->catalog(array('cy')); $expected = array('cy' => array('language' => 'Welsh', 'locale' => 'cym', 'localeFallback' => 'cym', 'charset' => 'utf-8', 'direction' => 'ltr')); $this->assertEquals($expected, $result); $result = $localize->catalog(array('xh')); $expected = array('xh' => array('language' => 'Xhosa', 'locale' => 'xho', 'localeFallback' => 'xho', 'charset' => 'utf-8', 'direction' => 'ltr')); $this->assertEquals($expected, $result); $result = $localize->catalog(array('yi')); $expected = array('yi' => array('language' => 'Yiddish', 'locale' => 'yid', 'localeFallback' => 'yid', 'charset' => 'utf-8', 'direction' => 'ltr')); $this->assertEquals($expected, $result); $result = $localize->catalog(array('zh', 'zh-cn', 'zh-hk', 'zh-sg', 'zh-tw')); $expected = array('zh' => array('language' => 'Chinese', 'locale' => 'zho', 'localeFallback' => 'zho', 'charset' => 'utf-8', 'direction' => 'ltr'), 'zh-cn' => array('language' => 'Chinese (PRC)', 'locale' => 'zh_cn', 'localeFallback' => 'zho', 'charset' => 'GB2312', 'direction' => 'ltr'), 'zh-hk' => array('language' => 'Chinese (Hong Kong)', 'locale' => 'zh_hk', 'localeFallback' => 'zho', 'charset' => 'utf-8', 'direction' => 'ltr'), 'zh-sg' => array('language' => 'Chinese (Singapore)', 'locale' => 'zh_sg', 'localeFallback' => 'zho', 'charset' => 'utf-8', 'direction' => 'ltr'), 'zh-tw' => array('language' => 'Chinese (Taiwan)', 'locale' => 'zh_tw', 'localeFallback' => 'zho', 'charset' => 'utf-8', 'direction' => 'ltr')); $this->assertEquals($expected, $result); $result = $localize->catalog(array('zu')); $expected = array('zu' => array('language' => 'Zulu', 'locale' => 'zul', 'localeFallback' => 'zul', 'charset' => 'utf-8', 'direction' => 'ltr')); $this->assertEquals($expected, $result); $result = $localize->catalog(array('en-nz', 'es-do', 'ar-lb', 'zh-hk', 'pt-br')); $expected = array('en-nz' => array('language' => 'English (New Zealand)', 'locale' => 'en_nz', 'localeFallback' => 'eng', 'charset' => 'utf-8', 'direction' => 'ltr'), 'es-do' => array('language' => 'Spanish (Dominican Republic)', 'locale' => 'es_do', 'localeFallback' => 'spa', 'charset' => 'utf-8', 'direction' => 'ltr'), 'ar-lb' => array('language' => 'Arabic (Lebanon)', 'locale' => 'ar_lb', 'localeFallback' => 'ara', 'charset' => 'utf-8', 'direction' => 'rtl'), 'zh-hk' => array('language' => 'Chinese (Hong Kong)', 'locale' => 'zh_hk', 'localeFallback' => 'zho', 'charset' => 'utf-8', 'direction' => 'ltr'), 'pt-br' => array('language' => 'Portuguese (Brazil)', 'locale' => 'pt_br', 'localeFallback' => 'por', 'charset' => 'utf-8', 'direction' => 'ltr')); $this->assertEquals($expected, $result); $result = $localize->catalog(array('eng', 'deu', 'zho', 'rum', 'zul', 'yid')); $expected = array('eng' => array('language' => 'English', 'locale' => 'eng', 'localeFallback' => 'eng', 'charset' => 'utf-8', 'direction' => 'ltr'), 'deu' => array('language' => 'German (Standard)', 'locale' => 'deu', 'localeFallback' => 'deu', 'charset' => 'utf-8', 'direction' => 'ltr'), 'zho' => array('language' => 'Chinese', 'locale' => 'zho', 'localeFallback' => 'zho', 'charset' => 'utf-8', 'direction' => 'ltr'), 'rum' => array('language' => 'Romanian', 'locale' => 'ron', 'localeFallback' => 'ron', 'charset' => 'utf-8', 'direction' => 'ltr'), 'zul' => array('language' => 'Zulu', 'locale' => 'zul', 'localeFallback' => 'zul', 'charset' => 'utf-8', 'direction' => 'ltr'), 'yid' => array('language' => 'Yiddish', 'locale' => 'yid', 'localeFallback' => 'yid', 'charset' => 'utf-8', 'direction' => 'ltr')); $this->assertEquals($expected, $result); }
* * Licensed under The Languages Packages Licenses. * Support : phpb2b@hotmail.com * * @version $Revision$ */ require "../libraries/common.inc.php"; require "room.share.php"; uses("templet"); check_permission("space"); $templet = new Templets(); if (empty($companyinfo)) { flash("pls_complete_company_info", "company.php", 0); } if (isset($_POST['updateSpaceName']) && !empty($_POST['data']['space_name'])) { $space_name = trim($_POST['data']['space_name']); $space_name = L10n::translateSpaceName($space_name); $result = $member->updateSpaceName(array("id" => $_SESSION['MemberID']), $space_name); if ($result) { flash("success"); } } if (isset($_POST['save']) && !empty($_POST['data']['member']['styleid'])) { $templet_id = intval($_POST['data']['member']['styleid']); $pdb->Execute("UPDATE {$tb_prefix}members SET templet_id=" . $templet_id . " WHERE id=" . $_SESSION['MemberID']); flash("success"); } setvar("templet_id", $memberinfo['templet_id']); $result = $templet->getInstalled($memberinfo['membergroup_id'], $memberinfo['membertype_id']); setvar("Items", $result); template("space");
/** * quicklinks: clear, today, ... * * @return void */ public function dateScripts($scripts = [], $quicklinks = false) { foreach ($scripts as $script) { if (!$this->scriptsAdded[$script]) { switch ($script) { case 'date': $lang = Configure::read('Config.language'); if (strlen($lang) !== 2) { App::uses('L10n', 'I18n'); $Localization = new L10n(); $lang = $Localization->map($lang); } if (strlen($lang) !== 2) { $lang = 'en'; } if ($this->settings['webroot']) { $this->Html->script('datepicker/lang/' . $lang, ['inline' => false]); $this->Html->script('datepicker/datepicker', ['inline' => false]); $this->Html->css('common/datepicker', ['inline' => false]); } else { $this->Common->script(['ToolsExtra.Asset|datepicker/lang/' . $lang, 'ToolsExtra.Asset|datepicker/datepicker'], ['inline' => false]); $this->Common->css(['ToolsExtra.Asset|datepicker/datepicker'], ['inline' => false]); } $this->scriptsAdded['date'] = true; break; case 'time': continue; if ($this->settings['webroot']) { } else { //'ToolsExtra.Jquery|ui/core/jquery.ui.core', 'ToolsExtra.Jquery|ui/core/jquery.ui.widget', 'ToolsExtra.Jquery|ui/widgets/jquery.ui.slider', $this->Common->script(['ToolsExtra.Jquery|plugins/jquery.timepicker.core', 'ToolsExtra.Jquery|plugins/jquery.timepicker'], ['inline' => false]); $this->Common->css(['ToolsExtra.Jquery|ui/core/jquery.ui', 'ToolsExtra.Jquery|plugins/jquery.timepicker'], ['inline' => false]); } break; default: break; } if ($quicklinks) { } } } }
/** * Set current language * * @param string $lang * @return bool Success */ public static function setLocale($lang = null, $setCookie = false) { $locales = SlConfigure::read('I18n.locales'); if (empty($locales)) { $languages = SlConfigure::read1('I18n.languages'); $langs = array_keys($languages); $locales = array(); $catalogs = array(); if (!$langs) { $langs = array('en'); } App::import('Core', 'l10n'); $l10n = new L10n(); foreach ($langs as $lang_) { $catalog = $l10n->catalog($lang_); if ($catalog) { $catalogs[$lang_] = $catalog; $locales[$lang_] = $catalog['locale']; } } $langs = array_keys($locales); SlConfigure::write('I18n.langs', $langs); SlConfigure::write('I18n.catalogs', $catalogs); SlConfigure::write('I18n.locales', $locales); if (empty($lang)) { $lang = SlCookie::read('I18n.lang'); // guess language based on Accept-Language header if (empty($lang)) { $envLangs = explode(',', env('HTTP_ACCEPT_LANGUAGE')); foreach ($envLangs as $envLang) { list($envLang) = explode(';', $envLang); if (isset($locales[$envLang])) { $lang = $envLang; break; } } if (empty($lang)) { $lang = SlConfigure::read('I18n.lang'); } } // convert locale_id to lang_id $lang_ = array_search($lang, $locales); if ($lang_) { $lang = $lang_; } if (empty($lang) || !isset($locales[$lang])) { $lang = $langs[0]; } } } else { $catalogs = SlConfigure::read('I18n.catalogs'); } if ($lang) { // convert locale_id to lang_id $lang_ = array_search($lang, $locales); if ($lang_) { $lang = $lang_; } if (isset($locales[$lang])) { SlConfigure::write('I18n.lang', $lang); SlConfigure::write('I18n.catalog', $catalogs[$lang]); SlConfigure::write('I18n.locale', $locales[$lang]); Configure::write('Config.language', $locales[$lang]); if ($setCookie) { SlCookie::write('I18n.lang', $lang, false, "+1 year"); } SlConfigure::localeChanged(); return true; } } return false; }