当前位置: 首页>>代码示例>>PHP>>正文


PHP Zend_Locale::getLanguage方法代码示例

本文整理汇总了PHP中Zend_Locale::getLanguage方法的典型用法代码示例。如果您正苦于以下问题:PHP Zend_Locale::getLanguage方法的具体用法?PHP Zend_Locale::getLanguage怎么用?PHP Zend_Locale::getLanguage使用的例子?那么恭喜您, 这里精选的方法代码示例或许可以为您提供帮助。您也可以进一步了解该方法所在Zend_Locale的用法示例。


在下文中一共展示了Zend_Locale::getLanguage方法的15个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的PHP代码示例。

示例1: init

 public function init()
 {
     parent::init();
     try {
         $locale = Zend_Registry::get("Zend_Locale");
     } catch (Exception $e) {
         $locale = new Zend_Locale("en");
     }
     $this->view->language = $locale->getLanguage();
     $this->language = $locale->getLanguage();
 }
开发者ID:ngocanh,项目名称:pimcore,代码行数:11,代码来源:Action.php

示例2: getDatePickerLocaleJavascriptFile

 /**
  * Return the javascript file used to localize the datePicker component
  *
  * @param Zend_Locale                               $locale   the given locale
  * @param ZendX_JQuery_View_Helper_JQuery_Container $instance the jquery helper
  *
  * @return string
  */
 public function getDatePickerLocaleJavascriptFile(Zend_Locale $locale, $instance)
 {
     if ($instance->useUiCdn()) {
         $baseUri = $instance->_getJQueryLibraryBaseCdnUri();
         $uiPath = $baseUri . ZendX_JQuery::CDN_SUBFOLDER_JQUERYUI . $instance->getUiVersion() . "/i18n/jquery.ui.datepicker-{$locale->getLanguage()}.js";
     } else {
         if ($instance->useUiLocal()) {
             $uiPath = $instance->getUiPath() . "/i18n/jquery.ui.datepicker-{$locale->getLanguage()}.js";
         }
     }
     return $uiPath;
 }
开发者ID:JellyBellyDev,项目名称:zle,代码行数:20,代码来源:JQueryPathBuilder.php

示例3: loadFormData

 /**
  * Hook that loads the form data from $_POST or the model
  *
  * Or from whatever other source you specify here.
  */
 protected function loadFormData()
 {
     parent::loadFormData();
     if ($this->trackEngine instanceof \Gems_Tracker_Engine_StepEngineAbstract) {
         if ($this->trackEngine->updateRoundModelToItem($this->getModel(), $this->formData, $this->locale->getLanguage())) {
             if (isset($this->formData[$this->saveButtonId])) {
                 // Disable validation & save
                 unset($this->formData[$this->saveButtonId]);
                 // Warn user
                 $this->addMessage($this->_('Lists choices changed.'));
             }
         }
     }
 }
开发者ID:harmslijper,项目名称:gemstracker-library,代码行数:19,代码来源:EditRoundStepSnippet.php

示例4: kcfinder

 /**
  * Execute method
  * 
  * @param string $name
  * @param string $type
  * @param array $attribs
  * @param string $kcfinderPath
  * @return string 
  */
 public function kcfinder($name, $type = 'file', array $attribs = array(), $kcfinderPath = null)
 {
     if (null !== $kcfinderPath) {
         self::$kcfinderPath = $kcfinderPath;
     }
     $src = self::$kcfinderPath . '?type=' . $type . '&lang=' . $this->locale->getLanguage();
     if (isset($attribs['src'])) {
         unset($attribs['src']);
     }
     $xhtml = '<div ' . $this->_htmlAttribs($attribs) . '>';
     $xhtml .= '<iframe id="' . $this->view->escape($name) . '" src="' . $src . '"></iframe>';
     $xhtml .= '</div>';
     return $xhtml;
 }
开发者ID:lciolecki,项目名称:zf-extensions-library,代码行数:23,代码来源:Kcfinder.php

示例5: init

 public function init()
 {
     parent::init();
     if (\Zend_Registry::isRegistered('Zend_Locale')) {
         $this->locale = \Zend_Registry::get('Zend_Locale');
     } else {
         $this->locale = new \Zend_Locale('en');
         \Zend_Registry::set('Zend_Locale', $this->locale);
     }
     $this->view->language = $this->locale->getLanguage();
     $this->language = $this->locale->getLanguage();
     $this->translate = $this->initTranslation();
     \Zend_View_Helper_PaginationControl::setDefaultViewPartial('partial/pagination.php');
 }
