I18N: Use correct default value for JavaScript translations path.

The `$path` parameter of some script translation functions had a default value of `null`, even though the parameter is documented as a string.

This commit corrects the default value for `$path` in:
* `WP_Dependency::set_translations()`
* `WP_Scripts::set_translations()`
* `wp_set_script_translations()`

Additionally, this commit removes an `is_string()` check for `$path` in `load_script_textdomain()`. Now that the default value for `$path` in that function has also been corrected to an empty string instead of `null`, that check is no longer necessary, as it would ''hide'' an error which should be ''fixed'' (at the source of the problem) instead.

Follow-up to [54349].

Props jrf, johnjamesjacoby.
See #55967, #55656.
Built from https://develop.svn.wordpress.org/trunk@54351


git-svn-id: http://core.svn.wordpress.org/trunk@53910 1a063a9b-81f0-0310-95a4-ce76da25c4cd
This commit is contained in:
Sergey Biryukov
2022-09-28 22:19:10 +00:00
parent 14b6270285
commit 70f3a062db
5 changed files with 10 additions and 9 deletions

View File

@@ -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.