I18N: Make domain argument optional in wp_set_script_translations() / WP_Scripts::set_translations().

Props swissspidy.
Fixes #45489.

git-svn-id: https://develop.svn.wordpress.org/trunk@44395 602fd350-edb4-49c9-b593-d223f7449a82
This commit is contained in:
Dominik Schilling (ocean90)
2019-01-04 21:11:01 +00:00
parent b9c3486f73
commit 8cf4e9ce6a
4 changed files with 24 additions and 22 deletions

View File

@@ -209,14 +209,14 @@ function wp_localize_script( $handle, $object_name, $l10n ) {
* @global WP_Scripts $wp_scripts The WP_Scripts object for printing scripts.
*
* @since 5.0.0
* @since 5.1.0 The `$domain` parameter was made optional.
*
* @param string $handle Script handle the textdomain will be attached to.
* @param string $domain The textdomain.
* @param string $domain Optional. Text domain. Default 'default'.
* @param string $path Optional. The full file path to the directory containing translation files.
*
* @return bool True if the textdomain was successfully localized, false otherwise.
* @return bool True if the text domain was successfully localized, false otherwise.
*/
function wp_set_script_translations( $handle, $domain, $path = null ) {
function wp_set_script_translations( $handle, $domain = 'default', $path = null ) {
global $wp_scripts;
if ( ! ( $wp_scripts instanceof WP_Scripts ) ) {
_wp_scripts_maybe_doing_it_wrong( __FUNCTION__ );