protected function build_json_files( $mapping, $base_file_name, $destination ) {
		$result = [];

		foreach ( $mapping as $file => $translations ) {
			/** @var Translations $translations */

			$hash             = md5( $file );
			$destination_file = "${destination}/{$base_file_name}-{$hash}.json";

			$success = JedGenerator::toFile(
				$translations,
				$destination_file,
				[
					'json'   => $this->json_options,
					'source' => $file,
				]
			);

			if ( ! $success ) {
				WP_CLI::warning( sprintf( 'Could not create file %s', basename( $destination_file, '.json' ) ) );

				continue;
			}

			$result[] = $destination_file;
		}

		return $result;
	}
protected function build_json_files( $mapping, $base_file_name, $destination ) {
		$result = [];

		foreach ( $mapping as $file => $translations ) {
			/** @var Translations $translations */

			$hash             = md5( $file );
			$destination_file = "${destination}/{$base_file_name}-{$hash}.json";

			$success = JedGenerator::toFile(
				$translations,
				$destination_file,
				[
					'json'   => $this->json_options,
					'source' => $file,
				]
			);

			if ( ! $success ) {
				WP_CLI::warning( sprintf( 'Could not create file %s', basename( $destination_file, '.json' ) ) );

				continue;
			}

			$result[] = $destination_file;
		}

		return $result;
	}
protected function build_json_files ( $ mapping , $ base_file_name , $ destination ) { $ result = [ ] ; foreach ( $ mapping as $ file => $ translations ) { /** @var Translations $translations */ $ hash = md5 ( $ file ) ; $ destination_file = "${destination}/{$base_file_name}-{$hash}.json" ; $ success = JedGenerator :: toFile ( $ translations , $ destination_file , [ 'json' => $ this -> json_options , 'source' => $ file , ] ) ; if ( ! $ success ) { WP_CLI :: warning ( sprintf ( 'Could not create file %s' , basename ( $ destination_file , '.json' ) ) ) ; continue ; } $ result [ ] = $ destination_file ; } return $ result ; }
Builds a mapping of JS file names to translation entries.

Exports translations for each JS file to a separate translation file.

@param array  $mapping        A mapping of files to translation entries.
@param string $base_file_name Base file name for JSON files.
@param string $destination    Path to the destination directory.

@return array List of created JSON files.
Builds a mapping of JS file names to translation entries .