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

Automattic\WooCommerce\Admin

Loader::get_translation_chunk_data() public WC 1.0

Find and combine translation chunk files.

Only targets files that aren't represented by a registered script (e.g. not passed to wp_register_script()).

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

Хуков нет.

Возвращает

Массив. Combined translation chunk data.

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

$result = Loader::get_translation_chunk_data( $lang_dir, $domain, $locale );
$lang_dir(строка) (обязательный)
Path to language files.
$domain(строка) (обязательный)
Text domain.
$locale(строка) (обязательный)
Locale being retrieved.

Код Loader::get_translation_chunk_data() WC 4.7.1

<?php
public static function get_translation_chunk_data( $lang_dir, $domain, $locale ) {
	// So long as this function is called during the 'upgrader_process_complete' action,
	// the filesystem object should be hooked up.
	global $wp_filesystem;

	// Grab all JSON files in the current language pack.
	$json_i18n_filenames       = glob( $lang_dir . $domain . '-' . $locale . '-*.json' );
	$combined_translation_data = array();

	if ( false === $json_i18n_filenames ) {
		return $combined_translation_data;
	}

	foreach ( $json_i18n_filenames as $json_filename ) {
		if ( ! $wp_filesystem->is_readable( $json_filename ) ) {
			continue;
		}

		$file_contents = $wp_filesystem->get_contents( $json_filename );
		$chunk_data    = \json_decode( $file_contents, true );

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

		if ( ! isset( $chunk_data['comment']['reference'] ) ) {
			continue;
		}

		$reference_file = $chunk_data['comment']['reference'];

		// Only combine "app" files (not scripts registered with WP).
		if (
			false === strpos( $reference_file, 'dist/chunks/' ) &&
			false === strpos( $reference_file, 'dist/app/index.js' )
		) {
			continue;
		}

		if ( empty( $combined_translation_data ) ) {
			// Use the first translation file as the base structure.
			$combined_translation_data = $chunk_data;
		} else {
			// Combine all messages from all chunk files.
			$combined_translation_data['locale_data']['messages'] = array_merge(
				$combined_translation_data['locale_data']['messages'],
				$chunk_data['locale_data']['messages']
			);
		}
	}

	// Remove inaccurate reference comment.
	unset( $combined_translation_data['comment'] );

	return $combined_translation_data;
}