• 设为首页
  • 点击收藏
  • 手机版
    手机扫一扫访问
    迪恩网络手机版
  • 关注官方公众号
    微信扫一扫关注
    迪恩网络公众号

PHP CLocale类代码示例

原作者: [db:作者] 来自: [db:来源] 收藏 邀请

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



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

示例1: __construct

	/**
	 * Constructor.
	 * @param mixed $locale locale ID (string) or CLocale instance
	 */
	public function __construct($locale)
	{
		if(is_string($locale))
			$this->_locale=CLocale::getInstance($locale);
		else
			$this->_locale=$locale;
	}
开发者ID:alsvader,项目名称:hackbanero,代码行数:11,代码来源:CNumberFormatter.php


示例2: setLocale

 /**
  * Set the locale to use for formatting values.
  * @param CLocale|string $locale an instance of CLocale or a locale ID
  */
 public function setLocale($locale)
 {
     if (is_string($locale)) {
         $locale = CLocale::getInstance($locale);
     }
     $this->sizeFormat['decimalSeparator'] = $locale->getNumberSymbol('decimal');
     $this->_locale = $locale;
 }
开发者ID:ubertheme,项目名称:module-ubdatamigration,代码行数:12,代码来源:CLocalizedFormatter.php


示例3: getLocale

 /**
  * This function is here because we aren't creating a locale file for every client.
  * Thus we provide a fallback to "en".
  */
 public function getLocale($localeID = null)
 {
     try {
         return parent::getLocale($localeID);
     } catch (Exception $e) {
         return CLocale::getInstance('en');
     }
 }
开发者ID:a303,项目名称:smart_lp2,代码行数:12,代码来源:EWebApplication.php


示例4: getPreferredAvailableLanguage

 public function getPreferredAvailableLanguage()
 {
     $preferedLanguages = $this->getPreferredLanguages();
     $languages = array_keys(Yii::app()->params['availableLanguages']);
     foreach ($preferedLanguages as $preferredLanguage) {
         foreach ($languages as $language) {
             $preferredLanguage = CLocale::getCanonicalID($preferredLanguage);
             if ($language === $preferredLanguage) {
                 return $language;
             }
         }
     }
     return false;
 }
开发者ID:skapl,项目名称:design,代码行数:14,代码来源:HHttpRequest.php


示例5: getAvailableLanguages

 /**
  * Returns a key value map of the available languages, including the source 
  * language, where the key is the locale and the value is the display name
  * @return array
  */
 public static function getAvailableLanguages()
 {
     $locales = array('en');
     $translations = new FilesystemIterator(Yii::app()->basePath . '/messages');
     foreach ($translations as $fileInfo) {
         // Skip the .gitkeep file
         if ($fileInfo->isDir()) {
             $locales[] = $fileInfo->getFilename();
         }
     }
     $languages = array();
     foreach ($locales as $language) {
         $languages[$language] = CLocale::getInstance('en')->getLanguage($language);
     }
     return $languages;
 }
开发者ID:pweisenburger,项目名称:xbmc-video-server,代码行数:21,代码来源:LanguageManager.php


示例6: getLanguages

 /**
  * Returns the supported SourceBans languages
  * 
  * @return array the supported SourceBans languages
  */
 public function getLanguages()
 {
     static $_data = array();
     if (empty($_data)) {
         $basePath = Yii::app()->getMessages()->basePath;
         $folder = @opendir($basePath);
         while (($file = @readdir($folder)) !== false) {
             if ($file[0] === '.' || !is_dir($basePath . DIRECTORY_SEPARATOR . $file)) {
                 continue;
             }
             $_data[$file] = CLocale::getInstance($file)->getLocaleDisplayName($file);
             if ($file !== Yii::app()->language) {
                 $_data[$file] .= ' (' . Yii::app()->locale->getLocaleDisplayName($file) . ')';
             }
         }
         closedir($folder);
         asort($_data);
     }
     return $_data;
 }
开发者ID:Saltly,项目名称:SourceBans,代码行数:25,代码来源:SourceBans.php