开发者ID:hagith,项目名称:pimcore-boilerplate,代码行数:14,代码来源:Action.php

示例6: displayDateCalculation

 /**
  * Changes the display of gro_valid_[after|for]_field into something readable
  *
  * @param mixed $value The value being saved
  * @param boolean $isNew True when a new item is being saved
  * @param string $name The name of the current field
  * @param array $context Optional, the other values being saved
  * @return string The value to use
  */
 public function displayDateCalculation($value, $new, $name, array $context = array())
 {
     $fieldBase = substr($name, 0, -5);
     // Strip field
     $validAfter = (bool) strpos($fieldBase, 'after');
     // When always valid, just return nothing
     if ($context[$fieldBase . 'source'] == self::NO_TABLE) {
         return '';
     }
     $fields = $this->getDateOptionsFor($context[$fieldBase . 'source'], $context[$fieldBase . 'id'], $this->locale->getLanguage(), $validAfter);
     if (isset($fields[$context[$fieldBase . 'field']])) {
         $field = $fields[$context[$fieldBase . 'field']];
     } else {
         $field = $context[$fieldBase . 'field'];
     }
     if ($context[$fieldBase . 'length'] > 0) {
         $format = $this->_('%s plus %s %s');
     } elseif ($context[$fieldBase . 'length'] < 0) {
         $format = $this->_('%s minus %s %s');
     } else {
         $format = $this->_('%s');
     }
     $units = $this->util->getTranslated()->getPeriodUnits();
     if (isset($units[$context[$fieldBase . 'unit']])) {
         $unit = $units[$context[$fieldBase . 'unit']];
     } else {
         $unit = $context[$fieldBase . 'unit'];
     }
     // \MUtil_Echo::track(func_get_args());
     return sprintf($format, $field, abs($context[$fieldBase . 'length']), $unit);
 }
开发者ID:GemsTracker,项目名称:gemstracker-library,代码行数:40,代码来源:StepEngineAbstract.php

示例7: toSurveyAction

 /**
  * Go directly to url
  */
 public function toSurveyAction()
 {
     if (!$this->_initToken()) {
         // Default option
         $this->_forward('index');
         return;
     }
     $language = $this->locale->getLanguage();
     try {
         $url = $this->token->getUrl($language, $this->currentUser->getUserId() ? $this->currentUser->getUserId() : $this->token->getRespondentId());
         /************************
          * Optional user logout *
          ************************/
         if ($this->currentUser->isLogoutOnSurvey()) {
             $this->currentUser->unsetAsCurrentUser();
         }
         // Redirect at once
         header('Location: ' . $url);
         exit;
     } catch (\Gems_Tracker_Source_SurveyNotFoundException $e) {
         $this->addMessage(sprintf($this->_('The survey for token %s is no longer active.'), strtoupper($this->tokenId)));
         // Default option
         $this->_forward('index');
     }
 }
开发者ID:GemsTracker,项目名称:gemstracker-library,代码行数:28,代码来源:AskAction.php

示例8: createModel

 /**
  * Creates the model
  *
  * @return \MUtil_Model_ModelAbstract
  */
 protected function createModel()
 {
     $model = $this->token->getSurveyAnswerModel($this->locale->getLanguage());
     $model->set('gto_valid_from', 'dateFormat', $this->dateFormat);
     $model->set('gto_completion_time', 'dateFormat', $this->dateFormat);
     return $model;
 }
开发者ID:GemsTracker,项目名称:gemstracker-library,代码行数:12,代码来源:AnswerModelSnippetGeneric.php

示例9: languageDetectionAction

 /**
  * @throws Exception
  */
 public function languageDetectionAction()
 {
     // Get the browser language
     $locale = new Zend_Locale();
     $browserLanguage = $locale->getLanguage();
     $languages = Tool::getValidLanguages();
     // Check if the browser language is a valid frontend language
     if (in_array($browserLanguage, $languages)) {
         $language = $browserLanguage;
     } else {
         // If it is not, take the first frontend language as default
         $language = reset($languages);
     }
     // Get the folder of the current language (in the current site)
     $currentSitePath = $this->document->getRealFullPath();
     $folder = Document\Page::getByPath($currentSitePath . '/' . $language);
     if ($folder) {
         $document = $this->findFirstDocumentByParentId($folder->getId());
         if ($document) {
             $this->redirect($document->getPath() . $document->getKey());
         } else {
             throw new Exception('No document found in your browser language');
         }
     } else {
         throw new Exception('No language folder found that matches your browser language');
     }
 }
