Index: trunk/extensions/Translate/scripts/groupStatistics.php |
— | — | @@ -10,63 +10,62 @@ |
11 | 11 | */ |
12 | 12 | |
13 | 13 | $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 |
16 | 15 | // 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' ), |
71 | 70 | ); |
72 | 71 | |
73 | 72 | $localisedWeights = array( |
— | — | @@ -125,6 +124,8 @@ |
126 | 125 | --speakers : add column for number of speakers (est.). Only valid when |
127 | 126 | combined with --most. |
128 | 127 | --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'. |
129 | 130 | |
130 | 131 | END; |
131 | 132 | STDERR( $msg ); |
— | — | @@ -190,6 +191,7 @@ |
191 | 192 | } |
192 | 193 | $out->element( 'Code', true ); |
193 | 194 | $out->element( 'Language', true ); |
| 195 | +$out->element( 'Continent', true ); |
194 | 196 | |
195 | 197 | if( isset( $options['most'] ) && isset( $options['speakers'] ) ) { |
196 | 198 | $out->element( 'Speakers', true ); |
— | — | @@ -285,22 +287,39 @@ |
286 | 288 | |
287 | 289 | // Output the the row |
288 | 290 | $out->blockstart(); |
| 291 | + |
289 | 292 | // Fill language position field |
290 | 293 | if( isset( $options['most'] ) ) { |
291 | 294 | $out->element( $mostSpokenLanguages[$code][0] ); |
292 | 295 | } |
| 296 | + |
293 | 297 | // Fill language code field |
294 | 298 | $out->element( $code ); |
| 299 | + |
295 | 300 | // 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' ) ) { |
297 | 303 | $out->element( "{{#languagename:" . $code . "}}" ); |
298 | 304 | } else { |
299 | 305 | $out->element( $name ); |
300 | 306 | } |
| 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 | + |
301 | 319 | // Fill speakers field |
302 | 320 | if( isset( $options['most'] ) && isset( $options['speakers'] ) ) { |
303 | 321 | $out->element( number_format( $mostSpokenLanguages[$code][3] ) ); |
304 | 322 | } |
| 323 | + |
305 | 324 | // Fill fields for groups |
306 | 325 | foreach ( $columns as $fields ) { |
307 | 326 | list( $invert, $upper, $total ) = $fields; |