示例7: _processFrameworkData

 /**
  * @param $localeId
  *
  * @return array
  */
 private function _processFrameworkData($localeId)
 {
     $wideMonthKeys = array('January', 'February', 'March', 'April', 'May', 'June', 'July', 'August', 'September', 'October', 'November', 'December');
     $abbreviatedMonthKeys = array('Jan', 'Feb', 'Mar', 'Apr', 'May', 'Jun', 'Jul', 'Aug', 'Sep', 'Oct', 'Nov', 'Dec');
     $wideWeekdayNameKeys = array('Sunday', 'Monday', 'Tuesday', 'Wednesday', 'Thursday', 'Friday', 'Saturday');
     $abbreviatedWeekdayNameKeys = array('Sun', 'Mon', 'Tue', 'Wed', 'Thu', 'Fri', 'Sat');
     $formattedFrameworkData = array();
     $locale = \CLocale::getInstance($localeId);
     $formattedFrameworkData = array_merge($formattedFrameworkData, array_combine($wideMonthKeys, $locale->getMonthNames()));
     $formattedFrameworkData = array_merge($formattedFrameworkData, array_combine($abbreviatedMonthKeys, $locale->getMonthNames('abbreviated')));
     $formattedFrameworkData = array_merge($formattedFrameworkData, array_combine($wideWeekdayNameKeys, $locale->getWeekDayNames()));
     $formattedFrameworkData = array_merge($formattedFrameworkData, array_combine($abbreviatedWeekdayNameKeys, $locale->getWeekDayNames('abbreviated')));
     // Because sometimes Twig (ultimately PHP) will return 'pm' or 'am' and sometimes it will return 'PM' or 'AM'
     // and array indexes are case sensitive.
     $amName = $locale->getAMName();
     $pmName = $locale->getPMName();
     $formattedFrameworkData['AM'] = $amName;
     $formattedFrameworkData['am'] = $amName;
     $formattedFrameworkData['PM'] = $pmName;
     $formattedFrameworkData['pm'] = $pmName;
     return $formattedFrameworkData;
 }
开发者ID:nitwitt10,项目名称:Trove,代码行数:27,代码来源:PhpMessageSource.php


