wiki.techinc.nl/languages/classes/LanguageEo.php

72 lines
2.4 KiB
PHP
Raw Normal View History

2004-04-09 01:04:53 +00:00
<?php
2005-07-05 21:22:25 +00:00
/** Esperanto (Esperanto)
*
* @ingroup Language
*/
Merged localisation-work branch: * Made lines from initialiseMessages() appear as list items during installation * Moved the bulk of the localisation data from the Language*.php files to the Messages*.php files. Deleted most of the Languages*.php files. * Introduced "stub global" framework to provide deferred initialisation of core modules. * Removed placeholder values for $wgTitle and $wgArticle, these variables will now be null during the initialisation process, until they are set by index.php or another entry point. * Added DBA cache type, for BDB-style caches. * Removed custom date format functions, replacing them with a format string in the style of PHP's date(). Used string identifiers instead of integer identifiers, in both the language files and user preferences. Migration should be transparent in most cases. * Simplified the initialisation API for LoadBalancer objects. * Removed the broken altencoding feature. * Moved default user options and toggles from Language to User. Language objects are still able to define default preference overrides and extra user toggles, via a slightly different interface. * Don't include the date option in the parser cache rendering hash unless $wgUseDynamicDates is enabled. * Merged LanguageUtf8 with Language. Removed LanguageUtf8.php. * Removed inclusion of language files from the bottom of Language.php. This is now consistently done from Language::factory(). * Add the name of the executing maintenance script to the debug log. Start the profiler during maintenance scripts. * Added "serialized" directory, for storing precompiled data in serialized form.
2006-07-26 07:15:39 +00:00
class LanguageEo extends Language {
2003-04-14 23:10:40 +00:00
function iconv( $in, $out, $string ) {
# Por multaj lingvoj, ĉi tiu nur voku la sisteman funkcion iconv()
# Ni ankaŭ konvertu X-sistemajn surogotajn
2005-07-06 20:04:05 +00:00
if( strcasecmp( $in, 'x' ) == 0 and strcasecmp( $out, 'utf-8' ) == 0) {
2003-04-14 23:10:40 +00:00
$xu = array (
2005-07-06 20:04:05 +00:00
'xx' => 'x' , 'xX' => 'x' ,
'Xx' => 'X' , 'XX' => 'X' ,
2003-04-14 23:10:40 +00:00
"Cx" => "\xc4\x88" , "CX" => "\xc4\x88" ,
"cx" => "\xc4\x89" , "cX" => "\xc4\x89" ,
"Gx" => "\xc4\x9c" , "GX" => "\xc4\x9c" ,
"gx" => "\xc4\x9d" , "gX" => "\xc4\x9d" ,
"Hx" => "\xc4\xa4" , "HX" => "\xc4\xa4" ,
"hx" => "\xc4\xa5" , "hX" => "\xc4\xa5" ,
"Jx" => "\xc4\xb4" , "JX" => "\xc4\xb4" ,
"jx" => "\xc4\xb5" , "jX" => "\xc4\xb5" ,
"Sx" => "\xc5\x9c" , "SX" => "\xc5\x9c" ,
"sx" => "\xc5\x9d" , "sX" => "\xc5\x9d" ,
"Ux" => "\xc5\xac" , "UX" => "\xc5\xac" ,
"ux" => "\xc5\xad" , "uX" => "\xc5\xad"
) ;
return preg_replace ( '/([cghjsu]x?)((?:xx)*)(?!x)/ei',
'strtr( "$1", $xu ) . strtr( "$2", $xu )', $string );
2005-07-06 20:04:05 +00:00
} else if( strcasecmp( $in, 'UTF-8' ) == 0 and strcasecmp( $out, 'x' ) == 0 ) {
2003-04-14 23:10:40 +00:00
$ux = array (
2005-07-06 20:04:05 +00:00
'x' => 'xx' , 'X' => 'Xx' ,
2003-04-14 23:10:40 +00:00
"\xc4\x88" => "Cx" , "\xc4\x89" => "cx" ,
"\xc4\x9c" => "Gx" , "\xc4\x9d" => "gx" ,
"\xc4\xa4" => "Hx" , "\xc4\xa5" => "hx" ,
"\xc4\xb4" => "Jx" , "\xc4\xb5" => "jx" ,
"\xc5\x9c" => "Sx" , "\xc5\x9d" => "sx" ,
"\xc5\xac" => "Ux" , "\xc5\xad" => "ux"
) ;
# Double Xs only if they follow cxapelutaj literoj.
return preg_replace( '/((?:[cghjsu]|\xc4[\x88\x89\x9c\x9d\xa4\xa5\xb4\xb5]'.
'|\xc5[\x9c\x9d\xac\xad])x*)/ei', 'strtr( "$1", $ux )', $string );
}
return parent::iconv( $in, $out, $string );
2003-04-14 23:10:40 +00:00
}
function checkTitleEncoding( $s ) {
# Check for X-system backwards-compatibility URLs
2003-04-14 23:10:40 +00:00
$ishigh = preg_match( '/[\x80-\xff]/', $s);
$isutf = preg_match( '/^([\x00-\x7f]|[\xc0-\xdf][\x80-\xbf]|' .
'[\xe0-\xef][\x80-\xbf]{2}|[\xf0-\xf7][\x80-\xbf]{3})+$/', $s );
2003-04-14 23:10:40 +00:00
if($ishigh and !$isutf) {
# Assume Latin1
$s = utf8_encode( $s );
} else {
if( preg_match( '/(\xc4[\x88\x89\x9c\x9d\xa4\xa5\xb4\xb5]'.
'|\xc5[\x9c\x9d\xac\xad])/', $s ) )
return $s;
}
//if( preg_match( '/[cghjsu]x/i', $s ) )
// return $this->iconv( 'x', 'utf-8', $s );
2003-04-14 23:10:40 +00:00
return $s;
}
function initEncoding() {
Merged localisation-work branch: * Made lines from initialiseMessages() appear as list items during installation * Moved the bulk of the localisation data from the Language*.php files to the Messages*.php files. Deleted most of the Languages*.php files. * Introduced "stub global" framework to provide deferred initialisation of core modules. * Removed placeholder values for $wgTitle and $wgArticle, these variables will now be null during the initialisation process, until they are set by index.php or another entry point. * Added DBA cache type, for BDB-style caches. * Removed custom date format functions, replacing them with a format string in the style of PHP's date(). Used string identifiers instead of integer identifiers, in both the language files and user preferences. Migration should be transparent in most cases. * Simplified the initialisation API for LoadBalancer objects. * Removed the broken altencoding feature. * Moved default user options and toggles from Language to User. Language objects are still able to define default preference overrides and extra user toggles, via a slightly different interface. * Don't include the date option in the parser cache rendering hash unless $wgUseDynamicDates is enabled. * Merged LanguageUtf8 with Language. Removed LanguageUtf8.php. * Removed inclusion of language files from the bottom of Language.php. This is now consistently done from Language::factory(). * Add the name of the executing maintenance script to the debug log. Start the profiler during maintenance scripts. * Added "serialized" directory, for storing precompiled data in serialized form.
2006-07-26 07:15:39 +00:00
global $wgEditEncoding;
2005-07-06 20:04:05 +00:00
$wgEditEncoding = 'x';
}
2003-04-14 23:10:40 +00:00
}