-
Notifications
You must be signed in to change notification settings - Fork 2
/
Copy pathTransliterationInterface.php
50 lines (45 loc) · 1.73 KB
/
TransliterationInterface.php
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
<?php
namespace Drupal\Component\Transliteration;
/**
* Defines an interface for classes providing transliteration.
*
* @ingroup transliteration
*/
interface TransliterationInterface {
/**
* Removes diacritics (accents) from certain letters.
*
* This only applies to certain letters: Accented Latin characters like
* a-with-acute-accent, in the UTF-8 character range of 0xE0 to 0xE6 and
* 01CD to 024F. Replacements that would result in the string changing length
* are excluded, as well as characters that are not accented US-ASCII letters.
*
* @param string $string
* The string holding diacritics.
*
* @return string
* $string with accented letters replaced by their unaccented equivalents.
*/
public function removeDiacritics($string);
/**
* Transliterates text from Unicode to US-ASCII.
*
* @param string $string
* The string to transliterate.
* @param string $langcode
* (optional) The language code of the language the string is in. Defaults
* to 'en' if not provided. Warning: this can be unfiltered user input.
* @param string $unknown_character
* (optional) The character to substitute for characters in $string without
* transliterated equivalents. Defaults to '?'.
* @param int $max_length
* (optional) If provided, return at most this many characters, ensuring
* that the transliteration does not split in the middle of an input
* character's transliteration.
*
* @return string
* $string with non-US-ASCII characters transliterated to US-ASCII
* characters, and unknown characters replaced with $unknown_character.
*/
public function transliterate($string, $langcode = 'en', $unknown_character = '?', $max_length = NULL);
}