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 <brion@pobox.com>, 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.
doc_Drupal
2016-10-29 09:34:05
Comments
Leave a Comment

Please login to continue.