Automattic\WooCommerce\Internal\Admin

Translations::load_script_translation_file()publicWC 1.0

Load translation strings from language packs for dynamic imports.

Метод класса: Translations{}

Хуков нет.

Возвращает

Строку. New file location for the script being translated.

Использование

$Translations = new Translations();
$Translations->load_script_translation_file( $file, $handle, $domain );
$file(строка) (обязательный)
File location for the script being translated.
$handle(строка) (обязательный)
Script handle.
$domain(строка) (обязательный)
Text domain.

Код Translations::load_script_translation_file() WC 8.7.0

public function load_script_translation_file( $file, $handle, $domain ) {
	// Make sure the main app script is being loaded.
	if ( WC_ADMIN_APP !== $handle ) {
		return $file;
	}

	// Make sure we're handing the correct domain (could be woocommerce or woocommerce-admin).
	$plugin_domain = explode( '/', plugin_basename( __FILE__ ) )[0];
	if ( $plugin_domain !== $domain ) {
		return $file;
	}

	$locale         = determine_locale();
	$cache_filename = $this->get_combined_translation_filename( $domain, $locale );

	return WP_LANG_DIR . '/plugins/' . $cache_filename;
}