Changeset 1725

Show
Ignore:
Timestamp:
06/06/07 14:55:22 (15 months ago)
Author:
mbonetti
Message:

new language negotiation method. if rss.ouput.lang.force is set to true,
Gregarius will always serve pages with the language defined in
rss.output.lang, when 'false', it'll negotiate, then fall back to the
language defined in rss.output.lang

Location:
trunk/gregarius
Files:
2 modified

Legend:

Unmodified
Added
Removed
  • trunk/gregarius/cls/l10n.php

    r1692 r1725  
    7979     */ 
    8080    function __detectUserLang() { 
     81         
     82        if (getConfig('rss.output.lang.force') === true) { 
     83            return getConfig('rss.output.lang'); 
     84        // Language defined in the request (?lang=) 
     85        } 
     86         
    8187        // Language overridden? 
    8288        if (defined('RSS_LANGUAGE_OVERRIDE')) { 
    8389            return constant('RSS_LANGUAGE_OVERRIDE'); 
    84         // Language defined in the request (?lang=) 
    85         } elseif (isset($_REQUEST['lang']) && preg_match('#^[a-z]{2}_?([A-Z]{2})?$#',$_REQUEST['lang']) && ($_REQUEST['lang'] == 'en' || file_exists(GREGARIUS_HOME .'intl/'.$_REQUEST['lang']))) { 
     90        }  elseif (isset($_REQUEST['lang']) && preg_match('#^[a-z]{2}_?([A-Z]{2})?$#',$_REQUEST['lang']) && ($_REQUEST['lang'] == 'en' || file_exists(GREGARIUS_HOME .'intl/'.$_REQUEST['lang']))) { 
    8691            $this -> __setLocaleCookie($_REQUEST['lang']); 
    8792            rss_invalidate_cache(); 
    8893            return  $_REQUEST['lang']; 
    8994        // Cookie 
    90         } elseif (isset($_COOKIE[RSS_LOCALE_COOKIE])) { 
     95        } elseif (isset($_COOKIE[RSS_LOCALE_COOKIE])) { 
    9196            return trim($_COOKIE[RSS_LOCALE_COOKIE]); 
    9297        // HTTP_ACCEPT_LANGUAGE HTTP Argument 
  • trunk/gregarius/schema.php

    r1692 r1725  
    447447        "rss.config.markreadonupdate"=> array("false","false","boolean","Mark all old unread feeds as read when updating if new unread feeds are found.",NULL), 
    448448        "rss.output.lang"           =>      array("en_US,zh_CN,de,da,es,fr,he,it,ja,pt_BR,pt,ru,sv,0","en_US,zh_CN,de,da,es,fr,he,it,ja,pt_BR,pt,ru,sv,0","enum","Language pack to use.",NULL), 
     449        "rss.output.lang.force"     =>      array("false","false",'boolean',"When false, Gregarius will negotiate the display language with the browser and will fall back to the language defined in rss.output.lang if the negotiation fails. When true, Gregarius won't negotiate and will always use the language defined in rss.output.lang.",NULL), 
    449450        "rss.config.absoluteordering"=> array("true","true","boolean","Allow feeds and folders to be ordered by their order in the admin section. If this option is set to false, channels and folders will be organized alphabetically by their titles.",NULL), 
    450451        "rss.config.robotsmeta"     =>      array("noindex,follow","noindex,follow","string","How should spiders crawl us? (see http://www.robotstxt.org/wc/meta-user.html for more info).",NULL),