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


PHP Zend_Locale_Data::getContent方法代码示例

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


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

示例1: _getFormat

 /**
  * Retrieve date format
  *
  * @return string
  */
 protected function _getFormat()
 {
     $format = $this->getColumn()->getFormat();
     if (!$format) {
         if (is_null(self::$_format)) {
             try {
                 $localeCode = $this->_localeResolver->getLocaleCode();
                 $localeData = new \Zend_Locale_Data();
                 switch ($this->getColumn()->getPeriodType()) {
                     case 'month':
                         self::$_format = $localeData->getContent($localeCode, 'dateitem', 'yM');
                         break;
                     case 'year':
                         self::$_format = $localeData->getContent($localeCode, 'dateitem', 'y');
                         break;
                     default:
                         self::$_format = $this->_localeDate->getDateFormat(\Magento\Framework\Stdlib\DateTime\TimezoneInterface::FORMAT_TYPE_MEDIUM);
                         break;
                 }
             } catch (\Exception $e) {
             }
         }
         $format = self::$_format;
     }
     return $format;
 }
开发者ID:aiesh,项目名称:magento2,代码行数:31,代码来源:Date.php

示例2: _getFormat

 /**
  * Retrieve date format
  *
  * @return string
  */
 protected function _getFormat()
 {
     $format = $this->getColumn()->getFormat();
     if (!$format) {
         if (is_null(self::$_format)) {
             try {
                 $localeCode = Mage::app()->getLocale()->getLocaleCode();
                 $localeData = new Zend_Locale_Data();
                 switch ($this->getColumn()->getPeriodType()) {
                     case 'month':
                         self::$_format = $localeData->getContent($localeCode, 'dateitem', 'yM');
                         break;
                     case 'year':
                         self::$_format = $localeData->getContent($localeCode, 'dateitem', 'y');
                         break;
                     default:
                         self::$_format = Mage::app()->getLocale()->getDateFormat(Mage_Core_Model_Locale::FORMAT_TYPE_MEDIUM);
                         break;
                 }
             } catch (Exception $e) {
             }
         }
         $format = self::$_format;
     }
     return $format;
 }
开发者ID:hientruong90,项目名称:ee_14_installer,代码行数:31,代码来源:Date.php

示例3: getDisplayValue

 /**
  *
  */
 public function getDisplayValue($pa_options = null)
 {
     if (caGetOption('returnAsDecimalWithCurrencySpecifier', $pa_options, false)) {
         return $this->ops_currency_specifier . ' ' . $this->opn_value;
     }
     if (Zend_Registry::isRegistered("Zend_Locale")) {
         $o_locale = Zend_Registry::get('Zend_Locale');
     } else {
         $o_locale = new Zend_Locale('en_US');
     }
     $vs_format = Zend_Locale_Data::getContent($o_locale, 'currencynumber');
     // this returns a string like '50,00 ¤' for locale de_DE
     $vs_decimal_with_placeholder = Zend_Locale_Format::toNumber($this->opn_value, array('locale' => $o_locale, 'number_format' => $vs_format, 'precision' => 2));
     // if the currency placeholder is the first character, for instance in en_US locale ($10), insert a space.
     // we do this because we don't print "$10" (which is expected in the Zend locale rules) but "USD 10" ... and that looks nicer with an additional space.
     // we also replace the weird multibyte nonsense Zend uses as placeholder with something more reasonable so that
     // whatever we output here isn't rejected if thrown into parseValue() again
     if (substr($vs_decimal_with_placeholder, 0, 2) == "¤") {
         // '¤' has length 2
         $vs_decimal_with_placeholder = str_replace("¤", '% ', $vs_decimal_with_placeholder);
     } elseif (substr($vs_decimal_with_placeholder, -2) == "¤") {
         // placeholder at the end
         $vs_decimal_with_placeholder = preg_replace("![^\\d\\,\\.]!", "", $vs_decimal_with_placeholder) . " %";
     }
     // insert currency which is not locale-dependent in our case
     $vs_val = str_replace('%', $this->ops_currency_specifier, $vs_decimal_with_placeholder);
     if (($vs_to_currency = caGetOption('displayCurrencyConversion', $pa_options, false)) && $this->ops_currency_specifier != $vs_to_currency) {
         $vs_val .= " (" . _t("~%1", caConvertCurrencyValue($this->ops_currency_specifier . ' ' . $this->opn_value, $vs_to_currency)) . ")";
     }
     return $vs_val;
 }
