Automattic\WooCommerce\Internal\Admin
Translations::load_script_translation_file
Load translation strings from language packs for dynamic imports.
Method of the class: Translations{}
No Hooks.
Returns
String. New file location for the script being translated.
Usage
$Translations = new Translations(); $Translations->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.
Translations::load_script_translation_file() Translations::load script translation file code WC 10.3.6
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.
if ( self::$plugin_domain !== $domain ) {
return $file;
}
$locale = determine_locale();
$cache_filename = $this->get_combined_translation_filename( $domain, $locale );
return WP_LANG_DIR . '/plugins/' . $cache_filename;
}