Changeset 1649

Show
Ignore:
Timestamp:
01/24/2007 12:20:33 AM (23 months ago)
Author:
wei
Message:

Fixed #505, #508

Location:
branches/3.0
Files:
4 modified

Legend:

Unmodified
Added
Removed
  • branches/3.0/HISTORY

    r1572 r1649  
    1 Version 3.0.7  
     1Version 3.0.7 To be released 
    22=================== 
    33BUG: Ticket#481 - Unable to cancel navigation when handling OnSideBarButtonClickEvent (Qiang) 
    44BUG: typo in THttpResponse.writeFile() about sending headers (Qiang) 
     5BUG: Ticket#505 - cultureInfo::getEnglishName does not return an arrary (Wei) 
     6BUG: Ticket#508 - CultureInfo class: PHP Notice because of missing static declaration (Wei) 
    57 
    68Version 3.0.6 December 4, 2006 
  • branches/3.0/demos/quickstart/protected/pages/Advanced/Samples/I18N/Home.php

    r1397 r1649  
    1010                parent::__construct(); 
    1111                $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 
    1314                        $this->getApplication()->getGlobalization()->setCulture($lang); 
    1415        } 
  • branches/3.0/framework/I18N/core/CultureInfo.php

    r1397 r1649  
    415415         * Returns <code>array('Language','Country');</code> 
    416416         * '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. 
    418418         */ 
    419419        function getEnglishName() 
     
    424424 
    425425                $language = $culture->findInfo("Languages/{$lang}"); 
     426                if(count($language) == 0) 
     427                        return $this->culture; 
     428 
    426429                $region = $culture->findInfo("Countries/{$reg}"); 
    427430                if($region) 
  • branches/3.0/framework/I18N/core/HTTPNegotiator.php

    r1397 r1649  
    2525/** 
    2626 * HTTPNegotiator class. 
    27  *  
     27 * 
    2828 * Get the language and charset information from the client browser. 
    2929 * 
     
    3636        /** 
    3737         * A list of languages accepted by the browser. 
    38          * @var array  
     38         * @var array 
    3939         */ 
    4040        protected $languages; 
     
    4242        /** 
    4343         * A list of charsets accepted by the browser 
    44          * @var array  
     44         * @var array 
    4545         */ 
    4646        protected $charsets; 
     
    4848        /** 
    4949         * 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. 
    5151         */ 
    5252        function getLanguages() 
     
    6262                //$basedir = CultureInfo::dataDir(); 
    6363                //$ext = CultureInfo::fileExt(); 
     64                $info = new CultureInfo(); 
    6465 
    65                 foreach(explode(',', $_SERVER['HTTP_ACCEPT_LANGUAGE']) as $lang)  
     66                foreach(explode(',', $_SERVER['HTTP_ACCEPT_LANGUAGE']) as $lang) 
    6667                { 
    6768            // Cut off any q-value that might come after a semi-colon 
     
    6970                $lang = trim(substr($lang, 0, $pos)); 
    7071 
    71                         if (strstr($lang, '-'))  
     72                        if (strstr($lang, '-')) 
    7273                        { 
    7374                                $codes = explode('-',$lang); 
     
    9293            } 
    9394 
    94                         if(CultureInfo::validCulture($lang)) 
     95                        if($info->validCulture($lang)) 
    9596                                $this->languages[] = $lang; 
    9697        } 
    97                  
     98 
    9899                return $this->languages; 
    99100        } 
     
    101102        /** 
    102103         * 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. 
    104105         */ 
    105106        function getCharsets() 
     
    113114            return $this->charsets; 
    114115 
    115                 foreach (explode(',', $_SERVER['HTTP_ACCEPT_CHARSET']) as $charset)  
     116                foreach (explode(',', $_SERVER['HTTP_ACCEPT_CHARSET']) as $charset) 
    116117                { 
    117             if (!empty($charset))  
     118            if (!empty($charset)) 
    118119                $this->charsets[] = preg_replace('/;.*/', '', $charset); 
    119120        }