(bug 5609) More improvements to German localisation files
[lhc/web/wiklou.git] / languages / LanguageEo.php
1 <?php
2 /** Esperanto (Esperanto)
3 * @package MediaWiki
4 * @subpackage Language
5 */
6
7 /** */
8 require_once('LanguageUtf8.php');
9
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',
29
30 ) + $wgNamespaceNamesEn;
31
32 /* private */ $wgQuickbarSettingsEo = array(
33 'Nenia', 'Fiksiĝas maldekstre', 'Fiksiĝas dekstre', 'Ŝvebas maldekstre'
34 );
35
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;
44
45
46
47 # Se eble, trovu Esperantajn libroservoj traserĉeblaj laŭ ISBN
48 # $wgBookstoreListEo = ..
49
50 if (!$wgCachedMessageArrays) {
51 require_once('MessagesEo.php');
52 }
53
54 /** @package MediaWiki */
55 class LanguageEo extends LanguageUtf8 {
56
57 function getDefaultUserOptions () {
58 $opt = parent::getDefaultUserOptions();
59 $opt['altencoding'] = 0;
60 return $opt;
61 }
62
63 function getNamespaces() {
64 global $wgNamespaceNamesEo;
65 return $wgNamespaceNamesEo;
66 }
67
68
69 function getNsIndex( $text ) {
70 global $wgNamespaceNamesEo;
71
72 foreach ( $wgNamespaceNamesEo as $i => $n ) {
73 if ( 0 == strcasecmp( $n, $text ) ) { return $i; }
74 }
75 return false;
76 }
77
78 function getQuickbarSettings() {
79 global $wgQuickbarSettingsEo;
80 return $wgQuickbarSettingsEo;
81 }
82
83 function getSkinNames() {
84 global $wgSkinNamesEo;
85 return $wgSkinNamesEo;
86 }
87
88 # La dato- kaj tempo-funkciojn oni povas precizigi laŭ lingvo
89 function formatMonth( $month, $format ) {
90 return $this->getMonthAbbreviation( $month );
91 }
92
93 function formatDay( $day, $format ) {
94 return parent::formatDay( $day, $format ) . '.';
95 }
96
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);
103 }
104
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"
125 ) ;
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"
137 ) ;
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 );
141 }
142 return iconv( $in, $out, $string );
143 }
144
145 function checkTitleEncoding( $s ) {
146 global $wgInputEncoding;
147
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 );
152
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;
160 }
161
162 //if( preg_match( '/[cghjsu]x/i', $s ) )
163 // return $this->iconv( 'x', 'utf-8', $s );
164 return $s;
165 }
166
167 function initEncoding() {
168 global $wgEditEncoding, $wgInputEncoding, $wgOutputEncoding;
169 $wgInputEncoding = 'utf-8';
170 $wgOutputEncoding = 'utf-8';
171 $wgEditEncoding = 'x';
172 }
173
174 function setAltEncoding() {
175 global $wgEditEncoding, $wgInputEncoding, $wgOutputEncoding;
176 $wgInputEncoding = 'utf-8';
177 $wgOutputEncoding = 'x';
178 $wgEditEncoding = '';
179 }
180
181 function formatNum( $number, $year = false ) {
182 return $year ? $number : strtr($this->commafy($number), '.,', ', ' );
183 }
184 }
185
186 ?>