3 namespace Drupal\Component\Transliteration;
6 * Defines an interface for classes providing transliteration.
8 * @ingroup transliteration
10 interface TransliterationInterface {
13 * Removes diacritics (accents) from certain letters.
15 * This only applies to certain letters: Accented Latin characters like
16 * a-with-acute-accent, in the UTF-8 character range of 0xE0 to 0xE6 and
17 * 01CD to 024F. Replacements that would result in the string changing length
18 * are excluded, as well as characters that are not accented US-ASCII letters.
20 * @param string $string
21 * The string holding diacritics.
24 * $string with accented letters replaced by their unaccented equivalents.
26 public function removeDiacritics($string);
29 * Transliterates text from Unicode to US-ASCII.
31 * @param string $string
32 * The string to transliterate.
33 * @param string $langcode
34 * (optional) The language code of the language the string is in. Defaults
35 * to 'en' if not provided. Warning: this can be unfiltered user input.
36 * @param string $unknown_character
37 * (optional) The character to substitute for characters in $string without
38 * transliterated equivalents. Defaults to '?'.
39 * @param int $max_length
40 * (optional) If provided, return at most this many characters, ensuring
41 * that the transliteration does not split in the middle of an input
42 * character's transliteration.
45 * $string with non-US-ASCII characters transliterated to US-ASCII
46 * characters, and unknown characters replaced with $unknown_character.
48 public function transliterate($string, $langcode = 'en', $unknown_character = '?', $max_length = NULL);