WordPress как на ладони
Недорогой хостинг для сайтов на WordPress: wordpress.jino.ru Платформа для конвертации и монетизации трафика
функция не описана

Automattic\WooCommerce\Admin

Loader::combine_translation_chunk_files() public WC 1.0

Combine translation chunks when files are updated.

This function combines JSON translation data auto-extracted by GlotPress from Webpack-generated JS chunks into a single file that can be used in subsequent requests. This is necessary since the JS chunks are not known to WordPress via wp_register_script() and wp_set_script_translations().

{} Это метод класса: Loader{}

Хуков нет.

Возвращает

Null. Ничего.

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

$result = Loader::combine_translation_chunk_files( $instance, $hook_extra );
$instance(Language_Pack_Upgrader) (обязательный)
Upgrader instance.
$hook_extra(массив) (обязательный)
Info about the upgraded language packs.

Код Loader::combine_translation_chunk_files() WC 4.7.1

<?php
public static function combine_translation_chunk_files( $instance, $hook_extra ) {
	// So long as this function is hooked to the 'upgrader_process_complete' action,
	// the filesystem object should be hooked up.
	global $wp_filesystem;

	if (
		! is_a( $instance, 'Language_Pack_Upgrader' ) ||
		! isset( $hook_extra['translations'] ) ||
		! is_array( $hook_extra['translations'] )
	) {
		return;
	}

	// Make sure we're handing the correct domain (could be woocommerce or woocommerce-admin).
	$plugin_domain = explode( '/', plugin_basename( __FILE__ ) )[0];
	$locales       = array();
	$language_dir  = WP_LANG_DIR . '/plugins/';

	// Gather the locales that were updated in this operation.
	foreach ( $hook_extra['translations'] as $translation ) {
		if (
			'plugin' === $translation['type'] &&
			$plugin_domain === $translation['slug']
		) {
			$locales[] = $translation['language'];
		}
	}

	// Build combined translation files for all updated locales.
	foreach ( $locales as $locale ) {
		$translations_from_chunks = self::get_translation_chunk_data( $language_dir, $plugin_domain, $locale );

		if ( empty( $translations_from_chunks ) ) {
			continue;
		}

		$cache_filename          = self::get_combined_translation_filename( $plugin_domain, $locale );
		$chunk_translations_json = wp_json_encode( $translations_from_chunks );

		// Cache combined translations strings to a file.
		$wp_filesystem->put_contents( $language_dir . $cache_filename, $chunk_translations_json );
	}
}