protected function maybe_localize( $dependency, $context ) {
		if ( ! array_key_exists( 'localize', $dependency ) ) {
			return;
		}

		$localize = $dependency['localize'];
		$data     = $localize['data'];
		if ( is_callable( $data ) ) {
			$data = $data( $context );
		}

		wp_localize_script( $dependency['handle'], $localize['name'], $data );
	}