當前位置: 首頁>>代碼示例>>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;未經允許,請勿轉載。