wiki.techinc.nl/languages/classes/LanguageTr.php
Antoine Musso 97783870bc Makes LanguageTr uc & lc match parent declaration
Methods were introduced in r84057 which, unfortunatly was tested with
PHP errors disabled :\

Additionally add tests for the full Turkish alphabet based on an article
from Wikipedia http://en.wikipedia.org/wiki/Turkish_alphabet
2011-03-16 07:38:15 +00:00

43 lines
1 KiB
PHP
Raw Blame History

This file contains ambiguous Unicode characters

This file contains Unicode characters that might be confused with other characters. If you think that this is intentional, you can safely ignore this warning. Use the Escape button to reveal them.

<?php
/**
* Turkish (Türkçe)
*
* Turkish has two different i, one with a dot and another without a dot. They
* are totally different letters in this language, so we have to override the
* ucfirst and lcfirst methods.
* See http://en.wikipedia.org/wiki/Dotted_and_dotless_I
* and @bug 28040
* @ingroup Language
*/
class LanguageTr extends Language {
function ucfirst ( $string ) {
if ( !empty( $string ) && $string[0] == 'i' ) {
return 'İ' . substr( $string, 1 );
} else {
return parent::ucfirst( $string );
}
}
function lcfirst ( $string ) {
if ( !empty( $string ) && $string[0] == 'I' ) {
return 'ı' . substr( $string, 1 );
} else {
return parent::lcfirst( $string );
}
}
/** @see bug 28040 */
function uc( $string, $first = false ) {
$string = preg_replace( '/i/', 'İ', $string );
return parent::uc( $string, $first );
}
/** @see bug 28040 */
function lc( $string, $first = false ) {
$string = preg_replace( '/I/', 'ı', $string );
return parent::lc( $string, $first );
}
}