wpseek.com
WordPress开发者和主题制作者的搜索引擎



wp_set_script_translations › WordPress Function

Since5.0.0
已弃用n/a
wp_set_script_translations ( $handle, $domain = 'default', $path = '' )
参数: (3)
  • (string) $handle Script handle the textdomain will be attached to.
    Required: Yes
  • (string) $domain Optional. Text domain. Default 'default'.
    Required: No
    默认: 'default'
  • (string) $path Optional. The full file path to the directory containing translation files.
    Required: No
    默认: (empty)
查看:
  • WP_Scripts::set_translations()
返回:
  • (bool) True if the text domain was successfully localized, false otherwise.
定义在:
文档:
Change Log:
  • 5.1.0

Sets translated strings for a script.

Works only if the script has already been registered.


源码

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