Outil de recherche WordPress pour les développeurs et auteurs de thèmes



wp_set_script_translations ›

Depuis5.0.0
Dépréciéen/a
wp_set_script_translations ( $handle, $domain = 'default', $path = null )
Paramètres: (3)
  • (string) $handle Script handle the textdomain will be attached to.
    Requis: Oui
  • (string) $domain Optional. Text domain. Default 'default'.
    Requis: Non
    Défaut: 'default'
  • (string) $path Optional. The full file path to the directory containing translation files.
    Requis: Non
    Défaut: null
Voir:
  • WP_Scripts::set_translations()
Retourne:
  • (bool) True if the text domain was successfully localized, false otherwise.
Défini(e) dans:
Codex:
Changelog:
  • 5.1.0

Sets translated strings for a script.

Works only if the script has already been added.



Source

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__ );
		return false;
	}

	return $wp_scripts->set_translations( $handle, $domain, $path );
}