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


PHP locale类代码示例

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


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

示例1: main_element_attributes

 public function main_element_attributes()
 {
     if (locale::is_rtl()) {
         return 'class="rtl"';
     }
     return '';
 }
开发者ID:krgeek,项目名称:gallery3,代码行数:7,代码来源:MY_View.php

示例2: get_i18n

 /**
  * checks the i18n folder to see what folders we have available
  */
 public static function get_i18n()
 {
     $locales = array();
     // i18n path
     $i18n_path = APPPATH . 'i18n/';
     // i18n folder
     $i18n_folder = @opendir($i18n_path);
     if (!$i18n_folder) {
         return false;
     }
     while (($i18n_dir = readdir($i18n_folder)) !== false) {
         if (is_dir($i18n_path . $i18n_dir) && is_readable($i18n_path . $i18n_dir)) {
             // Strip out .  and .. and any other stuff
             if ($i18n_dir[0] == '.' || $i18n_dir == '..' || $i18n_dir == '.DS_Store' || $i18n_dir == '.git') {
                 continue;
             }
             $locale = explode("_", $i18n_dir);
             if (count($locale) < 2) {
                 continue;
             }
             $directories[$i18n_dir] = locale::language($locale[0]) . " (" . $locale[1] . ")";
         }
     }
     if (is_dir($i18n_dir)) {
         @closedir($i18n_dir);
     }
     return $directories;
 }
开发者ID:kjgarza,项目名称:ushahidi,代码行数:31,代码来源:locale.php

示例3: run

  function run(&$filter_chain, &$request, &$response) 
  {
    debug :: add_timing_point('locale filter started');
    
    if(!$node = map_request_to_node($request))
    {
    	define('CONTENT_LOCALE_ID', DEFAULT_CONTENT_LOCALE_ID);
    	define('MANAGEMENT_LOCALE_ID', CONTENT_LOCALE_ID);
    	
    	$locale =& locale :: instance();    	
    	$locale->setlocale();
    	
      $filter_chain->next();
      return;
    }
          
    if($object_locale_id = site_object :: get_locale_by_id($node['object_id']))
    	define('CONTENT_LOCALE_ID', $object_locale_id);
    else
      define('CONTENT_LOCALE_ID', DEFAULT_CONTENT_LOCALE_ID);
    
    $user = user :: instance();
    if($user_locale_id = $user->get_locale_id())
    	define('MANAGEMENT_LOCALE_ID', $user_locale_id);
    else
      define('MANAGEMENT_LOCALE_ID', CONTENT_LOCALE_ID);
              
    debug :: add_timing_point('locale filter finished');

  	$locale =& locale :: instance();    	
  	$locale->setlocale();
    
    $filter_chain->next();
  }   
开发者ID:BackupTheBerlios,项目名称:limb-svn,代码行数:34,代码来源:locale_definition_filter.class.php

示例4: body_attributes

 public function body_attributes()
 {
     if (locale::is_rtl()) {
         return 'class="rtl"';
     }
     return '';
 }
开发者ID:kstyrvoll,项目名称:gallery3,代码行数:7,代码来源:MY_View.php

示例5: get_cart_summ

	function get_cart_summ()
	{
		$cart =& cart :: instance();
		$locale = locale :: instance();
		
		return number_format($cart->get_total_summ(), $locale->fract_digits, $locale->decimal_symbol, $locale->thousand_separator);
	}
开发者ID:BackupTheBerlios,项目名称:limb-svn,代码行数:7,代码来源:cart_summ_component.class.php

示例6: mime_mail

 function mime_mail()
 {
     $this->html_images = array();
     $this->headers = array();
     $this->is_built = false;
     $this->image_types = array('gif' => 'image/gif', 'jpg' => 'image/jpeg', 'jpeg' => 'image/jpeg', 'jpe' => 'image/jpeg', 'bmp' => 'image/bmp', 'png' => 'image/png', 'tif' => 'image/tiff', 'tiff' => 'image/tiff', 'swf' => 'application/x-shockwave-flash');
     $locale =& locale::instance();
     $this->build_params['html_encoding'] = '8bit';
     $this->build_params['text_encoding'] = '8bit';
     $this->build_params['html_charset'] = $locale->get_charset();
     $this->build_params['text_charset'] = $locale->get_charset();
     $this->build_params['head_charset'] = $locale->get_charset();
     $this->build_params['text_wrap'] = 998;
     if (!empty($_SERVER['HTTP_HOST'])) {
         $helo = $_SERVER['HTTP_HOST'];
     } elseif (!empty($_SERVER['SERVER_NAME'])) {
         $helo = $_SERVER['SERVER_NAME'];
     } else {
         $helo = 'localhost';
     }
     $this->smtp_params['host'] = 'localhost';
     $this->smtp_params['port'] = 25;
     $this->smtp_params['helo'] = $helo;
     $this->smtp_params['auth'] = false;
     $this->smtp_params['user'] = '';
     $this->smtp_params['pass'] = '';
     $this->headers['MIME-Version'] = '1.0';
 }
开发者ID:BackupTheBerlios,项目名称:limb-svn,代码行数:28,代码来源:mime_mail.class.php

