comparison core/lib/Drupal/Component/Transliteration/TransliterationInterface.php @ 0:4c8ae668cc8c

Initial import (non-working)
author Chris Cannam
date Wed, 29 Nov 2017 16:09:58 +0000
parents
children
comparison
equal deleted inserted replaced
-1:000000000000 0:4c8ae668cc8c
1 <?php
2
3 namespace Drupal\Component\Transliteration;
4
5 /**
6 * Defines an interface for classes providing transliteration.
7 *
8 * @ingroup transliteration
9 */
10 interface TransliterationInterface {
11
12 /**
13 * Removes diacritics (accents) from certain letters.
14 *
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.
19 *
20 * @param string $string
21 * The string holding diacritics.
22 *
23 * @return string
24 * $string with accented letters replaced by their unaccented equivalents.
25 */
26 public function removeDiacritics($string);
27
28 /**
29 * Transliterates text from Unicode to US-ASCII.
30 *
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.
43 *
44 * @return string
45 * $string with non-US-ASCII characters transliterated to US-ASCII
46 * characters, and unknown characters replaced with $unknown_character.
47 */
48 public function transliterate($string, $langcode = 'en', $unknown_character = '?', $max_length = NULL);
49
50 }