W3cubDocs

/Drupal 8

function 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';
  }
}

© 2001–2016 by the original authors
Licensed under the GNU General Public License, version 2 and later.
Drupal is a registered trademark of Dries Buytaert.
https://api.drupal.org/api/drupal/core!lib!Drupal!Core!Language!language.api.php/function/hook_transliteration_overrides_alter/8.1.x