2004-04-09 01:04:53 +00:00
|
|
|
<?php
|
2012-06-06 20:42:13 +00:00
|
|
|
/**
|
|
|
|
|
* Esperanto (Esperanto) specific code.
|
|
|
|
|
*
|
|
|
|
|
* This program is free software; you can redistribute it and/or modify
|
|
|
|
|
* it under the terms of the GNU General Public License as published by
|
|
|
|
|
* the Free Software Foundation; either version 2 of the License, or
|
|
|
|
|
* (at your option) any later version.
|
|
|
|
|
*
|
|
|
|
|
* This program is distributed in the hope that it will be useful,
|
|
|
|
|
* but WITHOUT ANY WARRANTY; without even the implied warranty of
|
|
|
|
|
* MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
|
|
|
|
|
* GNU General Public License for more details.
|
|
|
|
|
*
|
|
|
|
|
* You should have received a copy of the GNU General Public License along
|
|
|
|
|
* with this program; if not, write to the Free Software Foundation, Inc.,
|
|
|
|
|
* 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301, USA.
|
|
|
|
|
* http://www.gnu.org/copyleft/gpl.html
|
|
|
|
|
*
|
|
|
|
|
* @file
|
|
|
|
|
* @author Brion Vibber <brion@pobox.com>
|
|
|
|
|
* @ingroup Language
|
|
|
|
|
*/
|
2005-07-05 21:22:25 +00:00
|
|
|
|
2012-06-06 20:42:13 +00:00
|
|
|
/**
|
|
|
|
|
* Esperanto (Esperanto)
|
WARNING: HUGE COMMIT
Doxygen documentation update:
* Changed alls @addtogroup to @ingroup. @addtogroup adds the comment to the group description, but doesn't add the file, class, function, ... to the group like @ingroup does. See for example http://svn.wikimedia.org/doc/group__SpecialPage.html where it's impossible to see related files, classes, ... that should belong to that group.
* Added @file to file description, it seems that it should be explicitely decalred for file descriptions, otherwise doxygen will think that the comment document the first class, variabled, function, ... that is in that file.
* Removed some empty comments
* Removed some ?>
Added following groups:
* ExternalStorage
* JobQueue
* MaintenanceLanguage
One more thing: there are still a lot of warnings when generating the doc.
2008-05-20 17:13:28 +00:00
|
|
|
*
|
|
|
|
|
* @ingroup Language
|
|
|
|
|
*/
|
2006-07-26 07:15:39 +00:00
|
|
|
class LanguageEo extends Language {
|
2010-08-13 23:37:45 +00:00
|
|
|
/**
|
|
|
|
|
* Wrapper for charset conversions.
|
|
|
|
|
*
|
|
|
|
|
* In most languages, this calls through to standard system iconv(), but
|
|
|
|
|
* for Esperanto we're also adding a special pseudo-charset to convert
|
|
|
|
|
* accented characters to/from the ASCII-friendly "X" surrogate coding:
|
|
|
|
|
*
|
|
|
|
|
* cx = ĉ cxx = cx
|
|
|
|
|
* gx = ĝ gxx = gx
|
|
|
|
|
* hx = ĥ hxx = hx
|
|
|
|
|
* jx = ĵ jxx = jx
|
|
|
|
|
* sx = ŝ sxx = sx
|
|
|
|
|
* ux = ŭ uxx = ux
|
|
|
|
|
* xx = x
|
|
|
|
|
*
|
|
|
|
|
* http://en.wikipedia.org/wiki/Esperanto_orthography#X-system
|
|
|
|
|
* http://eo.wikipedia.org/wiki/X-sistemo
|
|
|
|
|
*
|
|
|
|
|
* X-conversion is applied, in either direction, between "utf-8" and "x" charsets;
|
|
|
|
|
* this comes into effect when input is run through $wgRequest->getText() and the
|
|
|
|
|
* $wgEditEncoding is set to 'x'.
|
|
|
|
|
*
|
|
|
|
|
* In the long run, this should be moved out of here and into the client-side
|
|
|
|
|
* editor behavior; the original server-side translation system dates to 2002-2003
|
2010-08-13 23:39:27 +00:00
|
|
|
* when many browsers with really bad Unicode support were still in use.
|
2010-08-13 23:37:45 +00:00
|
|
|
*
|
|
|
|
|
* @param string $in input character set
|
|
|
|
|
* @param string $out output character set
|
|
|
|
|
* @param string $string text to be converted
|
|
|
|
|
* @return string
|
|
|
|
|
*/
|
2003-04-14 23:10:40 +00:00
|
|
|
function iconv( $in, $out, $string ) {
|
2010-08-13 09:46:08 +00:00
|
|
|
if ( strcasecmp( $in, 'x' ) == 0 && strcasecmp( $out, 'utf-8' ) == 0 ) {
|
|
|
|
|
return preg_replace_callback (
|
|
|
|
|
'/([cghjsu]x?)((?:xx)*)(?!x)/i',
|
2012-10-26 16:18:59 +00:00
|
|
|
array( $this, 'strrtxuCallback' ), $string );
|
2011-06-17 16:05:35 +00:00
|
|
|
} elseif ( strcasecmp( $in, 'UTF-8' ) == 0 && strcasecmp( $out, 'x' ) == 0 ) {
|
2003-04-14 23:10:40 +00:00
|
|
|
# Double Xs only if they follow cxapelutaj literoj.
|
2010-08-13 09:46:08 +00:00
|
|
|
return preg_replace_callback(
|
2011-02-11 10:27:07 +00:00
|
|
|
'/((?:[cghjsu]|\xc4[\x88\x89\x9c\x9d\xa4\xa5\xb4\xb5]|\xc5[\x9c\x9d\xac\xad])x*)/i',
|
|
|
|
|
array( $this, 'strrtuxCallback' ), $string );
|
2003-04-14 23:10:40 +00:00
|
|
|
}
|
2009-07-07 09:56:53 +00:00
|
|
|
return parent::iconv( $in, $out, $string );
|
2003-04-14 23:10:40 +00:00
|
|
|
}
|
|
|
|
|
|
2011-05-29 16:32:05 +00:00
|
|
|
/**
|
|
|
|
|
* @param $matches array
|
|
|
|
|
* @return string
|
|
|
|
|
*/
|
2010-08-13 09:46:08 +00:00
|
|
|
function strrtuxCallback( $matches ) {
|
2013-04-14 19:57:46 +00:00
|
|
|
static $ux = array(
|
2013-04-17 19:10:02 +00:00
|
|
|
'x' => 'xx', 'X' => 'Xx',
|
|
|
|
|
"\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",
|
2010-08-13 09:46:08 +00:00
|
|
|
);
|
|
|
|
|
return strtr( $matches[1], $ux );
|
|
|
|
|
}
|
|
|
|
|
|
2011-05-29 16:32:05 +00:00
|
|
|
/**
|
|
|
|
|
* @param $matches array
|
|
|
|
|
* @return string
|
|
|
|
|
*/
|
2010-08-13 09:46:08 +00:00
|
|
|
function strrtxuCallback( $matches ) {
|
2013-04-14 19:57:46 +00:00
|
|
|
static $xu = array(
|
2013-04-17 19:10:02 +00:00
|
|
|
'xx' => 'x', 'xX' => 'x',
|
|
|
|
|
'Xx' => 'X', 'XX' => 'X',
|
|
|
|
|
"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",
|
2010-08-13 09:46:08 +00:00
|
|
|
);
|
|
|
|
|
return strtr( $matches[1], $xu ) . strtr( $matches[2], $xu );
|
|
|
|
|
}
|
|
|
|
|
|
2005-03-14 02:00:53 +00:00
|
|
|
function initEncoding() {
|
2006-07-26 07:15:39 +00:00
|
|
|
global $wgEditEncoding;
|
2005-07-06 20:04:05 +00:00
|
|
|
$wgEditEncoding = 'x';
|
2005-03-14 02:00:53 +00:00
|
|
|
}
|
2003-04-14 23:10:40 +00:00
|
|
|
}
|