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


PHP Zend_Locale::getTranslation方法代码示例

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


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

示例1: convertCountryCodeToName

 /**
  * Convert country code to name
  *
  * @param string $code
  * @return string
  */
 public static function convertCountryCodeToName($code)
 {
     if (!$code) {
         return;
     }
     return Zend_Locale::getTranslation($code, 'territory', i18n::get_locale());
 }
开发者ID:lekoala,项目名称:silverstripe-geotools,代码行数:13,代码来源:GeoExtension.php

示例2: McDoSubscribeForm

 /**
  * Process the form
  * 
  * @param type $data
  * @param type $form
  * @return type
  */
 public function McDoSubscribeForm($data, Form $form)
 {
     $country = Zend_Locale::getTranslation($data['Country'], "country", 'en_US');
     $topicsArr = Config::inst()->get('MailChimpController', 'topicsArr');
     $interest = array();
     $interestTxt = '';
     $i = 0;
     foreach ($data['Topics'] as $id) {
         array_push($interest, $topicsArr[$id]);
         $interestTxt .= $topicsArr[$id];
         if (++$i < count($data['Topics'])) {
             $interestTxt .= ',';
         }
     }
     $email = $data['Email'];
     $merge_vars = array('FNAME' => '', 'LNAME' => '', 'OTHERINT' => $data['Other'], 'COUNTRY' => $country, 'GROUPINGS' => array(array('name' => 'Areas of Interest', 'groups' => $interestTxt)));
     $regOk = self::McSubscribe($email, $merge_vars);
     if ($regOk) {
         // Pulisco la sessione
         Session::clear('MAILCHIMP_ERRCODE');
         Session::clear('MAILCHIMP_ERRMSG');
         if (Config::inst()->get('MailChimpController', 'redirect')) {
             // Redireziono alla pagina di avvenuta registrazione
             return $this->redirect(Config::inst()->get('MailChimpController', 'redirect_ok'));
         } else {
             // Se non è definita una pagina di redirezione, rimando indietro
             return $this->redirectBack();
         }
     } else {
         // Pagina di errore
         return $this->redirect(Config::inst()->get('MailChimpController', 'redirect_ko'));
     }
 }
开发者ID:helpfulrobot,项目名称:zirak-silverstripe-mailchimp,代码行数:40,代码来源:MailChimpController.php

示例3: getDefaultLangName

 public function getDefaultLangName($lang = null)
 {
     if ($lang == null) {
         $do = BizSystem::getObject("myaccount.do.PreferenceDO", 1);
         $rec = $do->fetchOne("[user_id]='0' AND [name]='language'");
         if ($rec) {
             $lang = $rec['value'];
         } else {
             $lang = DEFAULT_LANGUAGE;
         }
     }
     $current_locale = I18n::getCurrentLangCode();
     require_once 'Zend/Locale.php';
     $locale = new Zend_Locale($current_locale);
     $display_name = Zend_Locale::getTranslation($lang, 'language', $locale);
     if ($display_name) {
         return $display_name;
     } else {
         if ($lang) {
             return $lang;
         } else {
             return DEFAULT_LANGUAGE;
         }
     }
 }
开发者ID:Why-Not-Sky,项目名称:cubi-ng,代码行数:25,代码来源:localeService.php

