WordPress.org

Make WordPress Core

Ticket #45769: 45769.diff

File 45769.diff, 1.6 KB (added by swissspidy, 2 years ago)
  • src/wp-includes/l10n.php

    diff --git src/wp-includes/l10n.php src/wp-includes/l10n.php
    index 7dd86607ec..3b07d66758 100644
    function load_script_textdomain( $handle, $domain, $path = null ) { 
    921921        // If a path was given and the handle file exists simply return it.
    922922        $file_base       = $domain === 'default' ? $locale : $domain . '-' . $locale;
    923923        $handle_filename = $file_base . '-' . $handle . '.json';
    924         if ( $path && file_exists( $path . '/' . $handle_filename ) ) {
    925                 return load_script_translations( $path . '/' . $handle_filename, $handle, $domain );
     924        $translations    = load_script_translations( $path . '/' . $handle_filename, $handle, $domain );
     925
     926        if ( $translations ) {
     927                return $translations;
    926928        }
    927929
    928930        $src = $wp_scripts->registered[ $handle ]->src;
    function load_script_textdomain( $handle, $domain, $path = null ) { 
    982984        }
    983985
    984986        $md5_filename = $file_base . '-' . md5( $relative ) . '.json';
    985         if ( $path && file_exists( $path . '/' . $md5_filename ) ) {
    986                 return load_script_translations( $path . '/' . $md5_filename, $handle, $domain );
     987
     988        $translations = load_script_translations( $path . '/' . $md5_filename, $handle, $domain );
     989
     990        if ( $translations ) {
     991                return $translations;
    987992        }
    988         if ( file_exists( $languages_path . '/' . $md5_filename ) ) {
    989                 return load_script_translations( $languages_path . '/' . $md5_filename, $handle, $domain );
     993
     994        $translations = load_script_translations( $languages_path . '/' . $md5_filename, $handle, $domain );
     995
     996        if ( $translations ) {
     997                return $translations;
    990998        }
    991999
    9921000        return load_script_translations( false, $handle, $domain );