r57333 MediaWiki - Code Review archive

Repository:MediaWiki
Revision:r57332‎ | r57333 | r57334 >
Date:18:13, 3 October 2009
Author:siebrand
Status:deferred
Tags:
Comment:
Added option for a content column
Modified paths:
  • /trunk/extensions/Translate/scripts/groupStatistics.php (modified) (history)

Diff [purge]

Index: trunk/extensions/Translate/scripts/groupStatistics.php
@@ -10,63 +10,62 @@
1111 */
1212
1313 $mostSpokenLanguages = array(
14 - // FIXME: Continent toevoegen (africa, america, asia, australia, europe (timezoneregion-), all ('searchall'))
15 - // 'language code' => array( position, ethnologue, encarta, average ), // Remark
 14+ // 'language code' => array( position, ethnologue, encarta, average, continent ), // Remark
1615 // Source: http://en.wikipedia.org/w/index.php?title=List_of_languages_by_number_of_native_speakers&oldid=317526109
17 - 'zh-hans' => array( 1, 845000, 844700, 844850 ),
18 - 'zh-hant' => array( 1, 845000, 844700, 844850 ),
19 - 'es' => array( 2, 329000, 322000, 325500 ),
20 - 'en' => array( 3, 328000, 341000, 334500 ),
21 - 'hi' => array( 4, 182000, 366000, 274000 ), // Classified together with Urdu
22 - 'ur' => array( 4, 60600, 60290, 60445 ), // Classified together with Hindi
23 - 'ar' => array( 5, 221000, 422039, 321519 ),
24 - 'bn' => array( 6, 181000, 207000, 194000 ),
25 - 'pt' => array( 7, 178000, 176000, 177000 ),
26 - 'pt-br' => array( 7, 178000, 176000, 177000 ),
27 - 'ru' => array( 8, 144000, 167000, 155500 ),
28 - 'ja' => array( 9, 122000, 125000, 123500 ),
29 - 'de' => array( 10, 90300, 100130, 95215 ),
30 - 'jv' => array( 11, 84600, 75567, 80083 ),
31 - 'wuu' => array( 12, 77200, 77200, 77200 ), // No encarta data
32 - 'ko' => array( 13, 75000, 78000, 76500 ),
33 - 'pnb' => array( 14, 78300, 72188, 75244 ), // Most spoken variant
34 - 'fr' => array( 15, 67800, 78000, 72900 ),
35 - 'te' => array( 16, 69800, 69666, 69733 ),
36 - 'vi' => array( 17, 68600, 68000, 68300 ),
37 - 'mr' => array( 18, 68100, 68022, 68061 ),
38 - 'ta' => array( 19, 65700, 66000, 65850 ),
39 - 'it' => array( 20, 61700, 62000, 61850 ),
40 - 'tr' => array( 21, 59000, 61000, 60000 ),
41 - 'fa' => array( 22, 72000, 31300, 51650 ),
42 - 'yue' => array( 23, 55500, 55000, 55250 ), // No encarta data
43 - 'tl' => array( 24, 48900, 17000, 32950 ),
44 - 'gu' => array( 25, 46500, 46100, 46300 ),
45 - 'nan' => array( 26, 46200, 46200, 46200 ), // No encarta data, most spoken variant
46 - 'pl' => array( 27, 40000, 44000, 42000 ),
47 - 'uk' => array( 28, 39400, 47000, 43200 ),
48 - 'hsn' => array( 29, 36000, 36000, 36000 ), // No encarta data
49 - 'ml' => array( 30, 35706, 35706, 35706 ),
50 - 'kn' => array( 31, 35400, 35400, 35400 ),
51 - 'mai' => array( 32, 45000, 24191, 34595 ),
52 - 'bh' => array( 33, 38500, 26254, 32377 ),
53 - 'my' => array( 34, 32300, 32300, 32300 ),
54 - 'or' => array( 35, 31700, 32300, 32000 ),
55 - 'ms' => array( 36, 39100, 23600, 31350 ),
56 - 'su' => array( 37, 34000, 27000, 30500 ),
57 - 'hak' => array( 38, 30000, 30000, 30000 ), // No encarta data
58 - 'ro' => array( 39, 23400, 26265, 24832 ),
59 - 'az' => array( 40, 19100, 31400, 25250 ),
60 - 'ha' => array( 41, 24200, 24200, 24200 ),
61 - 'ps' => array( 42, 19000, 26811, 22905 ),
62 - 'gan-hans' => array( 43, 21000, 21000, 21000 ),
63 - 'gan-hant' => array( 43, 21000, 21000, 21000 ),
64 - 'id' => array( 44, 23200, 17100, 20150 ),
65 - 'th' => array( 45, 20050, 46100, 33075 ),
66 - 'nl' => array( 46, 21700, 20000, 20850 ),
67 - 'yo' => array( 47, 20000, 20000, 20000 ),
68 - 'sd' => array( 48, 19720, 19720, 19720 ),
69 - 'uz' => array( 49, 18466, 20100, 19283 ),
70 - 'sh' => array( 50, 16400, 21100, 18750 ),
 16+ 'zh-hans' => array( 1, 845000, 844700, 844850, 'asia' ),
 17+ 'zh-hant' => array( 1, 845000, 844700, 844850, 'asia' ),
 18+ 'es' => array( 2, 329000, 322000, 325500, 'multiple' ),
 19+ 'en' => array( 3, 328000, 341000, 334500, 'multiple' ),
 20+ 'hi' => array( 4, 182000, 366000, 274000, 'asia' ), // Classified together with Urdu
 21+ 'ur' => array( 4, 60600, 60290, 60445, 'asia' ), // Classified together with Hindi
 22+ 'ar' => array( 5, 221000, 422039, 321519, 'multiple' ),
 23+ 'bn' => array( 6, 181000, 207000, 194000, 'asia' ),
 24+ 'pt' => array( 7, 178000, 176000, 177000, 'multiple' ),
 25+ 'pt-br' => array( 7, 178000, 176000, 177000, 'america' ),
 26+ 'ru' => array( 8, 144000, 167000, 155500, 'multiple' ),
 27+ 'ja' => array( 9, 122000, 125000, 123500, 'asia' ),
 28+ 'de' => array( 10, 90300, 100130, 95215, 'europe' ),
 29+ 'jv' => array( 11, 84600, 75567, 80083, 'asia' ),
 30+ 'wuu' => array( 12, 77200, 77200, 77200, 'asia' ), // No encarta data
 31+ 'ko' => array( 13, 75000, 78000, 76500, 'asia' ),
 32+ 'pnb' => array( 14, 78300, 72188, 75244, 'asia' ), // Most spoken variant
 33+ 'fr' => array( 15, 67800, 78000, 72900, 'multiple' ),
 34+ 'te' => array( 16, 69800, 69666, 69733, 'asia' ),
 35+ 'vi' => array( 17, 68600, 68000, 68300, 'asia' ),
 36+ 'mr' => array( 18, 68100, 68022, 68061, 'asia' ),
 37+ 'ta' => array( 19, 65700, 66000, 65850, 'asia' ),
 38+ 'it' => array( 20, 61700, 62000, 61850, 'europe' ),
 39+ 'tr' => array( 21, 59000, 61000, 60000, 'multiple' ),
 40+ 'fa' => array( 22, 72000, 31300, 51650, 'asia' ),
 41+ 'yue' => array( 23, 55500, 55000, 55250, 'asia' ), // No encarta data
 42+ 'tl' => array( 24, 48900, 17000, 32950, 'asia' ),
 43+ 'gu' => array( 25, 46500, 46100, 46300, 'asia' ),
 44+ 'nan' => array( 26, 46200, 46200, 46200, 'asia' ), // No encarta data, most spoken variant
 45+ 'pl' => array( 27, 40000, 44000, 42000, 'europe' ),
 46+ 'uk' => array( 28, 39400, 47000, 43200, 'europe' ),
 47+ 'hsn' => array( 29, 36000, 36000, 36000, 'asia' ), // No encarta data
 48+ 'ml' => array( 30, 35706, 35706, 35706, 'asia' ),
 49+ 'kn' => array( 31, 35400, 35400, 35400, 'asia' ),
 50+ 'mai' => array( 32, 45000, 24191, 34595, 'asia' ),
 51+ 'bh' => array( 33, 38500, 26254, 32377, 'asia' ),
 52+ 'my' => array( 34, 32300, 32300, 32300, 'asia' ),
 53+ 'or' => array( 35, 31700, 32300, 32000, 'asia' ),
 54+ 'ms' => array( 36, 39100, 23600, 31350, 'asia' ),
 55+ 'su' => array( 37, 34000, 27000, 30500, 'asia' ),
 56+ 'hak' => array( 38, 30000, 30000, 30000, 'asia' ), // No encarta data
 57+ 'ro' => array( 39, 23400, 26265, 24832, 'europe' ),
 58+ 'az' => array( 40, 19100, 31400, 25250, 'asia' ),
 59+ 'ha' => array( 41, 24200, 24200, 24200, 'africa' ),
 60+ 'ps' => array( 42, 19000, 26811, 22905, 'asia' ),
 61+ 'gan-hans' => array( 43, 21000, 21000, 21000, 'asia' ),
 62+ 'gan-hant' => array( 43, 21000, 21000, 21000, 'asia' ),
 63+ 'id' => array( 44, 23200, 17100, 20150, 'asia' ),
 64+ 'th' => array( 45, 20050, 46100, 33075, 'asia' ),
 65+ 'nl' => array( 46, 21700, 20000, 20850, 'europe' ),
 66+ 'yo' => array( 47, 20000, 20000, 20000, 'africa' ),
 67+ 'sd' => array( 48, 19720, 19720, 19720, 'asia' ),
 68+ 'uz' => array( 49, 18466, 20100, 19283, 'asia' ),
 69+ 'sh' => array( 50, 16400, 21100, 18750, 'europe' ),
7170 );
7271
7372 $localisedWeights = array(
@@ -125,6 +124,8 @@
126125 --speakers : add column for number of speakers (est.). Only valid when
127126 combined with --most.
128127 --nol10n : do not add localised language name if I18ntags is installed.
 128+ --continent : add a continent column. Only available when output is not
 129+ set or is 'wiki'.
129130
130131 END;
131132 STDERR( $msg );
@@ -190,6 +191,7 @@
191192 }
192193 $out->element( 'Code', true );
193194 $out->element( 'Language', true );
 195+$out->element( 'Continent', true );
