wpseek.com
Un motore di ricerca WordPress per sviluppatori e autori di temi



load_script_textdomain › WordPress Function

Da5.0.0
Deprecaton/a
› load_script_textdomain ( $handle, $domain = 'default', $path = '' )
Parametri: (3)
  • (string) $handle Name of the script to register a translation domain to.
    Richiesto: Sì
  • (string) $domain Optional. Text domain. Default 'default'.
    Richiesto: No
    Default: 'default'
  • (string) $path Optional. The full file path to the directory containing translation files.
    Richiesto: No
    Default: (vuoto)
Vedi:
  • WP_Scripts::set_translations()
Ritorna:
  • (string|false) The translated strings in JSON encoding on success,
    false if the script textdomain could not be loaded.
Definito a:
Codex:
ChangeLog:
  • 5.0.2
  • 5.1.0

Loads the script translated strings.



Sorgenti

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 );
}