hook_transliteration_overrides_alter

hook_transliteration_overrides_alter(&$overrides, $langcode)

Provide language-specific overrides for transliteration.

If the overrides you want to provide are standard for your language, consider providing a patch for the Drupal Core transliteration system instead of using this hook. This hook can be used temporarily until Drupal Core's transliteration tables are fixed, or for sites that want to use a non-standard transliteration system.

Parameters

array $overrides: Associative array of language-specific overrides whose keys are integer Unicode character codes, and whose values are the transliterations of those characters in the given language, to override default transliterations.

string $langcode: The code for the language that is being transliterated.

Related topics

Hooks
Define functions that alter the behavior of Drupal core.
Transliteration
Transliterate from Unicode to US-ASCII

File

core/lib/Drupal/Core/Language/language.api.php, line 250
Hooks provided by the base system for language support.

Code

function hook_transliteration_overrides_alter(&$overrides, $langcode) {
  // Provide special overrides for German for a custom site.
  if ($langcode == 'de') {
    // The core-provided transliteration of Ä is Ae, but we want just A.
    $overrides[0xC4] = 'A';
  }
}
doc_Drupal
2016-10-29 09:18:34
Comments
Leave a Comment

Please login to continue.