WordPress.org

Make WordPress Core

Ticket #18960: 18960.3.diff

File 18960.3.diff, 1.3 KB (added by dd32, 8 years ago)
  • wp-includes/l10n.php

     
    459459function load_theme_textdomain( $domain, $path = false ) {
    460460        $locale = apply_filters( 'theme_locale', get_locale(), $domain );
    461461
    462         $path = ( empty( $path ) ) ? get_template_directory() : $path;
     462        if ( empty( $path ) )
     463                $path = get_template_directory();
    463464
    464         $mofile = "$path/$locale.mo";
     465        // Load the textdomain from the Theme provided location, or theme directory first
     466        $mofile = "{$path}/{$locale}.mo";
     467        if ( $loaded = load_textdomain($domain, $mofile) )
     468                return $loaded;
     469
     470        // Else, load textdomain from the Language directory
     471        $mofile = WP_LANG_DIR . "/themes/{$domain}-{$locale}.mo";
    465472        return load_textdomain($domain, $mofile);
    466473}
    467474
     
    478485 * @param string $domain Unique identifier for retrieving translated strings
    479486 */
    480487function load_child_theme_textdomain( $domain, $path = false ) {
    481         $locale = apply_filters( 'theme_locale', get_locale(), $domain );
    482 
    483         $path = ( empty( $path ) ) ? get_stylesheet_directory() : $path;
    484 
    485         $mofile = "$path/$locale.mo";
    486         return load_textdomain($domain, $mofile);
     488        if ( empty( $path ) )
     489                $path = get_stylesheet_directory();
     490        return load_theme_textdomain( $domain, $path );
    487491}
    488492
    489493/**