You are here

function hook_transliteration_overrides_alter in Drupal 9

Same name and namespace in other branches
  1. 8 core/lib/Drupal/Core/Language/language.api.php \hook_transliteration_overrides_alter()

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

1 invocation of hook_transliteration_overrides_alter()
PhpTransliteration::readLanguageOverrides in core/lib/Drupal/Core/Transliteration/PhpTransliteration.php
Overrides \Drupal\Component\Transliteration\PhpTransliteration::readLanguageOverrides().

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