bug 28040 Turkish: properly handle dotted and dotless i
[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 function ucfirst ( $string ) {
16 if ( !empty( $string ) && $string[0] == 'i' ) {
17 return 'İ' . substr( $string, 1 );
18 } else {
19 return parent::ucfirst( $string );
20 }
21 }
22
23 function lcfirst ( $string ) {
24 if ( !empty( $string ) && $string[0] == 'I' ) {
25 return 'ı' . substr( $string, 1 );
26 } else {
27 return parent::lcfirst( $string );
28 }
29 }
30
31 /** @see bug 28040 */
32 function uc( $string ) {
33 $string = preg_replace( '/i/', 'İ', $string );
34 return parent::uc( $string );
35 }
36
37 /** @see bug 28040 */
38 function lc( $string ) {
39 $string = preg_replace( '/I/', 'ı', $string );
40 return parent::lc( $string );
41 }
42
43 }