r29577 MediaWiki - Code Review archive

Repository:MediaWiki
Revision:r29576‎ | r29577 | r29578 >
Date:08:09, 11 January 2008
Author:siebrand
Status:old
Tags:
Comment:
* use wfLoadExtensionMessages for Editcount
* Delay message loading
* add version and url in extension credits
* update Translate extension
Modified paths:
  • /trunk/extensions/Editcount/SpecialEditcount.i18n.php (modified) (history)
  • /trunk/extensions/Editcount/SpecialEditcount.php (modified) (history)
  • /trunk/extensions/Editcount/SpecialEditcount_body.php (modified) (history)
  • /trunk/extensions/Translate/MessageGroups.php (modified) (history)

Diff [purge]

Index: trunk/extensions/Editcount/SpecialEditcount_body.php
@@ -1,26 +1,21 @@
22 <?php
33 if (!defined('MEDIAWIKI')) die();
44
5 -class Editcount extends SpecialPage {
 5+class Editcount extends IncludableSpecialPage {
66 /**
77 * Constructor
88 */
9 - function Editcount() {
10 - SpecialPage::SpecialPage( 'Editcount' );
11 - $this->includable( true );
 9+ public function __construct() {
 10+ parent::__construct( 'Editcount' );
1211 }
1312
1413 /**
1514 * main()
1615 */
17 - function execute( $par = null ) {
18 - global $wgVersion, $wgRequest, $wgOut, $wgContLang;
 16+ public function execute( $par ) {
 17+ global $wgRequest, $wgOut, $wgContLang;
 18+ wfLoadExtensionMessages( 'Editcount' );
1919
20 - if ( version_compare( $wgVersion, '1.5beta4', '<' ) ) {
21 - $wgOut->versionRequired( '1.5beta4' );
22 - return;
23 - }
24 -
2520 $target = isset( $par ) ? $par : $wgRequest->getText( 'username' );
2621
2722 list( $username, $namespace ) = $this->extractParamaters( $target );
@@ -141,7 +136,6 @@
142137
143138 return $res;
144139 }
145 -
146140 }
147141
148142 class EditcountHTML extends Editcount {
@@ -237,4 +231,3 @@
238232 return $ret;
239233 }
240234 }
241 -
Index: trunk/extensions/Editcount/SpecialEditcount.i18n.php
@@ -1,336 +1,330 @@
22 <?php
3 -
43 /**
5 - * Internationalisation file for CountEdits extension
 4+ * Internationalisation file for extension CountEdits.
65 *
76 * @addtogroup Extensions
87 * @author Bertrand GRONDIN <bertrand.grondinr@tiscali.fr>
98 */
109
11 -function efSpecialEditcountMessages() {
12 - $messages = array(
13 -// English Version by Rob Church
14 -'en' => array(
 10+$messages = array();
 11+
 12+/* English
 13+ * @author Rob Church
 14+ */
 15+$messages['en'] = array(
1516 'editcount' => 'Edit count',
1617 'editcount_username' => 'User:',
1718 'editcount_submit' => 'Submit',
1819 'editcount_total' => 'Total',
19 -),
 20+);
2021
2122 /* Arabic (Meno25) */
22 -'ar' => array(
 23+$messages['ar'] = array(
2324 'editcount' => 'عداد المساهمات',
2425 'editcount_username' => 'مستخدم:',
2526 'editcount_submit' => 'تنفيذ',
2627 'editcount_total' => 'الإجمالي',
27 -),
 28+);
2829
29 -'bcl' => array(
 30+$messages['bcl'] = array(
3031 'editcount' => 'Hirahón an bilang',
3132 'editcount_username' => 'Parágamit:',
3233 'editcount_submit' => 'Isumitir',
33 -),
 34+);
3435
3536 /** Bulgarian (Български)
3637 * @author Spiritia
3738 * @author DCLXVI
3839 */
39 -'bg' => array(
 40+$messages['bg'] = array(
4041 'editcount' => 'Броене на редакции',
4142 'editcount_username' => 'Потребител:',
4243 'editcount_submit' => 'Проверяване',
4344 'editcount_total' => 'Общо',
44 -),
 45+);
4546
46 -'bn' => array(
 47+$messages['bn'] = array(
4748 'editcount' => 'সম্পাদনা সংখ্যা',
4849 'editcount_username' => 'ব্যবহারকারী:',
4950 'editcount_submit' => 'পেশ করো',
5051 'editcount_total' => 'সর্বমোট',
51 -),
 52+);
5253
53 -'br' => array(
 54+$messages['br'] = array(
5455 'editcount' => 'Sammad degasadennoù',
5556 'editcount_username' => 'Implijer :',
5657 'editcount_submit' => 'Kas',
5758 'editcount_total' => 'Hollad',
58 -),
 59+);
5960
60 -'ca' => array(
 61+$messages['ca'] = array(
6162 'editcount' => 'Comptador d\'edicions',
6263 'editcount_username' => 'Usuari:',
63 -),
 64+);
6465
6566 // German by Leon Weber
66 -'de' => array(
 67+$messages['de'] = array(
6768 'editcount' => 'Anzahl der Seitenbearbeitungen',
6869 'editcount_username' => 'Benutzer:',
6970 'editcount_submit' => 'Absenden',
7071 'editcount_total' => 'Gesamt',
71 -),
 72+);
7273
73 -'el' => array(
 74+$messages['el'] = array(
7475 'editcount_username' => 'Χρήστης:',
75 -),
 76+);
7677
77 -'eo' => array(
 78+$messages['eo'] = array(
7879 'editcount' => 'Redakta nombro',
7980 'editcount_username' => 'Uzanto:',
8081 'editcount_submit' => 'Ek',
8182 'editcount_total' => 'Tute',
82 -),
 83+);
8384
84 -'ext' => array(
 85+$messages['ext'] = array(
8586 'editcount_username' => 'Usuáriu:',
86 -),
 87+);
8788
8889 /** Finnish (Suomi)
8990 * @author Nike
9091 */
91 -'fi' => array(
 92+$messages['fi'] = array(
9293 'editcount' => 'Muokkausmäärä',
9394 'editcount_username' => 'Käyttäjä',
9495 'editcount_submit' => 'Hae',
9596 'editcount_total' => 'Yhteensä',
96 -),
 97+);
9798
9899 // French Version by Bertrand Grondin
99 - 'fr' => array(
 100+$messages['fr'] = array(
100101 'editcount' => 'Compteur d’éditions individuel',
101102 'editcount_username' => 'Utilisateur :',
102103 'editcount_submit' => 'Soumettre',
103104 'editcount_total' => 'Total',
104 - ),
 105+);
105106
106 -'gl' => array(
 107+$messages['gl'] = array(
107108 'editcount' => 'Total de edicións',
108109 'editcount_username' => 'Usuario:',
109110 'editcount_submit' => 'Enviar',
110111 'editcount_total' => 'Total',#identical but defined
111 -),
 112+);
112113
113114 /** Croatian (Hrvatski)
114115 * @author Dnik
115116 */
116 -'hr' => array(
 117+$messages['hr'] = array(
117118 'editcount' => 'Broj uređivanja',
118119 'editcount_username' => 'Suradnik:',
119120 'editcount_submit' => 'Podnesi',
120121 'editcount_total' => 'Ukupno',
121 -),
 122+);
122123
123 -'hsb' => array(
 124+$messages['hsb'] = array(
124125 'editcount' => 'Ličba změnow',
125126 'editcount_username' => 'Wužiwar:',
126127 'editcount_submit' => 'OK',
127128 'editcount_total' => 'dohromady',
128 -),
 129+);
129130
130 -'hy' => array(
 131+$messages['hy'] = array(
131132 'editcount' => 'Խմբագրումների հաշվում',
132133 'editcount_username' => 'Մասնակից.',
133134 'editcount_submit' => 'Հաշվել',
134135 'editcount_total' => 'Ընդհանուր',
135 -),
 136+);
136137
137138 // Indonesian Version by Ivan Lanin
138 -'id' => array(
 139+$messages['id'] = array(
139140 'editcount' => 'Jumlah suntingan',
140141 'editcount_username' => 'Pengguna:',
141142 'editcount_submit' => 'Kirim',
142143 'editcount_total' => 'Total',
143 -),
 144+);
144145
145146 // Italian Version by BrokenArrow
146 -'it' => array(
 147+$messages['it'] = array(
147148 'editcount' => 'Conteggio delle modifiche',
148149 'editcount_username' => 'Utente:',
149150 'editcount_submit' => 'Invia',
150151 'editcount_total' => 'Totale',
151 -),
 152+);
152153
153 -'la' => array(
 154+$messages['la'] = array(
154155 'editcount_username' => 'Usor:',
155 -),
 156+);
156157
157158 /** Luxembourgish (Lëtzebuergesch)
158159 * @author Robby
159160 */
160 -'lb' => array(
 161+$messages['lb'] = array(
161162 'editcount' => 'Zuel vun de Säitenännerungen',
162163 'editcount_username' => 'Benotzer:',
163164 'editcount_submit' => 'Ofschécken',
164165 'editcount_total' => 'Total',
165 -),
 166+);
166167
167168 /** Lithuanian (Lietuvių)
168169 * @author Matasg
169170 */
170 -'lt' => array(
 171+$messages['lt'] = array(
171172 'editcount' => 'Naudotojo indėlis',
172173 'editcount_username' => 'Naudotojas:',
173174 'editcount_submit' => 'Patvirtinti',
174175 'editcount_total' => 'Viso',
175 -),
 176+);
176177
177178 // nld / Dutch version by Siebrand Mazeland
178 -'nl' => array(
 179+$messages['nl'] = array(
179180 'editcount' => 'Bewerkingsteller',
180181 'editcount_username' => 'Gebruiker:',
181182 'editcount_submit' => 'OK',
182183 'editcount_total' => 'Totaal',
183 -),
 184+);
184185
185186 // Norwegian (Jon Harald Søby)
186 -'no' => array(
 187+$messages['no'] = array(
187188 'editcount' => 'Redigeringsteller',
188189 'editcount_username' => 'Bruker:',
189190 'editcount_submit' => 'OK',
190191 'editcount_total' => 'Totalt',
191 -),
 192+);
192193
193194 // Occitan by Cedric31
194 -'oc' => array(
 195+$messages['oc'] = array(
195196 'editcount' => 'Comptaire d\'edicions individual',
196197 'editcount_username' => 'Utilizaire:',
197198 'editcount_submit' => 'Sometre',
198 -),
 199+);
199200
200 -'pl' => array(
 201+$messages['pl'] = array(
201202 'editcount' => 'Licznik edycji',
202203 'editcount_username' => 'Użytkownik',
203204 'editcount_submit' => 'Wyślij',
204205 'editcount_total' => 'Razem',
205 -),
 206+);
206207
207208 /* Piedmontese (Bèrto 'd Sèra) */
208 -'pms' => array(
 209+$messages['pms'] = array(
209210 'editcount' => 'Total dle modìfiche',
210211 'editcount_username' => 'Stranòm:',
211212 'editcount_submit' => 'Manda',
212213 'editcount_total' => 'Total',
213 -),
 214+);
214215
215216 // Portuguese (Lugusto)
216 -'pt' => array(
 217+$messages['pt'] = array(
217218 'editcount' => 'Contador de edições',
218219 'editcount_username' => 'Usuário:',
219220 'editcount_submit' => 'Enviar',
220221 'editcount_total' => 'Total',
221 -),
 222+);
222223
223 -'rm' => array(
 224+$messages['rm'] = array(
224225 'editcount_username' => 'Utilisader:',
225 -),
 226+);
226227
227228 /** Russian (Русский)
228229 * @author VasilievVV
229230 */
230 -'ru' => array(
 231+$messages['ru'] = array(
231232 'editcount' => 'Счётчик правок',
232233 'editcount_username' => 'Участник:',
233234 'editcount_submit' => 'Посчитать',
234235 'editcount_total' => 'Всего',
235 -),
 236+);
236237
237238 /** Sassarese (Sassarese)
238239 * @author Felis
239240 */
240 -'sdc' => array(
 241+$messages['sdc'] = array(
241242 'editcount' => 'Cuntéggiu di li mudìffighi',
242243 'editcount_username' => 'Utenti:',
243244 'editcount_submit' => 'Invia',
244245 'editcount_total' => 'Totari',
245 -),
 246+);
246247
247248 // Slovak version by helix84
248 -'sk' => array(
 249+$messages['sk'] = array(
249250 'editcount' => 'Počet príspevkov',
250251 'editcount_username' => 'Používateľ:',
251252 'editcount_submit' => 'Odoslať',
252253 'editcount_total' => 'Celkom',
253 -),
 254+);
254255
255256 // Serbian default version by Sasa Stefanovic
256 -'sr' => array(
 257+$messages['sr'] = array(
257258 'editcount' => 'Бројач измена',
258259 'editcount_username' => 'Корисник:',
259260 'editcount_submit' => 'Унеси',
260261 'editcount_total' => 'Укупно',
261 -),
 262+);
262263
263264 // Serbian cyrillic version by Sasa Stefanovic
264 -'sr-ec' => array(
 265+$messages['sr-ec'] = array(
265266 'editcount' => 'Бројач измена',
266267 'editcount_username' => 'Корисник:',
267268 'editcount_submit' => 'Унеси',
268269 'editcount_total' => 'Укупно',
269 -),
 270+);
270271
271272 // Serbian latin version by Sasa Stefanovic
272 -'sr-el' => array(
 273+$messages['sr-el'] = array(
273274 'editcount' => 'Brojač izmena',
274275 'editcount_username' => 'Korisnik:',
275276 'editcount_submit' => 'Unesi',
276277 'editcount_total' => 'Ukupno',
277 -),
 278+);
278279
279 -'ss' => array(
 280+$messages['ss'] = array(
280281 'editcount_username' => 'Umuntfu:',
281 -),
 282+);
282283
283284 /** Seeltersk (Seeltersk)
284285 * @author Pyt
285286 */
286 -'stq' => array(
 287+$messages['stq'] = array(
287288 'editcount' => 'Antaal fon do Siedenbeoarbaidengen',
288289 'editcount_username' => 'Benutser:',
289290 'editcount_submit' => 'Ouseende',
290291 'editcount_total' => 'Mädnunner',
291 -),
 292+);
292293
293294 /** Volapük (Volapük)
294295 * @author Malafaya
295296 */
296 -'vo' => array(
 297+$messages['vo'] = array(
297298 'editcount_username' => 'Geban:',
298299 'editcount_total' => 'Valod',
299 -),
 300+);
300301
301302 // Cantonese Version by Shinjiman
302 -'yue' => array(
 303+$messages['yue'] = array(
303304 'editcount' => '編輯次數',
304305 'editcount_username' => '用戶:',
305306 'editcount_submit' => '遞交',
306307 'editcount_total' => '總數',
307 -),
 308+);
308309
309310 // Chinese (Simplified) Version by Shinjiman
310 -'zh-hans' => array(
 311+$messages['zh-hans'] = array(
311312 'editcount' => '编辑次数',
312313 'editcount_username' => '用户:',
313314 'editcount_submit' => '提交',
314315 'editcount_total' => '总数',
315 -),
 316+);
316317
317318 // Chinese (Traditional) Version by Shinjiman
318 -'zh-hant' => array(
 319+$messages['zh-hant'] = array(
319320 'editcount' => '編輯次數',
320321 'editcount_username' => '用戶:',
321322 'editcount_submit' => '遞交',
322323 'editcount_total' => '總數',
323 -),
324 -
325324 );
326325
327 - /* Chinese defaults, fallback to zh-hans or zh-hant */
328 - $messages['zh'] = $messages['zh-hans'];
329 - $messages['zh-cn'] = $messages['zh-hans'];
330 - $messages['zh-hk'] = $messages['zh-hant'];
331 - $messages['zh-cn'] = $messages['zh-hans'];
332 - $messages['zh-tw'] = $messages['zh-hant'];
333 - /* Cantonese default, fallback to zh-hans or zh-hant */
334 - $messages['zh-yue'] = $messages['yue'];
335 -
336 - return $messages;
337 -}
 326+$messages['zh'] = $messages['zh-hans'];
 327+$messages['zh-cn'] = $messages['zh-hans'];
 328+$messages['zh-hk'] = $messages['zh-hant'];
 329+$messages['zh-cn'] = $messages['zh-hans'];
 330+$messages['zh-tw'] = $messages['zh-hant'];
 331+$messages['zh-yue'] = $messages['yue'];
Index: trunk/extensions/Editcount/SpecialEditcount.php
@@ -13,25 +13,15 @@
1414 * @license http://www.gnu.org/copyleft/gpl.html GNU General Public License 2.0 or later
1515 */
1616
17 -$wgExtensionFunctions[] = 'wfSpecialEditcount';
1817 $wgExtensionCredits['specialpage'][] = array(
1918 'name' => 'Editcount',
 19+ 'version' => '2008-01-11',
2020 'author' => 'Ævar Arnfjörð Bjarmason',
2121 'description' => 'Displays [[Special:Editcount|edit count]] of a user',
 22+ 'url' => 'http://www.mediawiki.org/wiki/Extension:Editcount',
2223 );
2324
24 -function wfSpecialEditcount() {
25 - global $IP, $wgMessageCache;
26 -
27 - require_once ('SpecialEditcount.i18n.php' );
28 - foreach( efSpecialEditcountMessages() as $lang => $messages )
29 - $wgMessageCache->addMessages( $messages, $lang );
30 -
31 - $GLOBALS['wgAutoloadClasses']['Editcount'] = dirname( __FILE__ ) .
32 - '/SpecialEditcount_body.php';
33 -
34 - $GLOBALS['wgSpecialPages']['editcount'] = array( /*class*/ 'Editcount',
35 - /*name*/ 'Editcount', /* permission */'', /*listed*/ true,
36 - /*function*/ false, /*file*/ false );
37 -
38 -}
 25+$dir = dirname(__FILE__) . '/';
 26+$wgExtensionMessagesFiles['Editcount'] = $dir .'SpecialEditcount.i18n.php';
 27+$wgAutoloadClasses['Editcount'] = $dir . 'SpecialEditcount_body.php';
 28+$wgSpecialPages['Editcount'] = 'Editcount';
Index: trunk/extensions/Translate/MessageGroups.php
@@ -1025,17 +1025,11 @@
10261026 }
10271027
10281028 class EditcountMessageGroup extends ExtensionMessageGroup {
1029 - protected $fileExporter = null;
10301029 protected $label = 'Edit Count';
10311030 protected $id = 'ext-editcount';
10321031
1033 - protected $functionName = 'efSpecialEditcountMessages';
 1032+ protected $arrName = 'messages';
10341033 protected $messageFile = 'Editcount/SpecialEditcount.i18n.php';
1035 -
1036 - protected $exportStart = '\'$CODE\' => array(';
1037 - protected $exportPrefix= '';
1038 - protected $exportLineP = "\t";
1039 - protected $exportEnd = '),';
10401034 }
10411035
10421036 class EvalMessageGroup extends ExtensionMessageGroup {

Status & tagging log