Changeset 1817

Show
Ignore:
Timestamp:
10/19/04 00:18:12 (4 years ago)
Author:
rboren
Message:

Default textdomain loading cleanup. Fix for bug 230.

Files:

Legend:

Unmodified
Added
Removed
Modified
Copied
Moved
  • trunk/wp-includes/gettext.php

    r1779 r1817  
    116116    $length = $meta[0]; 
    117117    $offset = $meta[1]; 
     118        if (! $length) { 
     119            return ''; 
     120        } 
    118121    $this->STREAM->seekto($offset); 
    119122    $data = $this->STREAM->read($length); 
  • trunk/wp-includes/wp-l10n.php

    r1809 r1817  
    33  
    44require_once($parentpath.'/wp-config.php'); 
    5  
    6 $curpath = dirname(__FILE__).'/'; 
    75 
    86$locale = ''; 
     
    1715} 
    1816 
    19 $mofile = $curpath . "languages/$locale.mo"; 
    20  
    21 require($curpath . 'streams.php'); 
    22 require($curpath . 'gettext.php'); 
    23  
    24 // If the mo file does not exist or is not readable, or if the locale is 
    25 // en_US, do not load the mo. 
    26 if ( is_readable($mofile) && ($locale != 'en_US') ) { 
    27     $input = new FileReader($mofile); 
    28 } else { 
    29     $input = false; 
    30 
    31  
    32 $l10n['default'] = new gettext_reader($input); 
     17require_once(ABSPATH . 'wp-includes/streams.php'); 
     18require_once(ABSPATH . 'wp-includes/gettext.php'); 
    3319 
    3420// Return a translated string.     
     
    6854    global $l10n; 
    6955 
     56    if (isset($l10n[$domain])) { 
     57        return; 
     58    } 
     59 
    7060    if ( is_readable($mofile)) { 
    7161    $input = new FileReader($mofile); 
     
    7565 
    7666    $l10n[$domain] = new gettext_reader($input); 
     67} 
     68 
     69function load_default_textdomain() { 
     70    global $l10n, $locale; 
     71 
     72    $mofile = ABSPATH . "wp-includes/languages/$locale.mo"; 
     73     
     74    load_textdomain('default', $mofile); 
    7775} 
    7876 
     
    9189} 
    9290 
     91// Load the default domain. 
     92load_default_textdomain(); 
     93 
    9394require($curpath . 'locale.php'); 
    9495?>