WordPress.org

Make WordPress Core

Ticket #18960: 18960.2.diff

File 18960.2.diff, 1.3 KB (added by scribu, 2 years ago)
  • wp-includes/l10n.php

    diff --git wp-includes/l10n.php wp-includes/l10n.php
    index 733f3a4..91d211f 100644
    function load_muplugin_textdomain( $domain, $mu_plugin_rel_path = '' ) { 
    434434/** 
    435435 * Loads the theme's translated strings. 
    436436 * 
    437  * If the current locale exists as a .mo file in the theme's root directory, it 
    438  * will be included in the translated strings by the $domain. 
     437 * If a .mo file is found, it will be included in the translated strings 
     438 * by the $domain. 
    439439 * 
    440440 * The .mo files must be named based on the locale exactly. 
    441441 * 
    442442 * @since 1.5.0 
    443443 * 
    444444 * @param string $domain Unique identifier for retrieving translated strings 
     445 * @param string $path The path to the .mo file directory (optional) 
    445446 */ 
    446447function load_theme_textdomain( $domain, $path = false ) { 
    447448        $locale = apply_filters( 'theme_locale', get_locale(), $domain ); 
    448449 
    449         $path = ( empty( $path ) ) ? get_template_directory() : $path; 
     450        $mofile = WP_LANG_DIR . "/themes/$domain-$locale.mo"; 
    450451 
    451         $mofile = "$path/$locale.mo"; 
    452         return load_textdomain($domain, $mofile); 
     452        if ( !is_readable( $mofile ) ) { 
     453                if ( empty( $path ) ) 
     454                        $path = get_template_directory(); 
     455                $mofile = "$path/$locale.mo"; 
     456        } 
     457 
     458        return load_textdomain( $domain, $mofile ); 
    453459} 
    454460 
    455461/**