Loads the script translated strings.
Description
See also
Parameters
$handlestringrequired- Name of the script to register a translation domain to.
$domainstringoptional- Text domain. Default
'default'.Default:
'default' $pathstringoptional- The full file path to the directory containing translation files.
Default:
''
Source
function load_script_textdomain( $handle, $domain = 'default', $path = '' ) {
$wp_scripts = wp_scripts();
if ( ! isset( $wp_scripts->registered[ $handle ] ) ) {
return false;
}
$src = $wp_scripts->registered[ $handle ]->src;
if ( ! preg_match( '|^(https?:)?//|', $src ) && ! ( $wp_scripts->content_url && str_starts_with( $src, $wp_scripts->content_url ) ) ) {
$src = $wp_scripts->base_url . $src;
}
return _load_script_textdomain_from_src( $handle, $src, $domain, $path, false );
}
Changelog
| Version | Description |
|---|---|
| 5.1.0 | The $domain parameter was made optional. |
| 5.0.2 | Uses load_script_translations() to load translation data. |
| 5.0.0 | Introduced. |
User Contributed Notes
You must log in before being able to contribute a note or feedback.