More documentation!
[lhc/web/wiklou.git] / languages / classes / LanguageTr.php
1 <?php
2
3 /**
4 * Turkish (Türkçe)
5 *
6 * Turkish has two different i, one with a dot and another without a dot. They
7 * are totally different letters in this language, so we have to override the
8 * ucfirst and lcfirst methods.
9 * See http://en.wikipedia.org/wiki/Dotted_and_dotless_I
10 * and @bug 28040
11 * @ingroup Language
12 */
13 class LanguageTr extends Language {
14
15 /**
16 * @param $string string
17 * @return string
18 */
19 function ucfirst ( $string ) {
20 if ( !empty( $string ) && $string[0] == 'i' ) {
21 return 'İ' . substr( $string, 1 );
22 } else {
23 return parent::ucfirst( $string );
24 }
25 }
26
27 /**
28 * @param $string string
29 * @return mixed|string
30 */
31 function lcfirst ( $string ) {
32 if ( !empty( $string ) && $string[0] == 'I' ) {
33 return 'ı' . substr( $string, 1 );
34 } else {
35 return parent::lcfirst( $string );
36 }
37 }
38
39 /**
40 * @see bug 28040
41 *
42 * @param $string string
43 * @param $first string|bool
44 *
45 * @return string
46 */
47 function uc( $string, $first = false ) {
48 $string = preg_replace( '/i/', 'İ', $string );
49 return parent::uc( $string, $first );
50 }
51
52 /**
53 * @see bug 28040
54 *
55 * @param $string string
56 * @param $first string|bool
57 *
58 * @return string
59 */
60 function lc( $string, $first = false ) {
61 $string = preg_replace( '/I/', 'ı', $string );
62 return parent::lc( $string, $first );
63 }
64
65 }