private function transformWithContext(\Transliterator $transliterator, string $text, int $index, int $length): string
	{
		$left = mb_substr(substr($text, 0, $index), -1, null, 'UTF-8');
		$right = mb_substr(substr($text, $index + $length), 0, 1, 'UTF-8');

		$leftLength = strlen($left);
		$rightLength = strlen($right);

		$text = substr($text, $index, $length);

		$transformed = $transliterator->transliterate($left.$text.$right);

		if (
			(!$leftLength || strncmp($transformed, $left, $leftLength) === 0)
			&& (!$rightLength || substr_compare($transformed, $right, -$rightLength) === 0)
		) {
			return substr($transformed, $leftLength, $rightLength ? -$rightLength : strlen($transformed));
		} else {
			return $transliterator->transliterate($text);
		}
	}