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


PHP Locale::load方法代码示例

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


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

示例1: initLocale

 /**
  * The function sets current localization.
  * 
  * @static
  * @access private
  */
 private static function initLocale()
 {
     $locales = explode(',', Config::get('l10n', 'en_US'));
     $current = isset($locales[0]) ? $locales[0] : 'en_US';
     $arr = explode(',', Request::get('HTTP_ACCEPT_LANGUAGE', '', 'SERVER'));
     foreach ($arr as $locale) {
         if (strlen($locale) == 5) {
             $locale = strtolower(substr($locale, 0, 2)) . '_' . strtoupper(substr($locale, 3, 2));
             if (in_array($locale, $locales)) {
                 $current = $locale;
                 break;
             }
         }
         if (strlen($locale) == 2) {
             foreach ($locales as $item) {
                 if (strtolower($locale) == substr($item, 0, 2)) {
                     $current = $item;
                     break;
                 }
             }
         }
     }
     Locale::set($current);
     Locale::$TEST_MODE = !Config::get('l10n@smooth', false);
     ISO_Table::setLocale(Locale::get());
     Locale::load('Common');
 }
开发者ID:vosaan,项目名称:ankor.local,代码行数:33,代码来源:application.php

示例2: __construct

 /**
  * class constructor
  *
  * @access public
  * @param  string   $orientation page orientation, same as TCPDF
  * @param  mixed    $format      The format used for pages, same as TCPDF
  * @param  string   $langue      Lang : fr, en, it...
  * @param  boolean  $unicode     TRUE means that the input text is unicode (default = true)
  * @param  String   $encoding    charset encoding; default is UTF-8
  * @param  array    $marges      Default margins (left, top, right, bottom)
  * @return Html2Pdf $this
  */
 public function __construct($orientation = 'P', $format = 'A4', $langue = 'fr', $unicode = true, $encoding = 'UTF-8', $marges = array(5, 5, 5, 8))
 {
     // init the page number
     $this->_page = 0;
     $this->_firstPage = true;
     // save the parameters
     $this->_orientation = $orientation;
     $this->_format = $format;
     $this->_langue = strtolower($langue);
     $this->_unicode = $unicode;
     $this->_encoding = $encoding;
     // load the Locale
     Locale::load($this->_langue);
     // create the  myPdf object
     $this->pdf = new MyPdf($orientation, 'mm', $format, $unicode, $encoding);
     // init the CSS parsing object
     $this->parsingCss = new Parsing\Css($this->pdf);
     $this->parsingCss->fontSet();
     $this->_defList = array();
     // init some tests
     $this->setTestTdInOnePage(true);
     $this->setTestIsImage(true);
     $this->setTestIsDeprecated(true);
     // init the default font
     $this->setDefaultFont(null);
     // init the HTML parsing object
     $this->parsingHtml = new Parsing\Html($this->_encoding);
     $this->_subHtml = null;
     $this->_subPart = false;
     // init the marges of the page
     if (!is_array($marges)) {
         $marges = array($marges, $marges, $marges, $marges);
     }
     $this->_setDefaultMargins($marges[0], $marges[1], $marges[2], $marges[3]);
     $this->_setMargins();
     $this->_marges = array();
     // init the form's fields
     $this->_lstField = array();
     $this->_loadTagDefinitions();
     $this->_loadTagObjects();
     return $this;
 }
开发者ID:bendspoons,项目名称:html2pdf,代码行数:54,代码来源:Html2Pdf.php


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