Update, and making 'ipboptions' compatible to English.
[lhc/web/wiklou.git] / languages / LanguageEo.php
1 <?php
2 /** Esperanto (Esperanto)
3 * @package MediaWiki
4 * @subpackage Language
5 */
6
7 require_once('LanguageUtf8.php');
8
9 if (!$wgCachedMessageArrays) {
10 require_once('MessagesEo.php');
11 }
12
13 class LanguageEo extends LanguageUtf8 {
14 private $mMessagesEo, $mNamespaceNamesEo = null;
15
16 private $mQuickbarSettingsEo = array(
17 'Nenia', 'Fiksiĝas maldekstre', 'Fiksiĝas dekstre', 'Ŝvebas maldekstre'
18 );
19
20 private $mSkinNamesEo = array(
21 'standard' => 'Klasika',
22 'nostalgia' => 'Nostalgio',
23 'cologneblue' => 'Kolonja Bluo',
24 'mono' => 'Senkolora',
25 'monobook' => 'Librejo',
26 'chick' => 'Kokido',
27 );
28
29 function __construct() {
30 parent::__construct();
31
32 global $wgAllMessagesEo;
33 $this->mMessagesEo =& $wgAllMessagesEo;
34
35 global $wgMetaNamespace, $wgMetaNamespaceTalk;
36 $this->mNamespaceNamesEo = array(
37 NS_MEDIA => 'Media',
38 NS_SPECIAL => 'Speciala',
39 NS_MAIN => '',
40 NS_TALK => 'Diskuto',
41 NS_USER => 'Vikipediisto', # FIXME: Generalize v-isto kaj v-io
42 NS_USER_TALK => 'Vikipediista_diskuto',
43 NS_PROJECT => $wgMetaNamespace,
44 NS_PROJECT_TALK => ( $wgMetaNamespaceTalk ? $wgMetaNamespaceTalk : $wgMetaNamespace.'_diskuto' ),
45 NS_IMAGE => 'Dosiero', #FIXME: Check the magic for Image: and Media:
46 NS_IMAGE_TALK => 'Dosiera_diskuto',
47 NS_MEDIAWIKI => 'MediaWiki',
48 NS_MEDIAWIKI_TALK => 'MediaWiki_diskuto',
49 NS_TEMPLATE => 'Ŝablono',
50 NS_TEMPLATE_TALK => 'Ŝablona_diskuto',
51 NS_HELP => 'Helpo',
52 NS_HELP_TALK => 'Helpa_diskuto',
53 NS_CATEGORY => 'Kategorio',
54 NS_CATEGORY_TALK => 'Kategoria_diskuto',
55 );
56
57 }
58 function getDefaultUserOptions () {
59 $opt = parent::getDefaultUserOptions();
60 $opt['altencoding'] = 0;
61 return $opt;
62 }
63
64 function getNamespaces() {
65 return $this->mNamespaceNamesEo + parent::getNamespaces();
66 }
67
68 function getQuickbarSettings() {
69 return $this->mQuickbarSettingsEo;
70 }
71
72 function getSkinNames() {
73 return $this->mSkinNamesEo + parent::getSkinNames();
74 }
75
76 function getMessage( $key ) {
77 if( isset( $this->mMessagesEo[$key] ) ) {
78 return $this->mMessagesEo[$key];
79 } else {
80 return parent::getMessage( $key );
81 }
82 }
83
84 function getAllMessages() {
85 return $this->mMessagesEo;
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 iconv( $in, $out, $string ) {
98 # For most languages, this is a wrapper for iconv
99 # Por multaj lingvoj, ĉi tiu nur voku la sisteman funkcion iconv()
100 # Ni ankaŭ konvertu X-sistemajn surogotajn
101 if( strcasecmp( $in, 'x' ) == 0 and strcasecmp( $out, 'utf-8' ) == 0) {
102 $xu = array (
103 'xx' => 'x' , 'xX' => 'x' ,
104 'Xx' => 'X' , 'XX' => 'X' ,
105 "Cx" => "\xc4\x88" , "CX" => "\xc4\x88" ,
106 "cx" => "\xc4\x89" , "cX" => "\xc4\x89" ,
107 "Gx" => "\xc4\x9c" , "GX" => "\xc4\x9c" ,
108 "gx" => "\xc4\x9d" , "gX" => "\xc4\x9d" ,
109 "Hx" => "\xc4\xa4" , "HX" => "\xc4\xa4" ,
110 "hx" => "\xc4\xa5" , "hX" => "\xc4\xa5" ,
111 "Jx" => "\xc4\xb4" , "JX" => "\xc4\xb4" ,
112 "jx" => "\xc4\xb5" , "jX" => "\xc4\xb5" ,
113 "Sx" => "\xc5\x9c" , "SX" => "\xc5\x9c" ,
114 "sx" => "\xc5\x9d" , "sX" => "\xc5\x9d" ,
115 "Ux" => "\xc5\xac" , "UX" => "\xc5\xac" ,
116 "ux" => "\xc5\xad" , "uX" => "\xc5\xad"
117 ) ;
118 return preg_replace ( '/([cghjsu]x?)((?:xx)*)(?!x)/ei',
119 'strtr( "$1", $xu ) . strtr( "$2", $xu )', $string );
120 } else if( strcasecmp( $in, 'UTF-8' ) == 0 and strcasecmp( $out, 'x' ) == 0 ) {
121 $ux = array (
122 'x' => 'xx' , 'X' => 'Xx' ,
123 "\xc4\x88" => "Cx" , "\xc4\x89" => "cx" ,
124 "\xc4\x9c" => "Gx" , "\xc4\x9d" => "gx" ,
125 "\xc4\xa4" => "Hx" , "\xc4\xa5" => "hx" ,
126 "\xc4\xb4" => "Jx" , "\xc4\xb5" => "jx" ,
127 "\xc5\x9c" => "Sx" , "\xc5\x9d" => "sx" ,
128 "\xc5\xac" => "Ux" , "\xc5\xad" => "ux"
129 ) ;
130 # Double Xs only if they follow cxapelutaj literoj.
131 return preg_replace( '/((?:[cghjsu]|\xc4[\x88\x89\x9c\x9d\xa4\xa5\xb4\xb5]'.
132 '|\xc5[\x9c\x9d\xac\xad])x*)/ei', 'strtr( "$1", $ux )', $string );
133 }
134 return iconv( $in, $out, $string );
135 }
136
137 function checkTitleEncoding( $s ) {
138 # Check for X-system backwards-compatibility URLs
139 $ishigh = preg_match( '/[\x80-\xff]/', $s);
140 $isutf = preg_match( '/^([\x00-\x7f]|[\xc0-\xdf][\x80-\xbf]|' .
141 '[\xe0-\xef][\x80-\xbf]{2}|[\xf0-\xf7][\x80-\xbf]{3})+$/', $s );
142
143 if($ishigh and !$isutf) {
144 # Assume Latin1
145 $s = utf8_encode( $s );
146 } else {
147 if( preg_match( '/(\xc4[\x88\x89\x9c\x9d\xa4\xa5\xb4\xb5]'.
148 '|\xc5[\x9c\x9d\xac\xad])/', $s ) )
149 return $s;
150 }
151
152 //if( preg_match( '/[cghjsu]x/i', $s ) )
153 // return $this->iconv( 'x', 'utf-8', $s );
154 return $s;
155 }
156
157 function initEncoding() {
158 global $wgEditEncoding, $wgInputEncoding, $wgOutputEncoding;
159 $wgInputEncoding = 'utf-8';
160 $wgOutputEncoding = 'utf-8';
161 $wgEditEncoding = 'x';
162 }
163
164 function setAltEncoding() {
165 global $wgEditEncoding, $wgInputEncoding, $wgOutputEncoding;
166 $wgInputEncoding = 'utf-8';
167 $wgOutputEncoding = 'x';
168 $wgEditEncoding = '';
169 }
170
171 function separatorTransformTable() {
172 return array(',' => ' ', '.' => ',' );
173 }
174
175 }
176
177 ?>