mirror of
https://github.com/gosticks/wordpress-develop.git
synced 2026-04-05 05:04:31 +00:00
I18n: Expose JSON translation file paths in load_script_textdomain().
Removes `file_exist()` checks before calling `load_script_translations()` to let the determined paths be passed to `load_script_translations()` which provides its own file check and the possibility to filter the path. Props swissspidy, johnbillion, ocean90. See #45769. git-svn-id: https://develop.svn.wordpress.org/trunk@44418 602fd350-edb4-49c9-b593-d223f7449a82
This commit is contained in:
@@ -922,8 +922,13 @@ function load_script_textdomain( $handle, $domain = 'default', $path = null ) {
|
||||
// If a path was given and the handle file exists simply return it.
|
||||
$file_base = $domain === 'default' ? $locale : $domain . '-' . $locale;
|
||||
$handle_filename = $file_base . '-' . $handle . '.json';
|
||||
if ( $path && file_exists( $path . '/' . $handle_filename ) ) {
|
||||
return load_script_translations( $path . '/' . $handle_filename, $handle, $domain );
|
||||
|
||||
if ( $path ) {
|
||||
$translations = load_script_translations( $path . '/' . $handle_filename, $handle, $domain );
|
||||
|
||||
if ( $translations ) {
|
||||
return $translations;
|
||||
}
|
||||
}
|
||||
|
||||
$src = $wp_scripts->registered[ $handle ]->src;
|
||||
@@ -983,11 +988,19 @@ function load_script_textdomain( $handle, $domain = 'default', $path = null ) {
|
||||
}
|
||||
|
||||
$md5_filename = $file_base . '-' . md5( $relative ) . '.json';
|
||||
if ( $path && file_exists( $path . '/' . $md5_filename ) ) {
|
||||
return load_script_translations( $path . '/' . $md5_filename, $handle, $domain );
|
||||
|
||||
if ( $path ) {
|
||||
$translations = load_script_translations( $path . '/' . $md5_filename, $handle, $domain );
|
||||
|
||||
if ( $translations ) {
|
||||
return $translations;
|
||||
}
|
||||
}
|
||||
if ( file_exists( $languages_path . '/' . $md5_filename ) ) {
|
||||
return load_script_translations( $languages_path . '/' . $md5_filename, $handle, $domain );
|
||||
|
||||
$translations = load_script_translations( $languages_path . '/' . $md5_filename, $handle, $domain );
|
||||
|
||||
if ( $translations ) {
|
||||
return $translations;
|
||||
}
|
||||
|
||||
return load_script_translations( false, $handle, $domain );
|
||||
|
||||
Reference in New Issue
Block a user