示例4: indexAction

 public function indexAction()
 {
     $this->view->navigation = $navigation = Engine_Api::_()->getApi('menus', 'core')->getNavigation('core_footer');
     // Languages
     $translate = Zend_Registry::get('Zend_Translate');
     $languageList = $translate->getList();
     //$currentLocale = Zend_Registry::get('Locale')->__toString();
     // Prepare default langauge
     $defaultLanguage = Engine_Api::_()->getApi('settings', 'core')->getSetting('core.locale.locale', 'en');
     if (!in_array($defaultLanguage, $languageList)) {
         if ($defaultLanguage == 'auto' && isset($languageList['en'])) {
             $defaultLanguage = 'en';
         } else {
             $defaultLanguage = null;
         }
     }
     // Prepare language name list
     $languageNameList = array();
     $languageDataList = Zend_Locale_Data::getList(null, 'language');
     $territoryDataList = Zend_Locale_Data::getList(null, 'territory');
     foreach ($languageList as $localeCode) {
         $languageNameList[$localeCode] = Zend_Locale::getTranslation($localeCode, 'language', $localeCode);
         if (empty($languageNameList[$localeCode])) {
             list($locale, $territory) = explode('_', $localeCode);
             $languageNameList[$localeCode] = "{$territoryDataList[$territory]} {$languageDataList[$locale]}";
         }
     }
     $languageNameList = array_merge(array($defaultLanguage => $defaultLanguage), $languageNameList);
     $this->view->languageNameList = $languageNameList;
 }
开发者ID:robeendey,项目名称:ce,代码行数:30,代码来源:Controller.php

示例5: storeLanguage

 private function storeLanguage()
 {
     if ($this->mySessionSite->Locale) {
         \Zend_Registry::set("Zend_Locale", $this->mySessionSite->Locale);
     }
     if ($this->_getParam("lg")) {
         $locale = new \Zend_Locale($this->_getParam("lg"));
         \Zend_Registry::set("Zend_Locale", $locale);
     }
     if (\Zend_Registry::isRegistered("Zend_Locale") and $this->mySessionSite->Locale) {
         //init forcée à french à reprendre
         $locale = \Zend_Registry::get("Zend_Locale");
     } else {
         $locale = new \Zend_Locale("fr_FR");
         \Zend_Registry::set("Zend_Locale", $locale);
     }
     $this->mySessionSite->Locale = $locale;
     $this->view->language = $this->language = $locale->getLanguage();
     $languages = \Pimcore\Tool::getValidLanguages();
     $languageOptions = array();
     foreach ($languages as $short) {
         if (!empty($short)) {
             $languageOptions[] = array("language" => $short, "display" => \Zend_Locale::getTranslation($short == "fr_FR" ? "fr" : $short, 'Language', $locale));
             $validLanguages[] = $short;
         }
     }
     $this->view->languageOptions = $languageOptions;
     $this->view->isAjax = $this->isAjax();
 }
开发者ID:sgabison,项目名称:website,代码行数:29,代码来源:Action.php

示例6: importAction

 public function importAction()
 {
     $this->checkPermission("translations");
     $admin = $this->getParam("admin");
     $merge = $this->getParam("merge");
     $tmpFile = $_FILES["Filedata"]["tmp_name"];
     $overwrite = $merge ? false : true;
     if ($admin) {
         $delta = Translation\Admin::importTranslationsFromFile($tmpFile, $overwrite, Tool\Admin::getLanguages());
     } else {
         $delta = Translation\Website::importTranslationsFromFile($tmpFile, $overwrite);
     }
     $result = array("success" => true);
     if ($merge) {
         $enrichedDelta = array();
         foreach ($delta as $item) {
             $lg = $item["lg"];
             $item["lgname"] = \Zend_Locale::getTranslation($lg, "language");
             $item["icon"] = "/admin/misc/get-language-flag?language=" . $lg;
             $item["current"] = $item["text"];
             $enrichedDelta[] = $item;
         }
         $result["delta"] = base64_encode(json_encode($enrichedDelta));
     }
     $this->_helper->json($result, false);
     // set content-type to text/html, otherwise (when application/json is sent) chrome will complain in
     // Ext.form.Action.Submit and mark the submission as failed
     $this->getResponse()->setHeader("Content-Type", "text/html");
 }
开发者ID:quorak,项目名称:pimcore,代码行数:29,代码来源:TranslationController.php

示例7: 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