开发者ID:ffarago,项目名称:pawtucket2,代码行数:34,代码来源:CurrencyAttributeValue.php

示例4: _toHtml

 protected function _toHtml()
 {
     $localeCode = Mage::app()->getLocale()->getLocaleCode();
     // get days names
     $days = Zend_Locale_Data::getList($localeCode, 'days');
     $this->assign('days', array('wide' => Zend_Json::encode(array_values($days['format']['wide'])), 'abbreviated' => Zend_Json::encode(array_values($days['format']['abbreviated']))));
     // get months names
     $months = Zend_Locale_Data::getList($localeCode, 'months');
     $this->assign('months', array('wide' => Zend_Json::encode(array_values($months['format']['wide'])), 'abbreviated' => Zend_Json::encode(array_values($months['format']['abbreviated']))));
     // get "today" and "week" words
     $this->assign('today', Zend_Json::encode(Zend_Locale_Data::getContent($localeCode, 'relative', 0)));
     $this->assign('week', Zend_Json::encode(Zend_Locale_Data::getContent($localeCode, 'field', 'week')));
     // get "am" & "pm" words
     $this->assign('am', Zend_Json::encode(Zend_Locale_Data::getContent($localeCode, 'am')));
     $this->assign('pm', Zend_Json::encode(Zend_Locale_Data::getContent($localeCode, 'pm')));
     // get first day of week and weekend days
     $this->assign('firstDay', (int) Mage::getStoreConfig('general/locale/firstday'));
     $this->assign('weekendDays', Zend_Json::encode((string) Mage::getStoreConfig('general/locale/weekend')));
     // define default format and tooltip format
     $this->assign('defaultFormat', Zend_Json::encode(Mage::app()->getLocale()->getDateStrFormat(Mage_Core_Model_Locale::FORMAT_TYPE_MEDIUM)));
     $this->assign('toolTipFormat', Zend_Json::encode(Mage::app()->getLocale()->getDateStrFormat(Mage_Core_Model_Locale::FORMAT_TYPE_LONG)));
     // get days and months for en_US locale - calendar will parse exactly in this locale
     $days = Zend_Locale_Data::getList('en_US', 'days');
     $months = Zend_Locale_Data::getList('en_US', 'months');
     $enUS = new stdClass();
     $enUS->m = new stdClass();
     $enUS->m->wide = array_values($months['format']['wide']);
     $enUS->m->abbr = array_values($months['format']['abbreviated']);
     $this->assign('enUS', Zend_Json::encode($enUS));
     return parent::_toHtml();
 }
开发者ID:HelioFreitas,项目名称:magento-pt_br,代码行数:31,代码来源:Calendar.php

示例5: getDisplayValue

 /**
  *
  */
 public function getDisplayValue($pa_options = null)
 {
     if (caGetOption('returnAsDecimalWithCurrencySpecifier', $pa_options, false)) {
         return $this->ops_currency_specifier . ' ' . $this->opn_value;
     }
     if (Zend_Registry::isRegistered("Zend_Locale")) {
         $o_locale = Zend_Registry::get('Zend_Locale');
     } else {
         $o_locale = new Zend_Locale('en_US');
     }
     $vs_format = Zend_Locale_Data::getContent($o_locale, 'currencynumber');
     // this returns a string like '50,00 ¤' for locale de_DE
     $vs_decimal_with_placeholder = Zend_Locale_Format::toNumber($this->opn_value, array('locale' => $locale, 'number_format' => $vs_format, 'precision' => 2));
     // if the currency placeholder is the first character, for instance in en_US locale ($10), insert a space.
     // this has to be done because we don't print "$10" (which is expected in the locale rules) but "USD 10" ... and that looks nicer with an additional space.
     if (substr($vs_decimal_with_placeholder, 0, 2) == '¤') {
         // for whatever reason '¤' has length 2
         $vs_decimal_with_placeholder = str_replace('¤', '¤ ', $vs_decimal_with_placeholder);
     }
     // insert currency which is not locale-dependent in our case
     $vs_val = str_replace('¤', $this->ops_currency_specifier, $vs_decimal_with_placeholder);
     if (($vs_to_currency = caGetOption('displayCurrencyConversion', $pa_options, false)) && $this->ops_currency_specifier != $vs_to_currency) {
         $vs_val .= " (" . _t("~%1", caConvertCurrencyValue($this->ops_currency_specifier . ' ' . $this->opn_value, $vs_to_currency)) . ")";
     }
     return $vs_val;
 }