194196
195197 if( isset( $options['most'] ) && isset( $options['speakers'] ) ) {
196198 $out->element( 'Speakers', true );
@@ -285,22 +287,39 @@
286288
287289 // Output the the row
288290 $out->blockstart();
 291+
289292 // Fill language position field
290293 if( isset( $options['most'] ) ) {
291294 $out->element( $mostSpokenLanguages[$code][0] );
292295 }
 296+
293297 // Fill language code field
294298 $out->element( $code );
 299+
295300 // Fill language name field
296 - if( !isset( $options['nol10n'] ) && function_exists( 'efI18nTagsInit' ) ) {
 301+ if( ( !isset( $options['output'] ) || $options['output'] == 'wiki' ) &&
 302+ !isset( $options['nol10n'] ) && function_exists( 'efI18nTagsInit' ) ) {
297303 $out->element( "{{#languagename:" . $code . "}}" );
298304 } else {
299305 $out->element( $name );
300306 }
 307+
 308+ // Fill continent field
 309+ if( ( !isset( $options['output'] ) || $options['output'] == 'wiki' ) &&
 310+ isset( $options['output'] ) ) {
 311+ if( $mostSpokenLanguages[$code][4] == 'multiple' ) {
 312+ $continent = '';
 313+ } else {
 314+ $content = "{{int:timezoneregion-" . $mostSpokenLanguages[$code][4] . "}}";
 315+ }
 316+ $out->element( $continent );
 317+ }
 318+
301319 // Fill speakers field
302320 if( isset( $options['most'] ) && isset( $options['speakers'] ) ) {
303321 $out->element( number_format( $mostSpokenLanguages[$code][3] ) );
304322 }
 323+
305324 // Fill fields for groups
306325 foreach ( $columns as $fields ) {
307326 list( $invert, $upper, $total ) = $fields;

Status & tagging log