示例8: indexAction

 public function indexAction()
 {
     if (Engine_Api::_()->user()->getViewer()->getIdentity()) {
         return $this->_helper->redirector->gotoRoute(array('action' => 'home'), 'user_general', true);
     }
     /*
     		if (isset($_SESSION['skip_registration'])) {
     			return $this -> _helper -> redirector -> gotoRoute(array(), 'user_home', true);
     		}
     */
     // Languages
     $translate = Zend_Registry::get('Zend_Translate');
     $languageList = $translate->getList();
     // Prepare default langauge
     $defaultLanguage = Engine_Api::_()->getApi('settings', 'core')->getSetting('core.locale.locale', 'en');
     if (!in_array($defaultLanguage, $languageList)) {
         if ($defaultLanguage == 'auto' && isset($languageList['en'])) {
             $defaultLanguage = 'en';
         } else {
             $defaultLanguage = null;
         }
     }
     // Prepare language name list
     $languageNameList = array();
     $languageDataList = Zend_Locale_Data::getList(null, 'language');
     $territoryDataList = Zend_Locale_Data::getList(null, 'territory');
     foreach ($languageList as $localeCode) {
         $languageNameList[$localeCode] = Engine_String::ucfirst(Zend_Locale::getTranslation($localeCode, 'language', $localeCode));
         if (empty($languageNameList[$localeCode])) {
             if (false !== strpos($localeCode, '_')) {
                 list($locale, $territory) = explode('_', $localeCode);
             } else {
                 $locale = $localeCode;
                 $territory = null;
             }
             if (isset($territoryDataList[$territory]) && isset($languageDataList[$locale])) {
                 $languageNameList[$localeCode] = $territoryDataList[$territory] . ' ' . $languageDataList[$locale];
             } else {
                 if (isset($territoryDataList[$territory])) {
                     $languageNameList[$localeCode] = $territoryDataList[$territory];
                 } else {
                     if (isset($languageDataList[$locale])) {
                         $languageNameList[$localeCode] = $languageDataList[$locale];
                     } else {
                         continue;
                     }
                 }
             }
         }
     }
     $languageNameList = array_merge(array($defaultLanguage => $defaultLanguage), $languageNameList);
     ksort($languageNameList);
     $this->view->languageNameList = $languageNameList;
     $this->_helper->layout->disableLayout();
     // Render
     //$this -> _helper -> content
     //-> setNoRender()
     //	-> setEnabled();
 }
开发者ID:hoalangoc,项目名称:ftf,代码行数:59,代码来源:IndexController.php

示例9: getLanguageOptions

 /**
  * Returns available language options determined by translation resources.
  *
  * @return array
  * @throws Zend_Exception
  */
 public function getLanguageOptions()
 {
     $translator = Zend_Registry::get('Zend_Translate');
     $currentLocale = new Zend_Locale($translator->getLocale());
     $translations = $translator->getList();
     $options = array();
     foreach ($translations as $language) {
         $options[$language] = $currentLocale->getTranslation($language, 'language', $currentLocale->getLanguage());
     }
     return $options;
 }
开发者ID:belapp,项目名称:opus4-application,代码行数:17,代码来源:SupportedLanguages.php

示例10: getLocales

	protected function getLocales() {
		Loader::library('3rdparty/Zend/Locale');
		$languages = Localization::getAvailableInterfaceLanguages();
		if (count($languages) > 0) { 
			array_unshift($languages, 'en_US');
		}
		$locales = array();
		foreach($languages as $lang) {
			$loc = new Zend_Locale($lang);
			$locales[$lang] = Zend_Locale::getTranslation($loc->getLanguage(), 'language', $lang);
		}
		return $locales;
	}
开发者ID:nveid,项目名称:concrete5,代码行数:13,代码来源:install.php