开发者ID:guaykuru,项目名称:pawtucket,代码行数:29,代码来源:CurrencyAttributeValue.php

示例6: getJsPriceFormat

 /**
  * Functions returns array with price formating info for js function
  * formatCurrency in js/varien/js.js
  *
  * @return array
  */
 public function getJsPriceFormat()
 {
     $format = Zend_Locale_Data::getContent($this->getLocaleCode(), 'currencynumber');
     $symbols = Zend_Locale_Data::getList($this->getLocaleCode(), 'symbols');
     $pos = strpos($format, ';');
     if ($pos !== false) {
         $format = substr($format, 0, $pos);
     }
     $format = preg_replace("/[^0\\#\\.,]/", "", $format);
     $totalPrecision = 0;
     $decimalPoint = strpos($format, '.');
     if ($decimalPoint !== false) {
         $totalPrecision = strlen($format) - (strrpos($format, '.') + 1);
     } else {
         $decimalPoint = strlen($format);
     }
     //hook for changing precision
     $totalPrecision = VF_Currency_Model_Directory_Currency::PRECISION;
     $requiredPrecision = $totalPrecision;
     $temp = substr($format, $decimalPoint);
     $pos = strpos($temp, '#');
     if ($pos !== false) {
         $requiredPrecision = strlen($temp) - $pos - $totalPrecision;
     }
     $group = 0;
     if (strrpos($format, ',') !== false) {
         $group = $decimalPoint - strrpos($format, ',') - 1;
     } else {
         $group = strrpos($format, '.');
     }
     $integerRequired = strpos($format, '.') - strpos($format, '0');
     $result = array('pattern' => Mage::app()->getStore()->getCurrentCurrency()->getOutputFormat(), 'precision' => $totalPrecision, 'requiredPrecision' => $requiredPrecision, 'decimalSymbol' => $symbols['decimal'], 'groupSymbol' => $symbols['group'], 'groupLength' => $group, 'integerRequired' => $integerRequired);
     return $result;
 }
开发者ID:hws47a,项目名称:VF_Currency,代码行数:40,代码来源:Locale.php

示例7: preDispatch

 public function preDispatch(Zend_Controller_Request_Abstract $request)
 {
     $view = Zend_Controller_Action_HelperBroker::getStaticHelper('ViewRenderer')->view;
     $locale = Zend_Registry::get('Zend_Locale');
     $view->locale = key($locale->getDefault());
     $view->date_format = Zend_Locale_Data::getContent($view->locale, 'date');
 }
开发者ID:ramonornela,项目名称:trilhas,代码行数:7,代码来源:Locale.php

示例8: __construct

 /**
  * Class constructor
  *
  * @param array|Zend_Config $options (Optional)
  */
 public function __construct($options = null)
 {
     if ($options instanceof Zend_Config) {
         $options = $options->toArray();
     }
     if (null === $options) {
         $locale = Zend_Registry::get('Zend_Locale')->toString();
         $dateFormat = Zend_Locale_Data::getContent($locale, 'date');
         $options = array('locale' => $locale, 'date_format' => $dateFormat);
     }
     $this->setOptions($options);
 }
开发者ID:abdala,项目名称:la,代码行数:17,代码来源:Date.php

