Changeset 888

Show
Ignore:
Timestamp:
09/20/05 15:41:52 (3 years ago)
Author:
mbonetti
Message:

Fix for #180 - Allow for theme-specific l10n labels
Themes that require specific localizable labels should place these inside an "intl" subdirectory of the theme directory, e.g.:

themes/mytheme/intl/[lang].php

Notes:

  • If [lang].php doesn't exists Gregarius will look for en.php instead
  • it is responsibility of the theme authors to provide localization for the languages he/she wants to support.
Files:
1 modified

Legend:

Unmodified
Added
Removed
  • trunk/rss/init.php

    r858 r888  
    3939} 
    4040 
     41//////////////////////////////////////////////////////////////////////////////// 
    4142// my-hacks support 
     43// 
     44 
    4245if (file_exists(dirname(__FILE__) . '/rss_extra.php')) { 
    4346    rss_require('rss_extra.php'); 
    4447} 
     48 
     49//////////////////////////////////////////////////////////////////////////////// 
     50// Base includes 
     51// 
    4552 
    4653rss_require('constants.php'); 
     
    5057rss_require('db.php'); 
    5158rss_require('config.php'); 
     59 
     60 
     61//////////////////////////////////////////////////////////////////////////////// 
     62// Error reporting 
     63// 
    5264 
    5365if (getConfig('rss.meta.debug')) { 
     
    6173} 
    6274 
     75//////////////////////////////////////////////////////////////////////////////// 
     76// Classes 
     77// 
     78 
    6379_pf('parsing classes:'); 
    6480rss_require('cls/errorhandler.php'); _pf(' ... errorhandler.php'); 
    6581rss_require('cls/items.php');        _pf(' ... items.php'); 
    6682rss_require("cls/channels.php");     _pf(' ... channels.php'); 
    67 rss_require('cls/sidemenu.php');        _pf(' ... sidemenu.php'); 
     83rss_require('cls/sidemenu.php');     _pf(' ... sidemenu.php'); 
    6884rss_require("cls/header.php");       _pf(' ... header.php'); 
    6985rss_require("cls/nav.php");          _pf(' ... nav.php'); 
     
    7793rss_require('tags.php'); 
    7894 
    79  
     95//////////////////////////////////////////////////////////////////////////////// 
     96// Localization 
     97// 
    8098$lang = getConfig('rss.output.lang'); 
    8199 
     
    85103    rss_require('intl/en.php'); 
    86104} 
     105 
     106// Theme  specific l10n handling 
     107$theme = defined('THEME_OVERRIDE')? 
     108    constant("THEME_OVERRIDE"):getConfig('rss.output.theme'); 
     109if (isset($_REQUEST['theme'])) { 
     110    $theme = preg_replace('/[^a-zA-Z0-9_]/','',$_REQUEST['theme']); 
     111} 
     112 
     113if (file_exists(RSS_THEME_DIR."/$theme/intl/$lang.php")) { 
     114    rss_require(RSS_THEME_DIR."/$theme/intl/$lang.php"); 
     115} elseif ($lang != "en" && file_exists(RSS_THEME_DIR."/$theme/intl/en.php")) { 
     116          rss_require(RSS_THEME_DIR."/$theme/intl/en.php"); 
     117} 
     118 
     119 
    87120 
    88121// Load the right locale