示例11: getExportData

 public function getExportData($entityType, $collectionItem)
 {
     // Set return array
     $returnArray = array();
     // Fetch fields to export
     $order = $collectionItem->getOrder();
     if ($this->fieldLoadingRequired('pakjegemak_address')) {
         try {
             $this->_writeArray =& $returnArray['pakjegemak_address'];
             $pakjeGemakAddress = Mage::helper('postnl')->getPakjeGemakAddressForOrder($order);
             if ($pakjeGemakAddress && $pakjeGemakAddress->getId()) {
                 $pakjeGemakAddress->explodeStreetAddress();
                 foreach ($pakjeGemakAddress->getData() as $key => $value) {
                     $this->writeValue($key, $value);
                 }
                 // Region Code
                 if ($pakjeGemakAddress->getRegionId() !== NULL && $this->fieldLoadingRequired('region_code')) {
                     $this->writeValue('region_code', $pakjeGemakAddress->getRegionModel()->getCode());
                 }
                 // Country - ISO3, Full Name
                 if ($pakjeGemakAddress->getCountryId() !== NULL) {
                     if ($this->fieldLoadingRequired('country_name')) {
                         $this->writeValue('country_name', Zend_Locale::getTranslation($pakjeGemakAddress->getCountryId(), 'country', 'en_US'));
                     }
                     if ($this->fieldLoadingRequired('country_iso3')) {
                         $this->writeValue('country_iso3', $pakjeGemakAddress->getCountryModel()->getIso3Code());
                     }
                 }
             }
         } catch (Exception $e) {
         }
     }
     if ($this->fieldLoadingRequired('pakjegemak_order')) {
         try {
             $this->_writeArray =& $returnArray['pakjegemak_order'];
             $dataCollection = Mage::getModel('postnl_core/order')->getCollection();
             $dataCollection->addFieldToFilter('order_id', $order->getId());
             if ($dataCollection->count()) {
                 foreach ($dataCollection as $dataRow) {
                     foreach ($dataRow->getData() as $key => $value) {
                         $this->writeValue($key, $value);
                     }
                 }
             }
         } catch (Exception $e) {
         }
     }
     // Done
     return $returnArray;
 }
开发者ID:xiaoguizhidao,项目名称:devfashion,代码行数:50,代码来源:TIGPostNL.php

示例12: indexAction

 public function indexAction()
 {
     $this->view->navigation = $navigation = Engine_Api::_()->getApi('menus', 'core')->getNavigation('core_footer');
     // Languages
     $translate = Zend_Registry::get('Zend_Translate');
     $languageList = $translate->getList();
     //$currentLocale = Zend_Registry::get('Locale')->__toString();
     // Prepare default langauge
     $defaultLanguage = Engine_Api::_()->getApi('settings', 'core')->getSetting('core.locale.locale', 'en');
     if (!in_array($defaultLanguage, $languageList)) {
         if ($defaultLanguage == 'auto' && isset($languageList['en'])) {
             $defaultLanguage = 'en';
         } else {
             $defaultLanguage = null;
         }
     }
     // Prepare language name list
     $languageNameList = array();
     $languageDataList = Zend_Locale_Data::getList(null, 'language');
     $territoryDataList = Zend_Locale_Data::getList(null, 'territory');
     foreach ($languageList as $localeCode) {
         $languageNameList[$localeCode] = Engine_String::ucfirst(Zend_Locale::getTranslation($localeCode, 'language', $localeCode));
         if (empty($languageNameList[$localeCode])) {
             if (false !== strpos($localeCode, '_')) {
                 list($locale, $territory) = explode('_', $localeCode);
             } else {
                 $locale = $localeCode;
                 $territory = null;
             }
             if (isset($territoryDataList[$territory]) && isset($languageDataList[$locale])) {
                 $languageNameList[$localeCode] = $territoryDataList[$territory] . ' ' . $languageDataList[$locale];
             } else {
                 if (isset($territoryDataList[$territory])) {
                     $languageNameList[$localeCode] = $territoryDataList[$territory];
                 } else {
                     if (isset($languageDataList[$locale])) {
                         $languageNameList[$localeCode] = $languageDataList[$locale];
                     } else {
                         continue;
                     }
                 }
             }
         }
     }
     $languageNameList = array_merge(array($defaultLanguage => $defaultLanguage), $languageNameList);
     $this->view->languageNameList = $languageNameList;
     // Get affiliate code
     $this->view->affiliateCode = Engine_Api::_()->getDbtable('settings', 'core')->core_affiliate_code;
 }
