wpseek.com
Eine auf WordPress spezialiserte Suchmaschine für Entwickler und Theme-Autoren



load_script_module_textdomain › WordPress Function

Seit7.0.0
Veraltetn/v
load_script_module_textdomain ( $id, $domain = 'default', $path = '' )
Parameter: (3)
  • (string) $id The script module identifier.
    Erforderlich: Ja
  • (string) $domain Optional. Text domain. Default 'default'.
    Erforderlich: Nein
    Standard: 'default'
  • (string) $path Optional. The full file path to the directory containing translation files.
    Erforderlich: Nein
    Standard: (leer)
Gibt zurück:
  • (string|false) The JSON-encoded translated strings for the given script module and text domain.
    False if there are none.
Definiert in:
Codex:

Loads the translation data for a given script module ID and text domain.

Works like load_script_textdomain but for script modules registered via wp_register_script_module.


Quellcode

function load_script_module_textdomain( string $id, string $domain = 'default', string $path = '' ) {
	$module = wp_script_modules()->get_registered( $id );
	if ( null === $module ) {
		return false;
	}
	$src = $module['src'];

	// Ensure src is an absolute URL for path resolution.
	if ( ! preg_match( '|^(https?:)?//|', $src ) ) {
		$src = site_url( $src );
	}

	return _load_script_textdomain_from_src( $id, $src, $domain, $path, true );
}