示例9: addAction

 public function addAction()
 {
     $form = new Zetta_Form(Zend_Registry::get('config')->Cron->form->task);
     /* заполняем выпадающие списки данными */
     $minute = $form->getElement('minute');
     for ($i = -1; $i <= 59; $i++) {
         $i == -1 ? $minute->addMultiOption('*', '*') : $minute->addMultiOption($i, $i);
     }
     $hour = $form->getElement('hour');
     for ($i = -1; $i <= 23; $i++) {
         $i == -1 ? $hour->addMultiOption('*', '*') : $hour->addMultiOption($i, sprintf('%02d', $i));
     }
     $day = $form->getElement('day');
     for ($i = 0; $i <= 31; $i++) {
         $i == 0 ? $day->addMultiOption('*', '*') : $day->addMultiOption($i, sprintf('%02d', $i));
     }
     $month = $form->getElement('month');
     for ($i = 0; $i <= 12; $i++) {
         if ($i == 0) {
             $month->addMultiOption('*', '*');
         } else {
             $month_str = Zend_Locale_Data::getContent(new Zend_Locale(), 'month', array('gregorian', 'stand-alone', 'wide', intval($i)));
             $month->addMultiOption($i, $month_str);
         }
     }
     $week = $form->getElement('week_day');
     $array_weekDay = array('', 'mon', 'tue', 'wed', 'thu', 'fri', 'sat', 'sun');
     for ($i = 0; $i <= 7; $i++) {
         if ($i == 0) {
             $week->addMultiOption('*', '*');
         } else {
             $week_str = Zend_Locale_Data::getContent(new Zend_Locale(), 'day', array('gregorian', 'format', 'wide', $array_weekDay[$i]));
             $week->addMultiOption($i, $week_str);
         }
     }
     if ($cron_id = $this->getParam('cron_id')) {
         $this->view->cron_id = $cron_id;
         $editData = $this->_model->fetchRow($this->_model->select()->where('cron_id = ?', $cron_id))->toArray();
         $form->setDefaults($editData);
     }
     if (!sizeof($_POST) || !$form->isValid($_POST)) {
         $this->view->form = $form;
     } else {
         $arrayData = array('minute' => $form->getValue('minute'), 'hour' => $form->getValue('hour'), 'day' => $form->getValue('day'), 'month' => $form->getValue('month'), 'week_day' => $form->getValue('week_day'), 'task' => $form->getValue('task'), 'active' => (bool) $form->getValue('active') == true ? '1' : new Zend_Db_Expr('NULL'));
         if ($cron_id) {
             $this->_model->update($arrayData, $this->_model->getAdapter()->quoteInto('cron_id = ?', $cron_id));
         } else {
             $this->_model->insert($arrayData);
         }
         $this->renderScript('admin/addComplete.ajax.phtml');
     }
 }
开发者ID:kytvi2p,项目名称:ZettaFramework,代码行数:52,代码来源:AdminController.php

示例10: render

 public function render(Zend_View_Interface $view = null)
 {
     if ($this->_fieldMeta instanceof Fields_Model_Meta && !empty($this->_fieldMeta->config['unit'])) {
         //$currency = new Zend_Currency($this->_fieldMeta->config['unit']);
         $localeObject = Zend_Registry::get('Locale');
         $currencyCode = $this->_fieldMeta->config['unit'];
         $currencyName = Zend_Locale_Data::getContent($localeObject, 'nametocurrency', $currencyCode);
         $this->loadDefaultDecorators();
         $this->getDecorator('Label')->setOption('optionalSuffix', ' - ' . $currencyCode)->setOption('requiredSuffix', ' - ' . $currencyCode);
         if ($currencyName && !$this->getDescription()) {
             $this->setDescription($currencyName);
             $this->getDecorator('Description')->setOption('placement', 'APPEND');
         }
     }
     return parent::render($view);
 }
开发者ID:robeendey,项目名称:ce,代码行数:16,代码来源:Currency.php

