MediaWiki  REL1_22
LanguageEo.php
Go to the documentation of this file.
00001 <?php
00030 class LanguageEo extends Language {
00062     function iconv( $in, $out, $string ) {
00063         if ( strcasecmp( $in, 'x' ) == 0 && strcasecmp( $out, 'utf-8' ) == 0 ) {
00064             return preg_replace_callback (
00065                 '/([cghjsu]x?)((?:xx)*)(?!x)/i',
00066                 array( $this, 'strrtxuCallback' ), $string );
00067         } elseif ( strcasecmp( $in, 'UTF-8' ) == 0 && strcasecmp( $out, 'x' ) == 0 ) {
00068             # Double Xs only if they follow cxapelutaj literoj.
00069             return preg_replace_callback(
00070                 '/((?:[cghjsu]|\xc4[\x88\x89\x9c\x9d\xa4\xa5\xb4\xb5]|\xc5[\x9c\x9d\xac\xad])x*)/i',
00071                 array( $this, 'strrtuxCallback' ), $string );
00072         }
00073         return parent::iconv( $in, $out, $string );
00074     }
00075 
00080     function strrtuxCallback( $matches ) {
00081         static $ux = array(
00082             'x' => 'xx', 'X' => 'Xx',
00083             "\xc4\x88" => "Cx", "\xc4\x89" => "cx",
00084             "\xc4\x9c" => "Gx", "\xc4\x9d" => "gx",
00085             "\xc4\xa4" => "Hx", "\xc4\xa5" => "hx",
00086             "\xc4\xb4" => "Jx", "\xc4\xb5" => "jx",
00087             "\xc5\x9c" => "Sx", "\xc5\x9d" => "sx",
00088             "\xc5\xac" => "Ux", "\xc5\xad" => "ux",
00089         );
00090         return strtr( $matches[1], $ux );
00091     }
00092 
00097     function strrtxuCallback( $matches ) {
00098         static $xu = array(
00099             'xx' => 'x', 'xX' => 'x',
00100             'Xx' => 'X', 'XX' => 'X',
00101             "Cx" => "\xc4\x88", "CX" => "\xc4\x88",
00102             "cx" => "\xc4\x89", "cX" => "\xc4\x89",
00103             "Gx" => "\xc4\x9c", "GX" => "\xc4\x9c",
00104             "gx" => "\xc4\x9d", "gX" => "\xc4\x9d",
00105             "Hx" => "\xc4\xa4", "HX" => "\xc4\xa4",
00106             "hx" => "\xc4\xa5", "hX" => "\xc4\xa5",
00107             "Jx" => "\xc4\xb4", "JX" => "\xc4\xb4",
00108             "jx" => "\xc4\xb5", "jX" => "\xc4\xb5",
00109             "Sx" => "\xc5\x9c", "SX" => "\xc5\x9c",
00110             "sx" => "\xc5\x9d", "sX" => "\xc5\x9d",
00111             "Ux" => "\xc5\xac", "UX" => "\xc5\xac",
00112             "ux" => "\xc5\xad", "uX" => "\xc5\xad",
00113         );
00114         return strtr( $matches[1], $xu ) . strtr( $matches[2], $xu );
00115     }
00116 
00117     function initEncoding() {
00118         global $wgEditEncoding;
00119         $wgEditEncoding = 'x';
00120     }
00121 }