readLanguageOverrides example

$this->moduleHandler = $module_handler;
  }

  /** * Overrides \Drupal\Component\Transliteration\PhpTransliteration::readLanguageOverrides(). * * Allows modules to alter the language-specific $overrides array by invoking * hook_transliteration_overrides_alter(). */
  protected function readLanguageOverrides($langcode) {
    parent::readLanguageOverrides($langcode);

    // Let modules alter the language-specific overrides.     $this->moduleHandler->alter('transliteration_overrides', $this->languageOverrides[$langcode]$langcode);
  }

}

  protected function replace($code$langcode$unknown_character) {
    if ($code < 0x80) {
      // Already lower ASCII.       return chr($code);
    }

    // See if there is a language-specific override for this character.     if (!isset($this->languageOverrides[$langcode])) {
      $this->readLanguageOverrides($langcode);
    }
    if (isset($this->languageOverrides[$langcode][$code])) {
      return $this->languageOverrides[$langcode][$code];
    }

    return $this->lookupReplacement($code$unknown_character);
  }

  /** * Look up the generic replacement for a UTF-8 character code. * * @param $code * The UTF-8 character code. * @param string $unknown_character * (optional) The character to substitute for characters without entries in * the replacement tables. * * @return string * US-ASCII replacement characters. If it has a mapping, it is returned; * otherwise, $unknown_character is returned. The replacement can contain * multiple characters. */
Home | Imprint | This part of the site doesn't use cookies.