开发者ID:studioemma,项目名称:multilingual,代码行数:30,代码来源:DefaultController.php

示例10: init

 public function init()
 {
     $this->setTitle('Language Manager')->setDescription('Create a new language pack')->setAction(Zend_Controller_Front::getInstance()->getRouter()->assemble(array()));
     $localeObject = Zend_Registry::get('Locale');
     $languages = Zend_Locale::getTranslationList('language', $localeObject);
     $territories = Zend_Locale::getTranslationList('territory', $localeObject);
     $localeMultiOptions = array();
     foreach (array_keys(Zend_Locale::getLocaleList()) as $key) {
         $languageName = null;
         if (!empty($languages[$key])) {
             $languageName = $languages[$key];
         } else {
             $tmpLocale = new Zend_Locale($key);
             $region = $tmpLocale->getRegion();
             $language = $tmpLocale->getLanguage();
             if (!empty($languages[$language]) && !empty($territories[$region])) {
                 $languageName = $languages[$language] . ' (' . $territories[$region] . ')';
             }
         }
         if ($languageName) {
             $localeMultiOptions[$key] = $languageName . ' [' . $key . ']';
         }
     }
     //asort($languageNameList);
     $this->addElement('Select', 'language', array('label' => 'Language', 'description' => 'Which language do you want to create a language pack for?', 'multiOptions' => $localeMultiOptions));
     // Init submit
     $this->addElement('Button', 'submit', array('label' => 'Create', 'type' => 'submit', 'decorators' => array('ViewHelper')));
     $this->addElement('Cancel', 'cancel', array('prependText' => ' or ', 'link' => true, 'label' => 'cancel', 'onclick' => 'history.go(-1); return false;', 'decorators' => array('ViewHelper')));
 }
开发者ID:robeendey,项目名称:ce,代码行数:29,代码来源:Create.php

示例11: on_start

 public function on_start()
 {
     $this->error = Loader::helper('validation/error');
     if (USER_REGISTRATION_WITH_EMAIL_ADDRESS == true) {
         $this->set('uNameLabel', t('Email Address'));
     } else {
         $this->set('uNameLabel', t('Username'));
     }
     $txt = Loader::helper('text');
     if (strlen($_GET['uName'])) {
         // pre-populate the username if supplied, if its an email address with special characters the email needs to be urlencoded first,
         $this->set("uName", trim($txt->email($_GET['uName'])));
     }
     $languages = array();
     $locales = array();
     if (Config::get('LANGUAGE_CHOOSE_ON_LOGIN')) {
         Loader::library('3rdparty/Zend/Locale');
         Loader::library('3rdparty/Zend/Locale/Data');
         $languages = Localization::getAvailableInterfaceLanguages();
         if (count($languages) > 0) {
             array_unshift($languages, 'en_US');
         }
         $locales = array('' => t('** Default'));
         Zend_Locale_Data::setCache(Cache::getLibrary());
         foreach ($languages as $lang) {
             $loc = new Zend_Locale($lang);
             $locales[$lang] = Zend_Locale::getTranslation($loc->getLanguage(), 'language', ACTIVE_LOCALE);
         }
     }
     $this->locales = $locales;
     $this->set('locales', $locales);
     $this->openIDReturnTo = BASE_URL . View::url("/login", "complete_openid");
 }
开发者ID:ricardomccerqueira,项目名称:rcerqueira.portfolio,代码行数:33,代码来源:login.php

