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


PHP Zend_Locale::getLocaleList方法代码示例

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


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

示例1: init

 public function init()
 {
     $this->setTitle('Language Pack')->setDescription('Upload a modified language pack.  This will overwrite any language entries already in a language file.')->setAction(Zend_Controller_Front::getInstance()->getRouter()->assemble(array()));
     $languageList = Zend_Locale_Data::getList('en', 'language');
     $territoryList = Zend_Locale_Data::getList('en', 'territory');
     $languageNameList = array();
     foreach (array_keys(Zend_Locale::getLocaleList()) as $localeCode) {
         $localeArray = explode('_', $localeCode);
         $locale = array_shift($localeArray);
         $territory = array_shift($localeArray);
         if (isset($languageList[$locale]) && !empty($languageList[$locale])) {
             $languageNameList[$localeCode] = $languageList[$locale];
             if (isset($territoryList[$territory]) && !empty($territoryList[$territory])) {
                 $languageNameList[$localeCode] .= " ({$territoryList[$territory]})";
             }
             $languageNameList[$localeCode] .= "  [{$localeCode}]";
         }
     }
     asort($languageNameList);
     $this->addElement('Select', 'locale', array('label' => 'Language', 'description' => 'Which language will this language pack be applied to?', 'multiOptions' => $languageNameList));
     $this->addElement('File', 'file', array('label' => 'Language File', 'description' => 'Upload a language CSV file.', 'required' => true));
     // Init submit
     $this->addElement('Button', 'submit', array('label' => 'Upload', '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:febryantosulistyo,项目名称:ClassicSocial,代码行数:25,代码来源:Upload.php

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

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

示例4: init

 public function init()
 {
     // @todo fix form CSS/decorators
     // @todo replace fake values with real values
     $this->setTitle('General Settings')->setAction(Zend_Controller_Front::getInstance()->getRouter()->assemble(array()));
     // Init email
     $this->addElement('Text', 'email', array('label' => 'Email Address', 'required' => true, 'allowEmpty' => false, 'validators' => array(array('NotEmpty', true), array('EmailAddress', true), array('Db_NoRecordExists', true, array(Engine_Db_Table::getTablePrefix() . 'users', 'email', array('field' => 'user_id', 'value' => $this->getItem()->getIdentity()))))));
     $this->email->getValidator('NotEmpty')->setMessage('Please enter a valid email address.', 'isEmpty');
     $this->email->getValidator('Db_NoRecordExists')->setMessage('Someone has already registered this email address, please use another one.', 'recordFound');
     // Init username
     $this->addElement('Text', 'username', array('label' => 'Profile Address', 'required' => true, 'allowEmpty' => false, 'validators' => array(array('NotEmpty', true), array('Alnum', true), array('StringLength', true, array(4, 64)), array('Regex', true, array('/^[a-z0-9]/i')), array('Db_NoRecordExists', true, array(Engine_Db_Table::getTablePrefix() . 'users', 'username', array('field' => 'user_id', 'value' => $this->getItem()->getIdentity()))))));
     $this->username->getValidator('NotEmpty')->setMessage('Please enter a valid profile address.', 'isEmpty');
     $this->username->getValidator('Db_NoRecordExists')->setMessage('Someone has already picked this profile address, please use another one.', 'recordFound');
     $this->username->getValidator('Regex')->setMessage('Profile addresses must start with a letter.', 'regexNotMatch');
     $this->username->getValidator('Alnum')->setMessage('Profile addresses must be alphanumeric.', 'notAlnum');
     // Init type
     $this->addElement('Select', 'accountType', array('label' => 'Account Type'));
     // Init Facebook
     $facebook_enable = Engine_Api::_()->getApi('settings', 'core')->getSetting('core_facebook_enable', 'none');
     if ('none' != $facebook_enable) {
         $and_publish = 'publish' == $facebook_enable ? ' and publish content to your Facebook wall.' : '.';
         $this->addElement('Dummy', 'facebook', array('label' => 'Facebook Integration', 'description' => 'Linking your Facebook account will let you login with Facebook' . $and_publish, 'content' => User_Model_DbTable_Facebook::loginButton('Integrate with my Facebook')));
         $this->addElement('Checkbox', 'facebook_id', array('label' => 'Integrate with my Facebook', 'description' => 'Facebook Integration'));
     }
     // Init timezone
     $this->addElement('Select', 'timezone', array('label' => 'Timezone', 'description' => 'Select the city closest to you that shares your same 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
     $locale = Zend_Registry::get('Locale');
     $localeMultiKeys = array_merge(array_keys(Zend_Locale::getLocaleList()));
     $localeMultiOptions = array();
     $languages = Zend_Locale::getTranslationList('language', $locale);
     $territories = Zend_Locale::getTranslationList('territory', $locale);
     foreach ($localeMultiKeys as $key) {
         if (!empty($languages[$key])) {
             $localeMultiOptions[$key] = $languages[$key];
         } else {
             $locale = new Zend_Locale($key);
             $region = $locale->getRegion();
             $language = $locale->getLanguage();
             if (!empty($languages[$language]) && !empty($territories[$region])) {
                 $localeMultiOptions[$key] = $languages[$language] . ' (' . $territories[$region] . ')';
             }
         }
     }
     $localeMultiOptions = array_merge(array('auto' => '[Automatic]'), $localeMultiOptions);
     $this->addElement('Select', 'locale', array('label' => 'Locale', 'description' => 'Dates, times, and other settings will be displayed using this locale setting.', 'multiOptions' => $localeMultiOptions));
     // Init submit
     $this->addElement('Button', 'submit', array('label' => 'Save Changes', 'type' => 'submit', 'ignore' => true));
     // Create display group for buttons
     #$this->addDisplayGroup($emailAlerts, 'checkboxes');
     // Set default action
     $this->setAction(Zend_Controller_Front::getInstance()->getRouter()->assemble(array('module' => 'user', 'controller' => 'settings', 'action' => 'general'), 'default'));
 }
开发者ID:robeendey,项目名称:ce,代码行数:53,代码来源:General.php

示例5: getSupportedLocales

 /**
  * @return array|mixed
  * @throws \Zend_Locale_Exception
  */
 public static function getSupportedLocales()
 {
     // List of locales that are no longer part of CLDR
     // this was also changed in the Zend Framework, but here we need to provide an appropriate alternative
     // since this information isn't public in \Zend_Locale :-(
     $aliases = ['az_AZ' => true, 'bs_BA' => true, 'ha_GH' => true, 'ha_NE' => true, 'ha_NG' => true, 'kk_KZ' => true, 'ks_IN' => true, 'mn_MN' => true, 'ms_BN' => true, 'ms_MY' => true, 'ms_SG' => true, 'pa_IN' => true, 'pa_PK' => true, 'shi_MA' => true, 'sr_BA' => true, 'sr_ME' => true, 'sr_RS' => true, 'sr_XK' => true, 'tg_TJ' => true, 'tzm_MA' => true, 'uz_AF' => true, 'uz_UZ' => true, 'vai_LR' => true, 'zh_CN' => true, 'zh_HK' => true, 'zh_MO' => true, 'zh_SG' => true, 'zh_TW' => true];
     $locale = \Zend_Locale::findLocale();
     $cacheKey = "system_supported_locales_" . strtolower((string) $locale);
     if (!($languageOptions = Cache::load($cacheKey))) {
         // we use the locale here, because \Zend_Translate only supports locales not "languages"
         $languages = \Zend_Locale::getLocaleList();
         $languages = array_merge($languages, $aliases);
         $languageOptions = array();
         foreach ($languages as $code => $active) {
             if ($active) {
                 $translation = \Zend_Locale::getTranslation($code, "language");
                 if (!$translation) {
                     $tmpLocale = new \Zend_Locale($code);
                     $lt = \Zend_Locale::getTranslation($tmpLocale->getLanguage(), "language");
                     $tt = \Zend_Locale::getTranslation($tmpLocale->getRegion(), "territory");
                     if ($lt && $tt) {
                         $translation = $lt . " (" . $tt . ")";
                     }
                 }
                 if (!$translation) {
                     $translation = $code;
                 }
                 $languageOptions[$code] = $translation;
             }
         }
         asort($languageOptions);
         Cache::save($languageOptions, $cacheKey, ["system"]);
     }
     return $languageOptions;
 }
开发者ID:krugerke,项目名称:pimcore,代码行数:39,代码来源:Tool.php

示例6: addSampleMessage

 /**
  * Add a sample message to a particular event for a particular Locale.
  *
  * Eg: addSampleMessage(1, 'en_US', 'Hey $NAME$ - Your Order has shipped!'
  *
  * @param $eventIdOrName $eventId
  * @param string $localeCode
  * @param string $message
  */
 public function addSampleMessage($eventIdOrName, $localeCode, $message)
 {
     if (!is_int($eventIdOrName) && !is_string($eventIdOrName)) {
         throw new InvalidArgumentException(sprintf('Invalid Event ID. Expected: string or int, got: "%s"', is_object($eventIdOrName) ? get_class($eventIdOrName) : gettype($eventIdOrName)));
     }
     if (!is_string($localeCode)) {
         throw new InvalidArgumentException(sprintf('Invalid Locale. Expected: "%s", got: "%s"', is_object($localeCode) ? get_class($localeCode) : gettype($localeCode)));
     }
     $locales = Zend_Locale::getLocaleList();
     if (!isset($locales[$localeCode])) {
         throw new InvalidArgumentException(sprintf('Invalid Locale. "%s" is not a valid Locale', $localeCode));
     }
     if (!is_string($message)) {
         throw new InvalidArgumentException(sprintf('Invalid Message Template. Expected: "%s", got: "%s"', is_object($message) ? get_class($message) : gettype($message)));
     }
     $eventId = $eventIdOrName;
     if (!is_int($eventIdOrName)) {
         $event = $this->loadEvent($eventIdOrName);
         if (!is_array($event)) {
             throw new \InvalidArgumentException(sprintf('Cannot find event with name: "%s"', $eventIdOrName));
         }
         $eventId = $event['entity_id'];
     }
     $this->getConnection()->insert($this->getTable('esendex_sms/event_sample_message_template'), array('event_id' => $eventId, 'locale_code' => $localeCode, 'message_template' => $message));
     //Flush Event Collection from Cache
     Mage::app()->getCacheInstance()->clean(array(Esendex_Sms_Model_Event::CACHE_TAG));
 }
开发者ID:WeareJH,项目名称:esendex-magento-extension,代码行数:36,代码来源:Setup.php

示例7: getLanguages

 /**
  * {@inheritdoc}
  */
 public function getLanguages()
 {
     return array_keys(\Zend_Locale::getLocaleList());
 }
开发者ID:fkomaralp,项目名称:country-list,代码行数:7,代码来源:Cldr.php

示例8: getLanguagesByLocale

 /**
  * Get languages by locale
  *
  * @param String $locale
  * @return Array
  */
 public function getLanguagesByLocale($locale)
 {
     $tmp_locales = Zend_Locale::getLocaleList();
     if (!isset($tmp_locales[$locale])) {
         return array();
     }
     return Zend_Locale::getTranslationList('language', $locale);
 }
开发者ID:sabril-2t,项目名称:Open-Ad-Server,代码行数:14,代码来源:locales.php

示例9: allLocales

 /**
  * List of all locales.
  *
  * @param string $locale
  * @access public
  * @return array
  * @static
  *
  * @author Etienne de Longeaux <etienne.delongeaux@gmail.com>
  */
 public static function allLocales($locale)
 {
     $localelist = \Zend_Locale::getLocaleList();
     $name_key = array_map(function ($key, $locale) {
         return locale_get_display_name(strtolower($key), strtolower($locale)) . " - ({$key})";
     }, array_keys($localelist), array_fill(0, count($localelist) - 1, $locale));
     return array_combine(array_keys($localelist), $name_key);
 }
开发者ID:pigroupe,项目名称:SfynxToolBundle,代码行数:18,代码来源:PiStringManager.php

示例10: load_icons

 public function load_icons()
 {
     if (!$this->post('msLanguage')) {
         return false;
     }
     $ch = Loader::helper('interface/flag', 'multilingual');
     Loader::library('3rdparty/Zend/Locale');
     // here's what we do. We load all locales, then we filter through all those that match the posted language code
     // and we return html for all regions in that language
     $locales = Zend_Locale::getLocaleList();
     $countries = array();
     $html = '';
     foreach ($locales as $locale => $none) {
         $zl = new Zend_Locale($locale);
         if ($zl->getLanguage() == $this->post('msLanguage') || $zl->toString() == $this->post('msLanguage')) {
             if ($zl->getRegion()) {
                 $countries[$zl->getRegion()] = Zend_Locale::getTranslation($zl->getRegion(), 'country', ACTIVE_LOCALE);
             }
         }
     }
     asort($countries);
     $i = 1;
     foreach ($countries as $region => $value) {
         $flag = $ch->getFlagIcon($region);
         if ($flag) {
             $checked = "";
             if ($this->post('selectedLanguageIcon') == $region) {
                 $checked = "checked=\"checked\"";
             } else {
                 if ($i == 1 && !$this->post('selectedLanguageIcon')) {
                     $checked = "checked=\"checked\"";
                 }
             }
             $html .= '<li><label><input type="radio" name="msIcon" ' . $checked . ' id="languageIcon' . $i . '" value="' . $region . '" onchange="ccm_multilingualUpdateLocale(\'' . $region . '\')" /><span class="image-wrapper">' . $flag . '' . $value . '</span></label></li>';
             $i++;
         }
     }
     if ($i == 1) {
         $html = "<li><label><span><strong>" . t('None') . "</strong></span></label></li>";
     }
     print $html;
     exit;
 }
开发者ID:Zyqsempai,项目名称:amanet,代码行数:43,代码来源:setup.php

示例11: getLanguageDescription

 /**
  * Get the description of a locale consisting of language and region description
  * e.g. "French (France)"
  * @param string $locale Locale that should be described
  * @param string $displayLocale Language of the description
  * @return string Description of a language
  */
 public static function getLanguageDescription($locale, $displayLocale = null)
 {
     $localeList = Zend_Locale::getLocaleList();
     if (!isset($localeList[$locale])) {
         return $locale;
     }
     if ($displayLocale !== NULL && !isset($localeList[$displayLocale])) {
         $displayLocale = NULL;
     }
     $cacheLibrary = Cache::getLibrary();
     if (is_object($cacheLibrary)) {
         Zend_Locale_Data::setCache($cacheLibrary);
     }
     $displayLocale = $displayLocale ? $displayLocale : $locale;
     $zendLocale = new Zend_Locale($locale);
     $languageName = Zend_Locale::getTranslation($zendLocale->getLanguage(), 'language', $displayLocale);
     $description = $languageName;
     $region = $zendLocale->getRegion();
     if ($region !== false) {
         $regionName = Zend_Locale::getTranslation($region, 'country', $displayLocale);
         if ($regionName !== false) {
             $localeData = Zend_Locale_Data::getList($displayLocale, 'layout');
             if ($localeData['characters'] == "right-to-left") {
                 $description = '(' . $languageName . ' (' . $regionName;
             } else {
                 $description = $languageName . ' (' . $regionName . ")";
             }
         }
     }
     return $description;
 }
开发者ID:Zyqsempai,项目名称:amanet,代码行数:38,代码来源:localization.php

示例12: showLanguages

 /**
  * Show edit language.
  */
 public function showLanguages()
 {
     $this->addMainMenu();
     $langcodes = array();
     foreach (Zend_Locale::getLocaleList() as $langcode => $ignore) {
         list($l, $t) = explode('_', $langcode);
         $language = Zend_Locale::getTranslation($l, 'language', 'en_US');
         if (!$language) {
             $language = $langcode;
         }
         $territory = $t ? Zend_Locale::getTranslation($t, 'territory', 'en_US') : '';
         $langcodes[$langcode] = $language . ($territory ? " ({$territory})" : ' (Generic)');
     }
     $existing = LanguageQuery::create()->find()->toKeyValue('Langcode', 'Name');
     foreach ($existing as $langcode => $name) {
         if (!array_key_exists($langcode, $langcodes)) {
             $langcodes[$langcode] = $name . ' (Custom)';
         }
     }
     asort($langcodes);
     $form = new Curry_ModelView_Form('Language', array('ignorePks' => false, 'columnElements' => array('langcode' => array('select', array('multiOptions' => $langcodes, 'disable' => array_keys($existing), 'onchange' => "\$('[name=\"name\"]', this.form).val(this.options[this.selectedIndex].text);"))), 'onFillForm' => function ($item, $form) {
         if ($item->isNew()) {
             $form->addElement('select', 'copy', array('label' => 'Copy translations from', 'multiOptions' => array('' => '[ None ]') + LanguageQuery::create()->find()->toKeyValue('PrimaryKey', 'Name'), 'order' => 2));
         } else {
             // Prevent changing langcode (propel cant change primary keys anyway)
             $form->removeElement('langcode');
         }
     }, 'onFillModel' => function (Language $item, $form, $values) {
         $user = User::getUser();
         if ($item->isNew()) {
             $item->addUser($user);
             if (isset($values['copy']) && $values['copy']) {
                 $translations = LanguageStringTranslationQuery::create()->findByLangcode($values['copy']);
                 foreach ($translations as $translation) {
                     $item->addLanguageStringTranslation($translation->copy());
                 }
             }
         }
     }));
     $list = new Curry_ModelView_List('Language', array('modelForm' => $form, 'maxPerPage' => 0));
     $this->addMainContent($list);
 }
开发者ID:bombayworks,项目名称:currycms,代码行数:45,代码来源:Translations.php

示例13: checkLogin

<?php

//stop the direct browsing to this file - let index.php handle which files get displayed
checkLogin();
//if valid then do save
if ($_POST['p_description'] != "") {
    include "./modules/preferences/save.php";
}
$smarty->assign('save', $save);
$defaults = getSystemDefaults();
$preferences = getActivePreferences();
$localelist = Zend_Locale::getLocaleList();
$smarty->assign('preferences', $preferences);
$smarty->assign('defaults', $defaults);
$smarty->assign('localelist', $localelist);
$smarty->assign('pageActive', 'preference');
$smarty->assign('subPageActive', 'preferences_add');
$smarty->assign('active_tab', '#setting');
开发者ID:dadigo,项目名称:simpleinvoices,代码行数:18,代码来源:add.php

示例14: init

 public function init()
 {
     $this->setTitle('Translate Language')->setDescription('Translate a language pack using Google Translate.')->setAction(Zend_Controller_Front::getInstance()->getRouter()->assemble(array()));
     // Build language list
     $translate = Zend_Registry::get('Zend_Translate');
     //$translate        = new Zend_Translate_Adapter();
     $languageList = Zend_Locale_Data::getList('en', 'language');
     $territoryList = Zend_Locale_Data::getList('en', 'territory');
     //var_dump(array_intersect(Engine_Service_GTranslate::getAvailableLanguages(), array_keys($languageList)));
     //var_dump(array_diff(Engine_Service_GTranslate::getAvailableLanguages(), array_keys($languageList)));
     //var_dump(array_diff(array_keys($languageList), Engine_Service_GTranslate::getAvailableLanguages()));
     //die();
     $languageNameList = array();
     foreach (array_keys(Zend_Locale::getLocaleList()) as $localeCode) {
         $lang_array = explode('_', $localeCode);
         $locale = array_shift($lang_array);
         $territory = array_shift($lang_array);
         // Full locale
         $languageName = null;
         if (isset($languageList[$localeCode])) {
             $languageName = $languageList[$locale] . ' [' . $localeCode . ']';
         } else {
             if (isset($languageList[$locale])) {
                 $languageName = $languageList[$locale];
                 if (!empty($territoryList[$territory])) {
                     $languageName .= ' (' . $territoryList[$territory] . ')';
                 }
                 $languageName .= ' [' . $localeCode . ']';
             } else {
                 //$languageName = '[' . $localeCode . ']';
             }
         }
         // Check against gtranslate
         if (!Engine_Service_GTranslate::isAvailableLanguage($localeCode)) {
             continue;
             //} else if( !Engine_Service_GTranslate::testAvailableLanguage($localeCode) ) {
             //  echo 'Bad: ' . $localeCode . '<br />' . PHP_EOL;
             //  continue;
             //} else {
             //  echo 'Good: ' . $localeCode . '<br />' . PHP_EOL;
         }
         if ($languageName) {
             $languageNameList[$localeCode] = $languageName;
         }
     }
     asort($languageNameList);
     // Let's pull the existing languages to the top?
     $existingLanguageNameList = array();
     $notExistingLanguageNameList = array();
     foreach ($translate->getList() as $locale) {
         if (isset($languageNameList[$locale])) {
             $existingLanguageNameList[$locale] = $languageNameList[$locale];
         }
     }
     $notExistingLanguageNameList = array_diff_key($languageNameList, $existingLanguageNameList);
     //$languageNameList = array_merge($existingLanguageNameList, $languageNameList);
     $targetMultiOptions = array_merge($existingLanguageNameList, $notExistingLanguageNameList);
     $targetMultiOptions = array('Translated' => $existingLanguageNameList, 'Untranslated' => $notExistingLanguageNameList, 'Special' => array('all' => 'All Available', 'all-translated' => 'All Translated', 'all-untranslated' => 'All Untranslated'));
     // Element: source
     $this->addElement('Select', 'source', array('label' => 'Source language', 'value' => 'en', 'required' => true, 'allowEmpty' => false));
     foreach ($translate->getList() as $locale) {
         if (!Engine_Service_GTranslate::isAvailableLanguage($locale)) {
             continue;
         }
         $this->source->addMultiOption($locale, @$languageNameList[$locale] ? $languageNameList[$locale] : $locale);
     }
     // Element: target
     $this->addElement('Select', 'target', array('label' => 'Target Language', 'multiOptions' => array_merge(array('' => ''), $targetMultiOptions), 'required' => true, 'allowEmpty' => false));
     // Element: batchCount
     $this->addElement('Text', 'batchCount', array('label' => 'Batch Count', 'allowEmpty' => false, 'validators' => array('Int'), 'value' => 50));
     // Element: overwrite
     $this->addElement('Radio', 'overwrite', array('label' => 'Retranslate', 'description' => 'Do you want to retranslate existing phrases?', 'multiOptions' => array('1' => 'Yes', '0' => 'No'), 'value' => '0'));
     // Element: test
     $this->addElement('Text', 'test', array('label' => 'Test Translation', 'description' => 'Test Translation'));
     // Element: submit
     $this->addElement('Button', 'submit', array('label' => 'Translate', 'type' => 'submit', 'decorators' => array('ViewHelper')));
     // Element: cancel
     $this->addElement('Cancel', 'cancel', array('prependText' => ' or ', 'link' => true, 'label' => 'cancel', 'onclick' => 'history.go(-1); return false;', 'decorators' => array('ViewHelper')));
     // DisplayGroup: buttons
     $this->addDisplayGroup(array('submit', 'cancel'), 'buttons');
 }
开发者ID:febryantosulistyo,项目名称:ClassicSocial,代码行数:81,代码来源:Translate.php

示例15: getInstallLocaleList

 /**
  * @static
  * @return array
  */
 public static function getInstallLocaleList()
 {
     $options = array();
     $locales = Zend_Locale::getLocaleList();
     $languages = Zend_Locale::getTranslationList('language', self::getLocale());
     $countries = Zend_Locale::getTranslationList('territory', self::getLocale(), 2);
     foreach ($locales as $code => $is_active) {
         if (strstr($code, '_')) {
             $data = explode('_', $code);
             if (!isset($languages[$data[0]]) || !isset($countries[$data[1]])) {
                 continue;
             }
             $options[$code] = ucfirst($languages[$data[0]]) . ' (' . $countries[$data[1]] . ')';
         }
     }
     return $options;
 }
开发者ID:rguedes,项目名称:axiscommerce,代码行数:21,代码来源:Locale.php


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