示例11: getSymbolChoice

 /**
  * Returns the actual or details of available currency symbol choice,
  *
  * @param  string             $currency (Optional) Currency name
  * @param  string|Zend_Locale $locale   (Optional) Locale to display informations
  * @return string
  */
 public function getSymbolChoice($currency = null, $locale = null)
 {
     if ($currency === null and $locale === null) {
         return $this->_options['symbol_choice'];
     }
     $params = self::_checkParams($currency, $locale);
     //Get the symbol choice
     $symbolChoice = Zend_Locale_Data::getContent($params['locale'], 'currencysymbolchoice', $params['currency']);
     if (empty($symbolChoice) === true) {
         $symbolChoice = Zend_Locale_Data::getContent($params['locale'], 'currencysymbolchoice', $params['name']);
     }
     if (empty($symbolChoice) === true) {
         return null;
     }
     return $symbolChoice;
 }
开发者ID:HelioFreitas,项目名称:magento-pt_br,代码行数:23,代码来源:Currency.php

示例12: __construct

 public function __construct()
 {
     parent::__construct();
     $this->i18n_dir = dirname(dirname(__FILE__)) . "/i18n";
     $current_locale = P4A::singleton()->i18n->getLocale();
     $languages = array();
     foreach (scandir($this->i18n_dir) as $file) {
         if (substr($file, -4) == ".php") {
             $locale = substr($file, 0, -4);
             list($language_code, $region_code) = explode("_", $locale);
             $language_name = Zend_Locale_Data::getContent($current_locale, 'language', $language_code);
             $region_name = Zend_Locale_Data::getContent($current_locale, 'country', $region_code);
             $languages[] = array("locale" => $locale, "description" => "{$language_name} ({$region_name})");
         }
     }
     $this->build("P4A_Array_Source", "languages")->setPk("locale")->load($languages);
     $this->build("P4A_Field", "choose_language")->setType("radio")->setValue($current_locale)->setSource($this->languages);
     $this->choose_language->label->setWidth(120);
     $this->build("P4A_Button", "apply")->implement("onclick", $this, "apply");
     $this->frame->anchor($this->choose_language)->newRow()->anchorCenter($this->apply);
 }
开发者ID:eliudiaz,项目名称:p4a,代码行数:21,代码来源:change_language.php

示例13: parseZendCurrencyFormat

 /**
  * Parses a Zend_Currency & Zend_Locale into a NostoCurrency object.
  *
  * REQUIRES Zend Framework (version 1) to be available.
  *
  * @param string $currencyCode the 3-letter ISO 4217 currency code.
  * @param Zend_Currency $zendCurrency the zend currency object.
  * @return NostoCurrency the parsed nosto currency object.
  *
  * @throws NostoInvalidArgumentException
  */
 public function parseZendCurrencyFormat($currencyCode, Zend_Currency $zendCurrency)
 {
     try {
         $format = Zend_Locale_Data::getContent($zendCurrency->getLocale(), 'currencynumber');
         $symbols = Zend_Locale_Data::getList($zendCurrency->getLocale(), 'symbols');
         // Remove extra part, e.g. "¤ #,##0.00; (¤ #,##0.00)" => "¤ #,##0.00".
         if (($pos = strpos($format, ';')) !== false) {
             $format = substr($format, 0, $pos);
         }
         // Check if the currency symbol is before or after the amount.
         $symbolPosition = strpos(trim($format), '¤') === 0 ? NostoCurrencySymbol::SYMBOL_POS_LEFT : NostoCurrencySymbol::SYMBOL_POS_RIGHT;
         // Remove all other characters than "0", "#", "." and ",",
         $format = preg_replace('/[^0\\#\\.,]/', '', $format);
         // Calculate the decimal precision.
         $precision = 0;
         if (($decimalPos = strpos($format, '.')) !== false) {
             $precision = strlen($format) - (strrpos($format, '.') + 1);
         } else {
             $decimalPos = strlen($format);
         }
         $decimalFormat = substr($format, $decimalPos);
         if (($pos = strpos($decimalFormat, '#')) !== false) {
             $precision = strlen($decimalFormat) - $pos - $precision;
         }
         // Calculate the group length.
         if (strrpos($format, ',') !== false) {
             $groupLength = $decimalPos - strrpos($format, ',') - 1;
         } else {
             $groupLength = strrpos($format, '.');
         }
         // If the symbol is missing for the current locale, use the ISO code.
         $currencySymbol = $zendCurrency->getSymbol();
         if (is_null($currencySymbol)) {
             $currencySymbol = $currencyCode;
         }
         return new NostoCurrency(new NostoCurrencyCode($currencyCode), new NostoCurrencySymbol($currencySymbol, $symbolPosition), new NostoCurrencyFormat($symbols['group'], $groupLength, $symbols['decimal'], $precision));
     } catch (Zend_Exception $e) {
         throw new NostoInvalidArgumentException($e);
     }
 }