示例12: iniTranslation

 /**
  * Init Translation system using gettext
  *
  * @param object $locale instance of Zend_Locale
  *
  * @return void
  */
 public function iniTranslation($locale, array $availableDomains = array())
 {
     if (!$locale instanceof Zend_Locale) {
         $locale = new Zend_Locale($locale);
     }
     $localeDirPath = $this->getConfig('localeDirPath');
     // init available gettext domains
     foreach ($availableDomains as $domain) {
         bindtextdomain($domain, $localeDirPath);
         bind_textdomain_codeset($domain, 'UTF-8');
     }
     // set first domain has default domain
     $defaultDomain = array_shift($availableDomains);
     textdomain($defaultDomain);
     $localeWithEncoding = $locale . '.utf8';
     // mandatory for gettext
     if (putenv('LANGUAGE') != $locale->getLanguage()) {
         throw new BaseZF_Service_GetText_Exception(sprintf('Could not set the ENV variable LANGUAGE = %s', $locale));
     }
     if (setlocale(LC_MESSAGES, $localeWithEncoding) !== $localeWithEncoding) {
         throw new BaseZF_Service_GetText_Exception(sprintf('Unable to set locale "%s" to value "%s", please check installed locales on system', 'LC_MESSAGES', $localeWithEncoding));
     }
     if (setlocale(LC_TIME, $localeWithEncoding) !== $localeWithEncoding) {
         throw new BaseZF_Service_GetText_Exception(sprintf('Unable to set locale "%s" to value "%s", please check installed locales on system', 'LC_TIME', $localeWithEncoding));
     }
     return $this;
 }
开发者ID:hthetiot,项目名称:basezf,代码行数:34,代码来源:GetText.php

示例13: build

 private static function build()
 {
     # recupera idioma requisitado ou tenta descobri-lo
     if (!($acronym = self::lang())) {
         $locale = new Zend_Locale();
         $acronym = $locale->getLanguage();
     }
     # seleciona idioma solicitado/utilizado
     $language = [];
     foreach (Ao_Data_Language::$data as $lang) {
         if ($acronym == $lang['acronym']) {
             $language = $lang;
             break;
         }
     }
     # set idioma padrão se nenhum for associado
     if (empty($language)) {
         $language = Ao_Data_Language::$data[self::LANG_ID];
     }
     # inicializa atributos
     $lang = new stdClass();
     $lang->id = $language['id'];
     $lang->acronym = $language['acronym'];
     $lang->name = $language['name'];
     # return
     return $lang;
 }
开发者ID:ao-lab,项目名称:ao-zend,代码行数:27,代码来源:Ao_Language.php

示例14: __construct

 /**
  * Constructure and setting configuration
  *
  * @param array $config
  * @throws Ht_Utils_PoCreater_Exception
  */
 public function __construct($config = array())
 {
     if (!isset($config[self::LOCAL_DIR_KEY])) {
         throw new Ht_Utils_PoCreater_Exception("Local path not setting !");
     }
     if (realpath($config[self::LOCAL_DIR_KEY])) {
         $this->_locales_dir = realpath($config[self::LOCAL_DIR_KEY]);
     } else {
         throw new Ht_Utils_PoCreater_Exception("Local path setting up is not exists!");
     }
     if (isset($config[self::LANGUAGE_KEY])) {
         if ($config[self::LANGUAGE_KEY] != "") {
             try {
                 $locale = new Zend_Locale($config[self::LANGUAGE_KEY]);
                 $this->_language = $locale->getLanguage();
             } catch (Ht_Utils_PoCreater_Exception $e) {
                 throw $e;
             }
         }
     }
     if (isset($config[self::ADAPTER_KEY]) && $config[self::ADAPTER_KEY] instanceof Zend_Db_Table_Abstract) {
         $this->_adapter = $config[self::ADAPTER_KEY];
     }
     if (isset($config[self::DATA_KEY])) {
         $this->_data = $config[self::DATA_KEY];
     }
 }
开发者ID:kangza,项目名称:hagtag,代码行数:33,代码来源:PoCreator.php

