private function findMatchingTransliterator(string $rule, string $locale): \Transliterator
	{
		$candidates = [
			'Latin-'.$rule,
			$rule,
		];

		if ($locale) {
			array_unshift(
				$candidates,
				$locale.'-'.$rule,
				\Locale::getPrimaryLanguage($locale).'-'.$rule
			);
		}

		$errorLevel = ini_set('intl.error_level', '0');
		$useExceptions = ini_set('intl.use_exceptions', '0');

		try {
			foreach ($candidates as $candidate) {
				$candidate = $this->fixTransliteratorRule($candidate);
				if ($transliterator = \Transliterator::create($candidate)) {
					return $transliterator;
				}
				if ($transliterator = \Transliterator::createFromRules($candidate)) {
					return $transliterator;
				}
			}
		} finally {
			ini_set('intl.error_level', $errorLevel);
			ini_set('intl.use_exceptions', $useExceptions);
		}

		throw new \InvalidArgumentException(
			sprintf('No Transliterator transform rule found for "%s" with locale "%s".', $rule, $locale)
		);
	}