示例8: resolveMergeTagToStandardOrRelatedAttribute

 protected static function resolveMergeTagToStandardOrRelatedAttribute($attributeAccessorString, $model, $language, $timeQualifier, $errorOnFirstMissing, $params)
 {
     $attributeName = strtok($attributeAccessorString, '->');
     if (SpecialMergeTagsAdapter::isSpecialMergeTag($attributeName, $timeQualifier)) {
         return SpecialMergeTagsAdapter::resolve($attributeName, $model, $errorOnFirstMissing, $params);
     } else {
         if (!isset($model)) {
             return static::PROPERTY_NOT_FOUND;
         } elseif (!method_exists($model, 'isAttribute') || !$model->isAttribute($attributeName)) {
             if ($model instanceof Activity) {
                 $metadata = $model::getMetadata();
                 $activityItemsModelClassNamesData = $metadata['Activity']['activityItemsModelClassNames'];
                 foreach ($model->activityItems as $activityItem) {
                     if (ucfirst($attributeName) == get_class($activityItem)) {
                         $attributeAccessorString = str_replace($attributeName . '->', '', $attributeAccessorString);
                         return static::resolveMergeTagToStandardOrRelatedAttribute($attributeAccessorString, $activityItem, $language, $timeQualifier, $errorOnFirstMissing, $params);
                     }
                     if (get_class($activityItem) == 'Item' && array_search(ucfirst($attributeName), $activityItemsModelClassNamesData) !== false) {
                         try {
                             $modelDerivationPathToItem = RuntimeUtil::getModelDerivationPathToItem(ucfirst($attributeName));
                             $castedDownModel = $activityItem->castDown(array($modelDerivationPathToItem));
                             if (ucfirst($attributeName) == get_class($castedDownModel)) {
                                 $attributeAccessorString = str_replace($attributeName . '->', '', $attributeAccessorString);
                                 return static::resolveMergeTagToStandardOrRelatedAttribute($attributeAccessorString, $castedDownModel, $language, $timeQualifier, $errorOnFirstMissing, $params);
                             }
                         } catch (NotFoundException $e) {
                             //Do nothing
                         }
                     }
                     unset($activityItemsModelClassNamesData[get_class($activityItem)]);
                 }
                 foreach ($activityItemsModelClassNamesData as $relationModelClassName) {
                     if (ucfirst($attributeName) == $relationModelClassName) {
                         $model = new $relationModelClassName();
                         $attributeAccessorString = str_replace($attributeName . '->', '', $attributeAccessorString);
                         return static::resolveMergeTagToStandardOrRelatedAttribute($attributeAccessorString, $model, $language, $timeQualifier, $errorOnFirstMissing, $params);
                     }
                 }
             }
             return static::PROPERTY_NOT_FOUND;
         } elseif ($model->{$attributeName} instanceof CurrencyValue) {
             $model = $model->{$attributeName};
             if ($attributeName === $attributeAccessorString) {
                 $attributeAccessorString = null;
             } else {
                 $attributeAccessorString = str_replace($attributeName . '->', '', $attributeAccessorString);
             }
             if (empty($attributeAccessorString)) {
                 // If a user specific a relation merge tag but not a property, we assume he meant "value" property.
                 $currencyValueModel = $model;
                 $value = static::getAttributeValue($currencyValueModel, 'value', $timeQualifier);
                 return CLocale::getInstance($language)->getCurrencySymbol($currencyValueModel->currency->code) . $value;
                 // We can't use code below because it converts integer values in flat and also add slashes to '.' in float numbers
                 //return Yii::app()->numberFormatter->formatCurrency($value,
                 //    $currencyValueModel->currency->code);
             }
             return static::resolveMergeTagToStandardOrRelatedAttribute($attributeAccessorString, $model, $language, $timeQualifier, $errorOnFirstMissing, $params);
         } elseif ($model->{$attributeName} instanceof CustomField) {
             $value = static::getAttributeValue($model->{$attributeName}, 'value', $timeQualifier);
             // TODO: @Shoaibi/@Jason: Low: need to apply localizations(Date/time/currency formats, ...) here besides translation
             if ($value) {
                 $value = Zurmo::t($model::getModuleClassName(), $value, array(), null, $language);
             }
             return $value;
         } elseif ($model->isRelation($attributeName)) {
             $model = $model->{$attributeName};
             if ($attributeName === $attributeAccessorString) {
                 $attributeAccessorString = null;
             } else {
                 $attributeAccessorString = str_replace($attributeName . '->', '', $attributeAccessorString);
             }
             if (empty($attributeAccessorString)) {
                 // If a user specific a relation merge tag but not a property, we assume he meant "value" property.
                 if (empty($timeQualifier)) {
                     return strval($model);
                 } else {
                     return static::PROPERTY_NOT_FOUND;
                 }
             }
             if ($model instanceof RedBeanModels) {
                 $modelClassName = $model->getModelClassName();
                 if ($attributeAccessorString == lcfirst($modelClassName)) {
                     $values = array();
                     foreach ($model as $relatedModel) {
                         $values[] = strval($relatedModel);
                     }
                     return ArrayUtil::stringify($values);
                 }
             }
             return static::resolveMergeTagToStandardOrRelatedAttribute($attributeAccessorString, $model, $language, $timeQualifier, $errorOnFirstMissing, $params);
         } else {
             $attributeType = ModelAttributeToMixedTypeUtil::getType($model, $attributeName);
             //We don't have any accessor operator after the attributeName e.g. its the last in list
             if ($attributeName === $attributeAccessorString) {
                 $content = static::getAttributeValue($model, $attributeName, $timeQualifier);
                 if ($attributeType == 'DateTime') {
                     $content .= ' GMT';
                 }
                 return $content;
             } else {
//.........这里部分代码省略.........
开发者ID:RamaKavanan,项目名称:InitialVersion,代码行数:101,代码来源:MergeTagsToModelAttributesAdapter.php


示例9: getPreferredLanguage

 public function getPreferredLanguage()
 {
     $preferredLanguages = $this->getPreferredLanguages();
     return !empty($preferredLanguages) ? CLocale::getCanonicalID($preferredLanguages[0]) : false;
 }
开发者ID:smokeelow,项目名称:faicore,代码行数:5,代码来源:yiilite.php


示例10: getPreferredLanguage

 public function getPreferredLanguage($languages = array())
 {
     $preferredLanguages = $this->getPreferredLanguages();
     if (empty($languages)) {
         return !empty($preferredLanguages) ? CLocale::getCanonicalID($preferredLanguages[0]) : false;
     }
     foreach ($preferredLanguages as $preferredLanguage) {
         $preferredLanguage = CLocale::getCanonicalID($preferredLanguage);
         foreach ($languages as $language) {
             $language = CLocale::getCanonicalID($language);
             // en_us==en_us, en==en_us, en_us==en
             if ($language === $acceptedLanguage || strpos($acceptedLanguage, $language . '_') === 0 || strpos($language, $acceptedLanguage . '_') === 0) {
                 return $language;
             }
         }
     }
     return reset($languages);
 }
开发者ID:karikeb,项目名称:final2015,代码行数:18,代码来源:yiilite.php


示例11: array

if (!isset($this->breadcrumbs)) {
    $this->breadcrumbs = array('Grupocontactos' => array(Yii::t('app', 'index')), Yii::t('app', 'Manage'));
}
if (!isset($this->menu) || $this->menu === array()) {
    $this->menu = array(array('label' => Yii::t('app', 'List') . ' Grupocontacto', 'url' => array('index')), array('label' => Yii::t('app', 'Create') . ' Grupocontacto', 'url' => array('create')));
}
Yii::app()->clientScript->registerScript('search', "\n\t\t\t\$('.search-button').click(function(){\n\t\t\t\t\$('.search-form').toggle();\n\t\t\t\treturn false;\n\t\t\t\t});\n\t\t\t\$('.search-form form').submit(function(){\n\t\t\t\t\$.fn.yiiGridView.update('grupocontacto-grid', {\ndata: \$(this).serialize()\n});\n\t\t\t\treturn false;\n\t\t\t\t});\n\t\t\t");
?>

<h1> <?php 
echo Yii::t('app', 'Manage');
?>
 Grupocontactos</h1>

<?php 
echo "<ul>";
foreach ($model->relations() as $key => $relation) {
    echo "<li>" . substr(str_replace("Relation", "", $relation[0]), 1) . " " . CHtml::link(Yii::t("app", $relation[1]), array($this->resolveRelationController($relation) . "/admin")) . " (" . $relation[2] . ")" . " </li>";
}
echo "</ul>";
echo CHtml::link(Yii::t('app', 'Advanced Search'), '#', array('class' => 'search-button'));
?>
<div class="search-form" style="display:none">
<?php 
$this->renderPartial('_search', array('model' => $model));
?>
</div>

<?php 
$locale = CLocale::getInstance(Yii::app()->language);
$this->widget('zii.widgets.grid.CGridView', array('id' => 'grupocontacto-grid', 'dataProvider' => $model->search(), 'filter' => $model, 'columns' => array('id', array('name' => 'contactoid', 'value' => 'CHtml::value($data,\'contacto.recordTitle\')', 'filter' => CHtml::listData(Contacto::model()->findAll(), 'contactoid', 'recordTitle')), array('name' => 'grupoid', 'value' => 'CHtml::value($data,\'grupo.nombre\')', 'filter' => CHtml::listData(Grupo::model()->findAll(), 'grupoid', 'nombre')), array('class' => 'CButtonColumn'))));
开发者ID:rusli-nasir,项目名称:smsempresayii,代码行数:31,代码来源:admin.php


示例12: run

 /**
  * Execute the action.
  * @param array command line parameters specific for this command
  */
 public function run($args)
 {
     echo PHP_EOL;
     if (!isset($args[0])) {
         $this->usageError('A language pack archive file must be specified.');
     }
     // Start
     $msg_file = INSTANCE_ROOT . DIRECTORY_SEPARATOR . 'protected' . DIRECTORY_SEPARATOR . 'commands' . DIRECTORY_SEPARATOR . $args[0];
     if (!file_exists($msg_file)) {
         $this->usageError('The provided filename does not exist.');
     }
     $zip = new ZipArchive();
     if ($zip->open($msg_file) === true) {
         if ($zip->numFiles > 0) {
             $overwriteAll = false;
             $locales = CLocale::getLocaleIDs();
             for ($i = 0; $i < $zip->numFiles; $i++) {
                 $zip->renameIndex($i, substr($zip->getNameIndex($i), strpos($zip->getNameIndex($i), 'app/')));
                 $entry = $zip->getNameIndex($i);
                 if (preg_match('#(__MACOSX)#i', $entry)) {
                     continue;
                 }
                 if (preg_match('#\\.(php)$#i', $entry)) {
                     $extractPath = substr(INSTANCE_ROOT, 0, -strlen('app/')) . DIRECTORY_SEPARATOR;
                     $file = $extractPath . $entry;
                     if (is_file($file)) {
                         preg_match('#(.*)\\/messages\\/(.*)\\/(.*)#i', $entry, $matches);
                         if (is_array($matches)) {
                             $lang = $matches[2];
                         }
                         if (!in_array($lang, $locales)) {
                             echo ' Message-file `' . $entry . '` ignored. Language `' . $lang . '` is not a supported language/locale.' . PHP_EOL;
                             continue;
                         }
                         if ($overwriteAll) {
                             echo ' Message-file `' . $entry . '` overwritten.' . PHP_EOL;
                         } else {
                             echo '  Message-file `' . $entry . '` already exists but different.' . PHP_EOL;
                             $answer = $this->prompt('    ...Overwrite? [Yes|No|All|Quit] ');
                             if (!strncasecmp($answer, 'q', 1)) {
                                 return;
                             } elseif (!strncasecmp($answer, 'y', 1)) {
                                 echo ' Message-file `' . $entry . '` overwritten.' . PHP_EOL;
                             } elseif (!strncasecmp($answer, 'a', 1)) {
                                 echo ' Message-file `' . $entry . '` overwritten.' . PHP_EOL;
                                 $overwriteAll = true;
                             } else {
                                 echo ' Message-file `' . $entry . '` skipped.' . PHP_EOL;
                                 continue;
                             }
                         }
                     }
                     $res = $zip->extractTo($extractPath, array($entry));
                     if ($res) {
                         echo ' Message-file `' . $entry . '` successfully extracted.' . PHP_EOL;
                     }
                 }
             }
         } else {
             $this->usageError('The ZIP archive contains no files.');
         }
         $zip->close();
         if (!is_writable($msg_file)) {
             echo 'Unable to remove ZIP Archive file. Please verify the file permissions.';
         } else {
             unlink($msg_file);
         }
     } else {
         $this->usageError('Error opening the ZIP archive.');
     }
 }
开发者ID:maruthisivaprasad,项目名称:zurmo,代码行数:75,代码来源:InstallLanguageCommand.php


示例13: actionReport


//.........这里部分代码省略.........
             echo '<h2>Died on Sql execution</h2>' . $sqlSelect;
             throw $e;
         }
         $imageFileNames = array();
         $imageFilePaths = array();
         if (strlen($graphicFilename) > 0) {
             $images = $this->readXmlGraphicFile($graphicFilename, false, $reader, $title, $negateGraphicValues, $imageFileNames);
             $imageFileNames = $images[1];
             $imageFilePaths = $images[0];
             //must do this again because the reader can only go forwards
             $reader = $command->query();
         }
         //update last used report for printout
         $printoutview = "";
         if (isset($_POST['printoutview'])) {
             $printoutview = $_POST['printoutview'];
         }
         $option = Options::model()->find('name=\'isReportForPrintout\' AND companyId=0 AND userId=' . Yii::app()->user->id);
         $option->datavalue = $printoutview == 1 ? 'true' : 'false';
         $option->save();
         Yii::app()->user->setState('isReportForPrintout', $printoutview);
         //update last used black and white
         $option = Options::model()->find('name=\'isReportBlackAndWhite\' AND companyId=0 AND userId=' . Yii::app()->user->id);
         $option->datavalue = false;
         $option->datavalue = isset($_POST['blackandwhite']) && $_POST['blackandwhite'] == 1 ? 'true' : 'false';
         $option->save();
         Yii::app()->user->setState('isReportBlackAndWhite', isset($_POST['blackandwhite']) && $_POST['blackandwhite'] == 1 ? 1 : 0);
         if (isset($_POST['blackandwhite']) && $_POST['blackandwhite'] == 1) {
             Yii::app()->user->setState('reportCssFile', $this->_model->cssBwFileName);
         } else {
             Yii::app()->user->setState('reportCssFile', $this->_model->cssColorFileName);
         }
         //get the number and date formats
         $cLoc = CLocale::getInstance('en');
         $numberFormatter = $cLoc->getNumberFormatter();
         $dateFormatter = $cLoc->getDateFormatter();
         // echo "<pre>";
         // var_dump($dateFormatter);
         // echo "</pre>";
         // die();
         $numberFormat = User::getNumberFormat();
         $pdf_name = "";
         $cron_job = FALSE;
         // if from cron job
         if (isset($_POST['cron'])) {
             $pdf_name = "reports/lazy8report_" . date('Y-m-d_H.i.s');
             $cron_job = TRUE;
         }
         if (isset($_POST['DownloadExcel'])) {
             Yii::import('application.controllers.excel.*');
             require_once "exportExcel.php";
             new exportExcel($this->_model, $reader, $pdf_name, $numberFormatter, $dateFormatter, $numberFormat, $printoutview, $parameterValues);
             die;
         } else {
             if (isset($_POST['DownloadPDF'])) {
                 // var_dump($numberFormat);
                 // die();
                 Yii::import('application.controllers.tcpdf.*');
                 require_once "lazy8tcpdf.php";
                 new lazy8tcpdf($this->_model, $reader, $pdf_name, $cron_job, $numberFormatter, $dateFormatter, $numberFormat, $printoutview, $parameterValues, $imageFileNames, isset($_POST['blackandwhite']) && $_POST['blackandwhite'] == 1 ? 1 : 0, strpos(Yii::app()->user->getState('reportCssFile'), "wide") === false);
                 // if cron job was run then email user with the pdf attatchment
                 if (isset($_POST['cron'])) {
                     $accountID = $_POST['accountID'];
                     $sql = "SELECT Account.code AS accountcode, Account.name AS accountname, Account.email AS email, Account.balance_threshold AS threshold, Account.days AS days\n\t\t\t\t\t\t\t\tFROM Account\n\t\t\t\t\t\t\t\tWHERE Account.code = '{$accountID}'";
                     $account = Yii::app()->db->createCommand($sql)->queryAll();
                     $to = $account['email'];
开发者ID:Jride,项目名称:accounting-thaiconnections,代码行数:67,代码来源:ReportController.php


示例14: _processFrameworkData

 /**
  * @param $localeId
  *
  * @return array
  */
 private function _processFrameworkData($localeId)
 {
     $wideMonthKeys = array('January', 'February', 'March', 'April', 'May', 'June', 'July', 'August', 'September', 'October', 'November', 'December');
     $abbreviatedMonthKeys = array('Jan', 'Feb', 'Mar', 'Apr', 'May', 'Jun', 'Jul', 'Aug', 'Sep', 'Oct', 'Nov', 'Dec');
     $wideWeekdayNameKeys = array('Sunday', 'Monday', 'Tuesday', 'Wednesday', 'Thursday', 'Friday', 'Saturday');
     $abbreviatedWeekdayNameKeys = array('Sun', 'Mon', 'Tue', 'Wed', 'Thu', 'Fri', 'Sat');
     $amNameKey = 'AM';
     $pmNameKey = 'PM';
     $formattedFrameworkData = array();
     $locale = \CLocale::getInstance($localeId);
     $formattedFrameworkData = array_merge($formattedFrameworkData, array_combine($wideMonthKeys, $locale->getMonthNames()));
     $formattedFrameworkData = array_merge($formattedFrameworkData, array_combine($abbreviatedMonthKeys, $locale->getMonthNames('abbreviated')));
     $formattedFrameworkData = array_merge($formattedFrameworkData, array_combine($wideWeekdayNameKeys, $locale->getWeekDayNames()));
     $formattedFrameworkData = array_merge($formattedFrameworkData, array_combine($abbreviatedWeekdayNameKeys, $locale->getWeekDayNames('abbreviated')));
     $formattedFrameworkData[$amNameKey] = $locale->getAMName();
     $formattedFrameworkData[$pmNameKey] = $locale->getPMName();
     return $formattedFrameworkData;
 }
开发者ID:kentonquatman,项目名称:portfolio,代码行数:23,代码来源:PhpMessageSource.php


示例15: getLocale

 /**
  * @param string locale ID (e.g. en_US). If null, the {@link getLanguage application language ID} will be used.
  * @return CLocale the locale instance
  */
 public function getLocale($localeID = null)
 {
     return CLocale::getInstance($localeID === null ? $this->getLanguage() : $localeID);
 }
开发者ID:Greka163,项目名称:Yii-blog-new,代码行数:8,代码来源:CApplication.php


示例16: testGetTerritory

 /**
  * @dataProvider providerGetTerritory
  */
 public function testGetTerritory($ctorLocale, $methodLocale, $assertion)
 {
     $locale = CLocale::getInstance($ctorLocale);
     $this->assertEquals($assertion, $locale->getTerritory($methodLocale));
 }
开发者ID:super-d2,项目名称:codeigniter_demo,代码行数:8,代码来源:CLocaleTest.php


示例17: getLanguages

 public function getLanguages()
 {
     if ($this->_languages === null) {
         $basePath = Yii::getPathOfAlias('application.data.guide') . DIRECTORY_SEPARATOR . $this->getVersion();
         $dir = opendir($basePath);
         $this->_languages = array('en' => 'English');
         if ($this->language !== 'en') {
             $this->_languages['en'] .= ' (' . CLocale::getInstance($this->language)->getLocaleDisplayName('en') . ')';
         }
         while (($file = readdir($dir)) !== false) {
             if (!is_dir($basePath . DIRECTORY_SEPARATOR . $file) || $file === '.' || $file === '..' || $file === 'source') {
                 continue;
             }
             $this->_languages[$file] = CLocale::getInstance($file)->getLocaleDisplayName($file);
             if ($file !== $this->language) {
                 $this->_languages[$file] .= ' (' . CLocale::getInstance($this->language)->getLocaleDisplayName($file) . ')';
             }
         }
         ksort($this->_languages);
     }
     return $this->_languages;
 }
开发者ID:Saltly,项目名称:SourceBans,代码行数:22,代码来源:GuideController.php


示例18: setLocaleDataPath

 /**
  * Sets the directory that contains the locale data.
  * @param string $value the directory that contains the locale data.
  * @since 1.1.0
  */
 public function setLocaleDataPath($value)
 {
     CLocale::$dataPath = $value;
 }
开发者ID:Jride,项目名称:accounting-thaiconnections,代码行数:9,代码来源:CApplication.php


示例19: CDateFormatter

?>
</th>
    <th><?php 
echo $sort->link('dateChanged');
?>
</th>
    <th><?php 
echo CHtml::encode(Yii::t('lazy8', 'Actions'));
?>
</th>

  </tr>
  </thead>
  <tbody>
<?php 
$cLoc = CLocale::getInstance('en');
$dateformatter = new CDateFormatter($cLoc);
foreach ($models as $n => $model) {
    ?>
  <tr class="<?php 
    echo $n % 2 ? 'even' : 'odd';
    ?>
">
    <td><?php 
    echo CHtml::encode($model->code);
    ?>
</td>
    <td><?php 
    echo CHtml::encode($model->name);
    ?>
</td>
开发者ID:Jride,项目名称:accounting-thaiconnections,代码行数:31,代码来源:admin.php


示例20: setLanguage

 /**
  * @param string $language the language that the source messages are written in.
  */
 public function setLanguage($language)
 {
     $this->_language = CLocale::getCanonicalID($language);
 }
开发者ID:frogoscar,项目名称:mobcent-discuz,代码行数:7,代码来源:CMessageSource.php



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


鲜花

握手

雷人

路过

鸡蛋
该文章已有0人参与评论

请发表评论

全部评论

专题导读
上一篇:
PHP CLog类代码示例发布时间:2022-05-23
下一篇:
PHP CList类代码示例发布时间:2022-05-23
热门推荐
阅读排行榜

扫描微信二维码

查看手机版网站

随时了解更新最新资讯

139-2527-9053

在线客服(服务时间 9:00~18:00)

在线QQ客服
地址:深圳市南山区西丽大学城创智工业园
电邮:jeky_zhao#qq.com
移动电话:139-2527-9053

Powered by 互联科技 X3.4© 2001-2213 极客世界.|Sitemap