示例15: init

 public function init()
 {
     $this->setTitle('Locale Settings')->setDescription('CORE_FORM_ADMIN_SETTINGS_LOCALE_DESCRIPTION');
     // Init timezeon
     $this->addElement('Select', 'timezone', array('label' => 'Default Timezone', 'multiOptions' => array('US/Pacific' => '(UTC-8) Pacific Time (US & Canada)', 'US/Mountain' => '(UTC-7) Mountain Time (US & Canada)', 'US/Central' => '(UTC-6) Central Time (US & Canada)', 'US/Eastern' => '(UTC-5) Eastern Time (US & Canada)', 'America/Halifax' => '(UTC-4)  Atlantic Time (Canada)', 'America/Anchorage' => '(UTC-9)  Alaska (US & Canada)', 'Pacific/Honolulu' => '(UTC-10) Hawaii (US)', 'Pacific/Samoa' => '(UTC-11) Midway Island, Samoa', 'Etc/GMT-12' => '(UTC-12) Eniwetok, Kwajalein', 'Canada/Newfoundland' => '(UTC-3:30) Canada/Newfoundland', 'America/Buenos_Aires' => '(UTC-3) Brasilia, Buenos Aires, Georgetown', 'Atlantic/South_Georgia' => '(UTC-2) Mid-Atlantic', 'Atlantic/Azores' => '(UTC-1) Azores, Cape Verde Is.', 'Europe/London' => 'Greenwich Mean Time (Lisbon, London)', 'Europe/Berlin' => '(UTC+1) Amsterdam, Berlin, Paris, Rome, Madrid', 'Europe/Athens' => '(UTC+2) Athens, Helsinki, Istanbul, Cairo, E. Europe', 'Europe/Moscow' => '(UTC+3) Baghdad, Kuwait, Nairobi, Moscow', 'Iran' => '(UTC+3:30) Tehran', 'Asia/Dubai' => '(UTC+4) Abu Dhabi, Kazan, Muscat', 'Asia/Kabul' => '(UTC+4:30) Kabul', 'Asia/Yekaterinburg' => '(UTC+5) Islamabad, Karachi, Tashkent', 'Asia/Dili' => '(UTC+5:30) Bombay, Calcutta, New Delhi', 'Asia/Katmandu' => '(UTC+5:45) Nepal', 'Asia/Omsk' => '(UTC+6) Almaty, Dhaka', 'India/Cocos' => '(UTC+6:30) Cocos Islands, Yangon', 'Asia/Krasnoyarsk' => '(UTC+7) Bangkok, Jakarta, Hanoi', 'Asia/Hong_Kong' => '(UTC+8) Beijing, Hong Kong, Singapore, Taipei', 'Asia/Tokyo' => '(UTC+9) Tokyo, Osaka, Sapporto, Seoul, Yakutsk', 'Australia/Adelaide' => '(UTC+9:30) Adelaide, Darwin', 'Australia/Sydney' => '(UTC+10) Brisbane, Melbourne, Sydney, Guam', 'Asia/Magadan' => '(UTC+11) Magadan, Soloman Is., New Caledonia', 'Pacific/Auckland' => '(UTC+12) Fiji, Kamchatka, Marshall Is., Wellington')));
     // Init default locale
     $localeObject = Zend_Registry::get('Locale');
     $languages = Zend_Locale::getTranslationList('language', $localeObject);
     $territories = Zend_Locale::getTranslationList('territory', $localeObject);
     $localeMultiOptions = array();
     foreach (array_keys(Zend_Locale::getLocaleList()) as $key) {
         $languageName = null;
         if (!empty($languages[$key])) {
             $languageName = $languages[$key];
         } else {
             $tmpLocale = new Zend_Locale($key);
             $region = $tmpLocale->getRegion();
             $language = $tmpLocale->getLanguage();
             if (!empty($languages[$language]) && !empty($territories[$region])) {
                 $languageName = $languages[$language] . ' (' . $territories[$region] . ')';
             }
         }
         if ($languageName) {
             $localeMultiOptions[$key] = $languageName . ' [' . $key . ']';
         }
     }
     $localeMultiOptions = array_merge(array('auto' => '[Automatic]'), $localeMultiOptions);
     $this->addElement('Select', 'locale', array('label' => 'Default Locale', 'multiOptions' => $localeMultiOptions, 'value' => 'auto', 'disableTranslator' => true));
     // init submit
     $this->addElement('Button', 'submit', array('label' => 'Save Changes', 'type' => 'submit', 'ignore' => true));
 }
开发者ID:robeendey,项目名称:ce,代码行数:31,代码来源:Locale.php


注:本文中的Zend_Locale::getLanguage方法示例由纯净天空整理自Github/MSDocs等开源代码及文档管理平台,相关代码片段筛选自各路编程大神贡献的开源项目,源码版权归原作者所有,传播和使用请参考对应项目的License;未经允许,请勿转载。