wp_set_script_translations( string $handle, string $domain = 'default', string $path = '' )
Sets translated strings for a script.
Description
Works only if the script has already been registered.
See also
Parameters
- $handle
-
(Required) Script handle the textdomain will be attached to.
- $domain
-
(Optional) Text domain. Default 'default'.
Default value: 'default'
- $path
-
(Optional) The full file path to the directory containing translation files.
Default value: ''
Return
(bool) True if the text domain was successfully localized, false otherwise.
Source
File: wp-includes/functions.wp-scripts.php
function wp_set_script_translations( $handle, $domain = 'default', $path = '' ) {
global $wp_scripts;
if ( ! ( $wp_scripts instanceof WP_Scripts ) ) {
_wp_scripts_maybe_doing_it_wrong( __FUNCTION__, $handle );
return false;
}
return $wp_scripts->set_translations( $handle, $domain, $path );
}
Changelog
Version | Description |
---|---|
5.1.0 | The $domain parameter was made optional. |
5.0.0 | Introduced. |