示例7: _set_period_filter

	function _set_period_filter()
	{
		$locale =& locale :: instance();
		$start_date = new date();
		$start_date->set_hour(0);
		$start_date->set_minute(0);
		$start_date->set_second(0);

		if (isset($_REQUEST['stats_start_date']))
		{
			$start_date->set_by_string($_REQUEST['stats_start_date'], $locale->get_short_date_time_format());
		}
		
		$finish_date = new date();

		if (isset($_REQUEST['stats_finish_date']))
		{
			$finish_date->set_by_string($_REQUEST['stats_finish_date'], $locale->get_short_date_time_format());
		}

		$finish_date->set_hour(23);
		$finish_date->set_minute(59);
		$finish_date->set_second(59);
		
		$this->stats_report->set_period_filter($start_date, $finish_date);
	}
开发者ID:BackupTheBerlios,项目名称:limb-svn,代码行数:26,代码来源:stats_search_engines_list_datasource.class.php

示例8: setUp

 function setUp()
 {
     $this->report = new Mockstats_referers_report($this);
     $this->ds = new stats_referers_except_groups_list_datasource_test_version($this);
     $this->ds->setReturnReference('_create_referers_report', $this->report);
     $this->ds->stats_referers_list_datasource();
     $this->locale =& locale::instance();
 }
开发者ID:BackupTheBerlios,项目名称:limb-svn,代码行数:8,代码来源:stats_referers_except_groups_list_datasource_test.class.php

示例9: locale_format

 function locale_format($number, $locale_string = null)
 {
     $locale = locale::instance($locale_string);
     $neg = $number < 0;
     $num = $neg ? -$number : $number;
     $num_text =& number_format($num, $locale->get_currency_fract_digits(), $locale->get_currency_decimal_symbol(), $locale->get_currency_thousand_separator());
     $text =& utf8_str_replace(array('%c', '%p', '%q'), array($locale->get_currency_symbol(), $neg ? $locale->get_currency_negative_symbol() : $locale->get_currency_positive_symbol(), $num_text), $neg ? $locale->get_currency_negative_format() : $locale->get_currency_positive_format());
     return $text;
 }
开发者ID:BackupTheBerlios,项目名称:limb-svn,代码行数:9,代码来源:currency.class.php

示例10: check

 function check($value)
 {
     $locale =& locale::instance();
     $date =& new date();
     $date->set_by_string($value, $locale->get_short_date_format());
     if (!$date->is_valid()) {
         $this->error('INVALID_DATE');
     }
 }
开发者ID:BackupTheBerlios,项目名称:limb-svn,代码行数:9,代码来源:locale_date_rule.class.php

示例11: _add_locale_dropdown

 private static function _add_locale_dropdown(&$form, $user = null)
 {
     $locales = locale::installed();
     if (count($locales) > 1) {
         // Put "none" at the first position in the array
         $locales = array_merge(array("" => t("&laquo; none &raquo;")), $locales);
         $selected_locale = $user && $user->locale ? $user->locale : "";
         $form->dropdown("locale")->label(t("Language Preference"))->options($locales)->selected($selected_locale);
     }
 }
开发者ID:xafr,项目名称:gallery3,代码行数:10,代码来源:user.php

示例12: format

 function format()
 {
     if ($this->format_string) {
         $format_string = $this->format_string;
     } else {
         $locale =& locale::instance($this->locale_type);
         $format_string = $locale->get_short_date_format();
     }
     echo $this->date->format($format_string);
 }
开发者ID:BackupTheBerlios,项目名称:limb-svn,代码行数:10,代码来源:locale_date_format_component.class.php

示例13: _valid_perform

 function _valid_perform()
 {
     $locale_id = $this->dataspace->get('locale_id');
     if (!locale::is_valid_locale_id($locale_id)) {
         return new close_popup_response(RESPONSE_STATUS_FAILURE);
     }
     $user =& user::instance();
     $user->set_locale_id($locale_id);
     return new close_popup_response(RESPONSE_STATUS_SUCCESS);
 }
开发者ID:BackupTheBerlios,项目名称:limb-svn,代码行数:10,代码来源:change_user_locale_action.class.php

示例14: load

 public static function load($locale = null)
 {
     self::$translations = array();
     if (!$locale && EE::is_set('_config', 'locale')) {
         $locale = EE::get('_config', 'locale');
     }
     if ($locale) {
         $file = EE::get('_dir') . '/' . EE::APP_TRANSLATIONS_DIR . '/' . $locale . '.php';
         if (file_exists($file)) {
             self::$translations = (require $file);
             return true;
         }
     }
     return false;
 }
开发者ID:kokareff,项目名称:easyembed,代码行数:15,代码来源:locale.php

示例15: _valid_perform

 function _valid_perform(&$request, &$response)
 {
     $locale_id = $this->dataspace->get('locale_id');
     if ($request->has_attribute('popup')) {
         $response->write(close_popup_response($request));
     } elseif (isset($_SERVER['HTTP_REFERER'])) {
         $response->redirect($_SERVER['HTTP_REFERER']);
     } else {
         $response->redirect('/');
     }
     if (!locale::is_valid_locale_id($locale_id)) {
         $request->set_status(REQUEST_STATUS_FAILURE);
     }
     $user =& user::instance();
     $user->set_locale_id($locale_id);
     $request->set_status(REQUEST_STATUS_SUCCESS);
 }
开发者ID:BackupTheBerlios,项目名称:limb-svn,代码行数:17,代码来源:change_user_locale_action.class.php


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