* (bug 5432) Fix inconsistencies in cookie names when using table prefixes
[mediawiki.git] / languages / LanguageEo.php
blob20890a900c61ffcd1c9872135c483b824c888094
1 <?php
2 /** Esperanto (Esperanto)
3 * @package MediaWiki
4 * @subpackage Language
5 */
7 /** */
8 require_once('LanguageUtf8.php');
10 /* private */ $wgNamespaceNamesEo = array(
11 NS_MEDIA => 'Media',
12 NS_SPECIAL => 'Speciala',
13 NS_MAIN => '',
14 NS_TALK => 'Diskuto',
15 NS_USER => 'Vikipediisto',
16 NS_USER_TALK => 'Vikipediista_diskuto',
17 NS_PROJECT => $wgMetaNamespace, # FIXME: Generalize v-isto kaj v-io
18 NS_PROJECT_TALK => $wgMetaNamespace.'_diskuto', # FIXME
19 NS_IMAGE => 'Dosiero', #FIXME: Check the magic for Image: and Media:
20 NS_IMAGE_TALK => 'Dosiera_diskuto',
21 NS_MEDIAWIKI => 'MediaWiki',
22 NS_MEDIAWIKI_TALK => 'MediaWiki_diskuto',
23 NS_TEMPLATE => 'Ŝablono',
24 NS_TEMPLATE_TALK => 'Ŝablona_diskuto',
25 NS_HELP => 'Helpo',
26 NS_HELP_TALK => 'Helpa_diskuto',
27 NS_CATEGORY => 'Kategorio',
28 NS_CATEGORY_TALK => 'Kategoria_diskuto',
30 ) + $wgNamespaceNamesEn;
32 /* private */ $wgQuickbarSettingsEo = array(
33 'Nenia', 'Fiksiĝas maldekstre', 'Fiksiĝas dekstre', 'Ŝvebas maldekstre'
36 /* private */ $wgSkinNamesEo = array(
37 'standard' => 'Klasika',
38 'nostalgia' => 'Nostalgio',
39 'cologneblue' => 'Kolonja Bluo',
40 'mono' => 'Senkolora',
41 'monobook' => 'Librejo',
42 'chick' => 'Kokido',
43 ) + $wgSkinNamesEn;
47 # Se eble, trovu Esperantajn libroservoj traserĉeblaj laŭ ISBN
48 # $wgBookstoreListEo = ..
50 if (!$wgCachedMessageArrays) {
51 require_once('MessagesEo.php');
54 /** @package MediaWiki */
55 class LanguageEo extends LanguageUtf8 {
57 function getDefaultUserOptions () {
58 $opt = parent::getDefaultUserOptions();
59 $opt['altencoding'] = 0;
60 return $opt;
63 function getNamespaces() {
64 global $wgNamespaceNamesEo;
65 return $wgNamespaceNamesEo;
69 function getNsIndex( $text ) {
70 global $wgNamespaceNamesEo;
72 foreach ( $wgNamespaceNamesEo as $i => $n ) {
73 if ( 0 == strcasecmp( $n, $text ) ) { return $i; }
75 return false;
78 function getQuickbarSettings() {
79 global $wgQuickbarSettingsEo;
80 return $wgQuickbarSettingsEo;
83 function getSkinNames() {
84 global $wgSkinNamesEo;
85 return $wgSkinNamesEo;
88 # La dato- kaj tempo-funkciojn oni povas precizigi laŭ lingvo
89 function formatMonth( $month, $format ) {
90 return $this->getMonthAbbreviation( $month );
93 function formatDay( $day, $format ) {
94 return parent::formatDay( $day, $format ) . '.';
97 function getMessage( $key ) {
98 global $wgAllMessagesEo;
99 if(array_key_exists($key, $wgAllMessagesEo))
100 return $wgAllMessagesEo[$key];
101 else
102 return parent::getMessage($key);
105 function iconv( $in, $out, $string ) {
106 # For most languages, this is a wrapper for iconv
107 # Por multaj lingvoj, ĉi tiu nur voku la sisteman funkcion iconv()
108 # Ni ankaŭ konvertu X-sistemajn surogotajn
109 if( strcasecmp( $in, 'x' ) == 0 and strcasecmp( $out, 'utf-8' ) == 0) {
110 $xu = array (
111 'xx' => 'x' , 'xX' => 'x' ,
112 'Xx' => 'X' , 'XX' => 'X' ,
113 "Cx" => "\xc4\x88" , "CX" => "\xc4\x88" ,
114 "cx" => "\xc4\x89" , "cX" => "\xc4\x89" ,
115 "Gx" => "\xc4\x9c" , "GX" => "\xc4\x9c" ,
116 "gx" => "\xc4\x9d" , "gX" => "\xc4\x9d" ,
117 "Hx" => "\xc4\xa4" , "HX" => "\xc4\xa4" ,
118 "hx" => "\xc4\xa5" , "hX" => "\xc4\xa5" ,
119 "Jx" => "\xc4\xb4" , "JX" => "\xc4\xb4" ,
120 "jx" => "\xc4\xb5" , "jX" => "\xc4\xb5" ,
121 "Sx" => "\xc5\x9c" , "SX" => "\xc5\x9c" ,
122 "sx" => "\xc5\x9d" , "sX" => "\xc5\x9d" ,
123 "Ux" => "\xc5\xac" , "UX" => "\xc5\xac" ,
124 "ux" => "\xc5\xad" , "uX" => "\xc5\xad"
126 return preg_replace ( '/([cghjsu]x?)((?:xx)*)(?!x)/ei',
127 'strtr( "$1", $xu ) . strtr( "$2", $xu )', $string );
128 } else if( strcasecmp( $in, 'UTF-8' ) == 0 and strcasecmp( $out, 'x' ) == 0 ) {
129 $ux = array (
130 'x' => 'xx' , 'X' => 'Xx' ,
131 "\xc4\x88" => "Cx" , "\xc4\x89" => "cx" ,
132 "\xc4\x9c" => "Gx" , "\xc4\x9d" => "gx" ,
133 "\xc4\xa4" => "Hx" , "\xc4\xa5" => "hx" ,
134 "\xc4\xb4" => "Jx" , "\xc4\xb5" => "jx" ,
135 "\xc5\x9c" => "Sx" , "\xc5\x9d" => "sx" ,
136 "\xc5\xac" => "Ux" , "\xc5\xad" => "ux"
138 # Double Xs only if they follow cxapelutaj literoj.
139 return preg_replace( '/((?:[cghjsu]|\xc4[\x88\x89\x9c\x9d\xa4\xa5\xb4\xb5]'.
140 '|\xc5[\x9c\x9d\xac\xad])x*)/ei', 'strtr( "$1", $ux )', $string );
142 return iconv( $in, $out, $string );
145 function checkTitleEncoding( $s ) {
146 global $wgInputEncoding;
148 # Check for X-system backwards-compatibility URLs
149 $ishigh = preg_match( '/[\x80-\xff]/', $s);
150 $isutf = preg_match( '/^([\x00-\x7f]|[\xc0-\xdf][\x80-\xbf]|' .
151 '[\xe0-\xef][\x80-\xbf]{2}|[\xf0-\xf7][\x80-\xbf]{3})+$/', $s );
153 if($ishigh and !$isutf) {
154 # Assume Latin1
155 $s = utf8_encode( $s );
156 } else {
157 if( preg_match( '/(\xc4[\x88\x89\x9c\x9d\xa4\xa5\xb4\xb5]'.
158 '|\xc5[\x9c\x9d\xac\xad])/', $s ) )
159 return $s;
162 //if( preg_match( '/[cghjsu]x/i', $s ) )
163 // return $this->iconv( 'x', 'utf-8', $s );
164 return $s;
167 function initEncoding() {
168 global $wgEditEncoding, $wgInputEncoding, $wgOutputEncoding;
169 $wgInputEncoding = 'utf-8';
170 $wgOutputEncoding = 'utf-8';
171 $wgEditEncoding = 'x';
174 function setAltEncoding() {
175 global $wgEditEncoding, $wgInputEncoding, $wgOutputEncoding;
176 $wgInputEncoding = 'utf-8';
177 $wgOutputEncoding = 'x';
178 $wgEditEncoding = '';
181 function formatNum( $number, $year = false ) {
182 return $year ? $number : strtr($this->commafy($number), '.,', ', ' );