开发者ID:febryantosulistyo,项目名称:ClassicSocial,代码行数:49,代码来源:Controller.php

示例13: getLanguages

 /**
  *
  * @return array Containing all the languages used in this project
  */
 public function getLanguages()
 {
     if (isset($this->project->locales)) {
         $locales = $this->project->locales;
     } elseif (isset($this->project->locale['default'])) {
         $locales = array($this->project->locale['default']);
     } else {
         $locales = array('en');
     }
     foreach ($locales as $locale) {
         $languages[$locale] = \Zend_Locale::getTranslation($locale, 'Language', $this->locale);
     }
     asort($languages);
     return $languages;
 }
开发者ID:harmslijper,项目名称:gemstracker-library,代码行数:19,代码来源:Localized.php

示例14: createcountriesAction

 public function createcountriesAction()
 {
     $language = $this->_getParam("language");
     $locale = new Zend_Locale($language);
     $regions = Zend_Locale::getTranslationList('RegionToTerritory');
     $countryGroup = array();
     foreach ($regions as $region => $countriesString) {
         $countries = explode(' ', $countriesString);
         foreach ($countries as $country) {
             $countryGroup[$country] = $locale->getTranslation($region, 'territory', $locale);
         }
     }
     $countries = Country::getCountries();
     foreach ($countries as $iso => $name) {
         $currencyCode = Country::getCurrencyCodeForCountry($iso);
         $currencyDetail = Country::getCurrencyDetail($currencyCode);
         if (!$currencyCode || !$currencyDetail) {
             continue;
         }
         $currencyName = $currencyDetail['name'];
         $currencySymbol = $currencyDetail['symbol'];
         $currencyIsoNumber = $currencyDetail['isocode'];
         //Check if currency Object already exists
         $currencyObject = Model\Currency::getByName($currencyName);
         if (!$currencyObject instanceof Model\Currency) {
             $currencyObject = new Model\Currency();
             $currencyObject->setSymbol($currencySymbol);
             $currencyObject->setNumericIsoCode($currencyIsoNumber);
             $currencyObject->setIsoCode($currencyCode);
             $currencyObject->setExchangeRate(1);
         }
         $currencyObject->setName($currencyName);
         $currencyObject->save();
         //Check if country Object already exists
         $countryObject = Model\Country::getByIsoCode($iso);
         if (!$countryObject instanceof Model\Country) {
             $countryObject = new Model\Country();
         }
         $countryObject->setName($name);
         $countryObject->setIsoCode($iso);
         $countryObject->setActive(false);
         $countryObject->setCurrency($currencyObject);
         $countryObject->save();
     }
     $this->_helper->json(array("success" => true));
 }
开发者ID:Cube-Solutions,项目名称:pimcore-coreshop,代码行数:46,代码来源:SettingsController.php

示例15: view

 public function view()
 {
     Loader::library('3rdparty/Zend/Locale');
     $languages = Localization::getAvailableInterfaceLanguages();
     if (count($languages) > 0) {
         array_unshift($languages, 'en_US');
     }
     $locales = array();
     foreach ($languages as $lang) {
         $loc = new Zend_Locale($lang);
         $locales[$lang] = Zend_Locale::getTranslation($loc->getLanguage(), 'language', ACTIVE_LOCALE);
     }
     $this->set('LANGUAGE_CHOOSE_ON_LOGIN', Config::get('LANGUAGE_CHOOSE_ON_LOGIN'));
     $this->set('LANGUAGE_MULTILINGUAL_CONTENT_ENABLED', Config::get('LANGUAGE_MULTILINGUAL_CONTENT_ENABLED'));
     $this->set('interfacelocales', $locales);
     $this->set('languages', $languages);
 }
开发者ID:VonUniGE,项目名称:concrete5-1,代码行数:17,代码来源:controller.php


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