Changeset 1649 for branches/3.0
- Timestamp:
- 01/24/2007 12:20:33 AM (23 months ago)
- Location:
- branches/3.0
- Files:
-
- 4 modified
-
HISTORY (modified) (1 diff)
-
demos/quickstart/protected/pages/Advanced/Samples/I18N/Home.php (modified) (1 diff)
-
framework/I18N/core/CultureInfo.php (modified) (2 diffs)
-
framework/I18N/core/HTTPNegotiator.php (modified) (9 diffs)
Legend:
- Unmodified
- Added
- Removed
-
branches/3.0/HISTORY
r1572 r1649 1 Version 3.0.7 1 Version 3.0.7 To be released 2 2 =================== 3 3 BUG: Ticket#481 - Unable to cancel navigation when handling OnSideBarButtonClickEvent (Qiang) 4 4 BUG: typo in THttpResponse.writeFile() about sending headers (Qiang) 5 BUG: Ticket#505 - cultureInfo::getEnglishName does not return an arrary (Wei) 6 BUG: Ticket#508 - CultureInfo class: PHP Notice because of missing static declaration (Wei) 5 7 6 8 Version 3.0.6 December 4, 2006 -
branches/3.0/demos/quickstart/protected/pages/Advanced/Samples/I18N/Home.php
r1397 r1649 10 10 parent::__construct(); 11 11 $lang = $this->Request['lang']; 12 if(CultureInfo::validCulture($lang)) //only valid lang is permitted 12 $info = new CultureInfo(); 13 if($info->validCulture($lang)) //only valid lang is permitted 13 14 $this->getApplication()->getGlobalization()->setCulture($lang); 14 15 } -
branches/3.0/framework/I18N/core/CultureInfo.php
r1397 r1649 415 415 * Returns <code>array('Language','Country');</code> 416 416 * 'Country' is omitted if the culture is neutral. 417 * @return array array with language and country as elements.417 * @return string language (country), it may locale code string if english name does not exist. 418 418 */ 419 419 function getEnglishName() … … 424 424 425 425 $language = $culture->findInfo("Languages/{$lang}"); 426 if(count($language) == 0) 427 return $this->culture; 428 426 429 $region = $culture->findInfo("Countries/{$reg}"); 427 430 if($region) -
branches/3.0/framework/I18N/core/HTTPNegotiator.php
r1397 r1649 25 25 /** 26 26 * HTTPNegotiator class. 27 * 27 * 28 28 * Get the language and charset information from the client browser. 29 29 * … … 36 36 /** 37 37 * A list of languages accepted by the browser. 38 * @var array 38 * @var array 39 39 */ 40 40 protected $languages; … … 42 42 /** 43 43 * A list of charsets accepted by the browser 44 * @var array 44 * @var array 45 45 */ 46 46 protected $charsets; … … 48 48 /** 49 49 * Get a list of languages acceptable by the client browser 50 * @return array languages ordered in the user browser preferences. 50 * @return array languages ordered in the user browser preferences. 51 51 */ 52 52 function getLanguages() … … 62 62 //$basedir = CultureInfo::dataDir(); 63 63 //$ext = CultureInfo::fileExt(); 64 $info = new CultureInfo(); 64 65 65 foreach(explode(',', $_SERVER['HTTP_ACCEPT_LANGUAGE']) as $lang) 66 foreach(explode(',', $_SERVER['HTTP_ACCEPT_LANGUAGE']) as $lang) 66 67 { 67 68 // Cut off any q-value that might come after a semi-colon … … 69 70 $lang = trim(substr($lang, 0, $pos)); 70 71 71 if (strstr($lang, '-')) 72 if (strstr($lang, '-')) 72 73 { 73 74 $codes = explode('-',$lang); … … 92 93 } 93 94 94 if( CultureInfo::validCulture($lang))95 if($info->validCulture($lang)) 95 96 $this->languages[] = $lang; 96 97 } 97 98 98 99 return $this->languages; 99 100 } … … 101 102 /** 102 103 * Get a list of charsets acceptable by the client browser. 103 * @return array list of charsets in preferable order. 104 * @return array list of charsets in preferable order. 104 105 */ 105 106 function getCharsets() … … 113 114 return $this->charsets; 114 115 115 foreach (explode(',', $_SERVER['HTTP_ACCEPT_CHARSET']) as $charset) 116 foreach (explode(',', $_SERVER['HTTP_ACCEPT_CHARSET']) as $charset) 116 117 { 117 if (!empty($charset)) 118 if (!empty($charset)) 118 119 $this->charsets[] = preg_replace('/;.*/', '', $charset); 119 120 }
