WordPress at Your Fingertips
function is not described


Loader::load_script_translation_file() public WC 1.0

Load translation strings from language packs for dynamic imports.

{} It's a method of the class: Loader{}

No Hooks.


String. New file location for the script being translated.


$result = Loader::load_script_translation_file( $file, $handle, $domain );
$file(string) (required)
File location for the script being translated.
$handle(string) (required)
Script handle.
$domain(string) (required)
Text domain.

Code of Loader::load_script_translation_file() WC 5.8.0

public static 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 = self::get_combined_translation_filename( $domain, $locale );

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