开发者ID:ysilvela,项目名称:php-sdk,代码行数:51,代码来源:Currency.php

示例14: getJsPriceFormat

 /**
  * Functions returns array with price formatting info for js function
  * formatCurrency in js/varien/js.js
  *
  * @return array
  */
 public function getJsPriceFormat()
 {
     $format = Zend_Locale_Data::getContent($this->getLocaleCode(), 'currencynumber');
     $symbols = Zend_Locale_Data::getList($this->getLocaleCode(), 'symbols');
     $pos = strpos($format, ';');
     if ($pos !== false) {
         $format = substr($format, 0, $pos);
     }
     $format = preg_replace("/[^0\\#\\.,]/", "", $format);
     $totalPrecision = 0;
     $decimalPoint = strpos($format, '.');
     if ($decimalPoint !== false) {
         $totalPrecision = strlen($format) - (strrpos($format, '.') + 1);
     } else {
         $decimalPoint = strlen($format);
     }
     $requiredPrecision = $totalPrecision;
     $t = substr($format, $decimalPoint);
     $pos = strpos($t, '#');
     if ($pos !== false) {
         $requiredPrecision = strlen($t) - $pos - $totalPrecision;
     }
     $group = 0;
     if (strrpos($format, ',') !== false) {
         $group = $decimalPoint - strrpos($format, ',') - 1;
     } else {
         $group = strrpos($format, '.');
     }
     $integerRequired = strpos($format, '.') - strpos($format, '0');
     //get the store id so you an correctly reference the global variable
     $store_id = Mage::app()->getStore()->getId();
     //JASE get precision from custom variable that can be set at store level
     $getPrecision = Mage::getModel('core/variable')->setStoreId($store_id)->loadByCode('decimalPrecision')->getData('store_plain_value');
     //if set use it, otherwise default to two decimals
     $totalPrecision = is_numeric($getPrecision) ? $getPrecision : $totalPrecision;
     $requiredPrecision = is_numeric($getPrecision) ? $getPrecision : $requiredPrecision;
     $result = array('pattern' => Mage::app()->getStore()->getCurrentCurrency()->getOutputFormat(), 'precision' => 0, 'requiredPrecision' => $requiredPrecision, 'decimalSymbol' => $symbols['decimal'], 'groupSymbol' => $symbols['group'], 'groupLength' => $group, 'integerRequired' => $integerRequired);
     return $result;
 }
开发者ID:bogdy2p,项目名称:apstufgnto,代码行数:45,代码来源:Locale.php

示例15: getTranslation

 /**
  * Returns a localized information string, supported are several types of informations.
  * For detailed information about the types look into the documentation
  *
  * @param  string             $value  Name to get detailed information about
  * @param  string             $path   (Optional) Type of information to return
  * @param  string|Zend_Locale $locale (Optional) Locale|Language for which this informations should be returned
  * @return string|false The wished information in the given language
  */
 public static function getTranslation($value = null, $path = null, $locale = null)
 {
     require_once 'Zend/Locale/Data.php';
     $locale = self::findLocale($locale);
     $result = Zend_Locale_Data::getContent($locale, $path, $value);
     if (empty($result) === true) {
         return false;
     }
     return $result;
 }
开发者ID:bizanto,项目名称:Hooked,代码行数:19,代码来源:Locale.php


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