/**
  * Translaterates UTF-8 string to ASCII. (北京 to 'Bei Jing')
  *
  * Accepts language parameter that maps to a configurable array of special transliteration rules if present.
  *
  * @param string $text Text to transliterate
  * @param string $language Optional language for specific rules (falls back to current locale if not provided)
  * @return string
  */
 public function transliterate($text, $language = null)
 {
     $language = $language ?: $this->localizationService->getConfiguration()->getCurrentLocale()->getLanguage();
     if (isset($this->transliterationRules[$language])) {
         // Apply special transliteration (not supported in library)
         $text = strtr($text, $this->transliterationRules[$language]);
     }
     // Transliterate (transform 北京 to 'Bei Jing')
     if (preg_match('/[\\x80-\\xff]/', $text) && Transliterator::validUtf8($text)) {
         $text = Transliterator::utf8ToAscii($text);
     }
     return $text;
 }