function PhpTransliteration::readLanguageOverrides
Same name in this branch
- 9 core/lib/Drupal/Core/Transliteration/PhpTransliteration.php \Drupal\Core\Transliteration\PhpTransliteration::readLanguageOverrides()
Same name in other branches
- 8.9.x core/lib/Drupal/Core/Transliteration/PhpTransliteration.php \Drupal\Core\Transliteration\PhpTransliteration::readLanguageOverrides()
- 8.9.x core/lib/Drupal/Component/Transliteration/PhpTransliteration.php \Drupal\Component\Transliteration\PhpTransliteration::readLanguageOverrides()
- 10 core/lib/Drupal/Core/Transliteration/PhpTransliteration.php \Drupal\Core\Transliteration\PhpTransliteration::readLanguageOverrides()
- 10 core/lib/Drupal/Component/Transliteration/PhpTransliteration.php \Drupal\Component\Transliteration\PhpTransliteration::readLanguageOverrides()
- 11.x core/lib/Drupal/Core/Transliteration/PhpTransliteration.php \Drupal\Core\Transliteration\PhpTransliteration::readLanguageOverrides()
- 11.x core/lib/Drupal/Component/Transliteration/PhpTransliteration.php \Drupal\Component\Transliteration\PhpTransliteration::readLanguageOverrides()
Reads in language overrides for a language code.
The data is read from files named "$langcode.php" in PhpTransliteration::$dataDirectory. These files should set up an array variable $overrides with an element whose key is $langcode and whose value is an array whose keys are character codes, and whose values are their transliterations in this language. The character codes can be for any valid Unicode character, independent of the number of bytes.
Parameters
$langcode: Code for the language to read.
2 calls to PhpTransliteration::readLanguageOverrides()
- PhpTransliteration::readLanguageOverrides in core/
lib/ Drupal/ Core/ Transliteration/ PhpTransliteration.php - Overrides \Drupal\Component\Transliteration\PhpTransliteration::readLanguageOverrides().
- PhpTransliteration::replace in core/
lib/ Drupal/ Component/ Transliteration/ PhpTransliteration.php - Replaces a single Unicode character using the transliteration database.
1 method overrides PhpTransliteration::readLanguageOverrides()
- PhpTransliteration::readLanguageOverrides in core/
lib/ Drupal/ Core/ Transliteration/ PhpTransliteration.php - Overrides \Drupal\Component\Transliteration\PhpTransliteration::readLanguageOverrides().
File
-
core/
lib/ Drupal/ Component/ Transliteration/ PhpTransliteration.php, line 281
Class
- PhpTransliteration
- Implements transliteration without using the PECL extensions.
Namespace
Drupal\Component\TransliterationCode
protected function readLanguageOverrides($langcode) {
// Figure out the file name to use by sanitizing the language code,
// just in case.
$file = $this->dataDirectory . '/' . preg_replace('/[^a-zA-Z\\-]/', '', $langcode) . '.php';
// Read in this file, which should set up a variable called $overrides,
// which will be local to this function.
if (is_file($file)) {
include $file;
}
if (!isset($overrides) || !is_array($overrides)) {
$overrides = [
$langcode => [],
];
}
$this->languageOverrides[$langcode] = $overrides[$langcode];
}
Buggy or inaccurate documentation? Please file an issue. Need support? Need help programming? Connect with the Drupal community.