W3cubDocs

/Drupal 8

class PhpTransliteration

Implements transliteration without using the PECL extensions.

Transliterations are done character-by-character, by looking up non-US-ASCII characters in a transliteration database.

The database comes from two types of files, both of which are searched for in the PhpTransliteration::$dataDirectory directory. First, language-specific overrides are searched (see PhpTransliteration::readLanguageOverrides()). If there is no language-specific override for a character, the generic transliteration character tables are searched (see PhpTransliteration::readGenericData()). If looking up the character in the generic table results in a NULL value, or an illegal character is encountered, then a substitute character is returned.

Some parts of this code were derived from the MediaWiki project's UtfNormal class, Copyright © 2004 Brion Vibber <[email protected]>, http://www.mediawiki.org/

Hierarchy

File

core/lib/Drupal/Component/Transliteration/PhpTransliteration.php, line 24

Namespace

Drupal\Component\Transliteration

Members

Name Modifiers Type Description
PhpTransliteration::$dataDirectory protected property Directory where data for transliteration resides.
PhpTransliteration::$genericMap protected property Non-language-specific transliteration tables.
PhpTransliteration::$languageOverrides protected property Associative array of language-specific character transliteration tables.
PhpTransliteration::lookupReplacement protected function Look up the generic replacement for a UTF-8 character code.
PhpTransliteration::ordUTF8 protected static function Finds the character code for a UTF-8 character: like ord() but for UTF-8.
PhpTransliteration::readGenericData protected function Reads in generic transliteration data for a bank of characters.
PhpTransliteration::readLanguageOverrides protected function Reads in language overrides for a language code.
PhpTransliteration::removeDiacritics public function Removes diacritics (accents) from certain letters. Overrides TransliterationInterface::removeDiacritics
PhpTransliteration::replace protected function Replaces a single Unicode character using the transliteration database.
PhpTransliteration::transliterate public function Transliterates text from Unicode to US-ASCII. Overrides TransliterationInterface::transliterate
PhpTransliteration::__construct public function Constructs a transliteration object.

© 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!Component!Transliteration!PhpTransliteration.php/class/PhpTransliteration/8.1.x