diff --git a/wp-includes/class-wp-dependency.php b/wp-includes/class-wp-dependency.php index c4335b9bab..a018811773 100644 --- a/wp-includes/class-wp-dependency.php +++ b/wp-includes/class-wp-dependency.php @@ -126,7 +126,7 @@ class _WP_Dependency { * @param string $path Optional. The full file path to the directory containing translation files. * @return bool False if $domain is not a string, true otherwise. */ - public function set_translations( $domain, $path = null ) { + public function set_translations( $domain, $path = '' ) { if ( ! is_string( $domain ) ) { return false; } diff --git a/wp-includes/class-wp-scripts.php b/wp-includes/class-wp-scripts.php index c8179da840..5374aa912a 100644 --- a/wp-includes/class-wp-scripts.php +++ b/wp-includes/class-wp-scripts.php @@ -573,7 +573,7 @@ class WP_Scripts extends WP_Dependencies { * @param string $path Optional. The full file path to the directory containing translation files. * @return bool True if the text domain was registered, false if not. */ - public function set_translations( $handle, $domain = 'default', $path = null ) { + public function set_translations( $handle, $domain = 'default', $path = '' ) { if ( ! isset( $this->registered[ $handle ] ) ) { return false; } @@ -605,7 +605,11 @@ class WP_Scripts extends WP_Dependencies { } $domain = $this->registered[ $handle ]->textdomain; - $path = $this->registered[ $handle ]->translations_path; + $path = ''; + + if ( isset( $this->registered[ $handle ]->translations_path ) ) { + $path = $this->registered[ $handle ]->translations_path; + } $json_translations = load_script_textdomain( $handle, $domain, $path ); diff --git a/wp-includes/functions.wp-scripts.php b/wp-includes/functions.wp-scripts.php index 4dd7122b45..b298f9c573 100644 --- a/wp-includes/functions.wp-scripts.php +++ b/wp-includes/functions.wp-scripts.php @@ -237,7 +237,7 @@ function wp_localize_script( $handle, $object_name, $l10n ) { * @param string $path Optional. The full file path to the directory containing translation files. * @return bool True if the text domain was successfully localized, false otherwise. */ -function wp_set_script_translations( $handle, $domain = 'default', $path = null ) { +function wp_set_script_translations( $handle, $domain = 'default', $path = '' ) { global $wp_scripts; if ( ! ( $wp_scripts instanceof WP_Scripts ) ) { diff --git a/wp-includes/l10n.php b/wp-includes/l10n.php index 6a63f12a57..ea4ca9bcd3 100644 --- a/wp-includes/l10n.php +++ b/wp-includes/l10n.php @@ -1065,10 +1065,7 @@ function load_script_textdomain( $handle, $domain = 'default', $path = '' ) { return false; } - if ( is_string( $path ) ) { - $path = untrailingslashit( $path ); - } - + $path = untrailingslashit( $path ); $locale = determine_locale(); // If a path was given and the handle file exists simply return it. diff --git a/wp-includes/version.php b/wp-includes/version.php index 3e4bf68253..0f8bbecfa9 100644 --- a/wp-includes/version.php +++ b/wp-includes/version.php @@ -16,7 +16,7 @@ * * @global string $wp_version */ -$wp_version = '6.1-beta2-54350'; +$wp_version = '6.1-beta2-54351'; /** * Holds the WordPress DB revision, increments when changes are made to the WordPress DB schema.