Index: trunk/phase3/maintenance/language/checkLanguage.inc |
— | — | @@ -27,22 +27,22 @@ |
28 | 28 | exit(); |
29 | 29 | } |
30 | 30 | |
31 | | - if ( isset($options['lang']) ) { |
| 31 | + if ( isset( $options['lang'] ) ) { |
32 | 32 | $this->code = $options['lang']; |
33 | 33 | } else { |
34 | 34 | global $wgLanguageCode; |
35 | 35 | $this->code = $wgLanguageCode; |
36 | 36 | } |
37 | 37 | |
38 | | - if ( isset($options['level']) ) { |
| 38 | + if ( isset( $options['level'] ) ) { |
39 | 39 | $this->level = $options['level']; |
40 | 40 | } |
41 | 41 | |
42 | | - $this->doLinks = isset($options['links']); |
43 | | - $this->includeExif = !isset($options['noexif']); |
44 | | - $this->checkAll = isset($options['all']); |
| 42 | + $this->doLinks = isset( $options['links'] ); |
| 43 | + $this->includeExif = !isset( $options['noexif'] ); |
| 44 | + $this->checkAll = isset( $options['all'] ); |
45 | 45 | |
46 | | - if ( isset($options['wikilang']) ) { |
| 46 | + if ( isset( $options['wikilang'] ) ) { |
47 | 47 | $this->wikiCode = $options['wikilang']; |
48 | 48 | } |
49 | 49 | |
— | — | @@ -50,14 +50,16 @@ |
51 | 51 | $this->checks = explode( ',', $options['whitelist'] ); |
52 | 52 | } elseif ( isset( $options['blacklist'] ) ) { |
53 | 53 | $this->checks = array_diff( |
54 | | - $this->defaultChecks(), |
| 54 | + isset( $options['easy'] ) ? $this->easyChecks() : $this->defaultChecks(), |
55 | 55 | explode( ',', $options['blacklist'] ) |
56 | 56 | ); |
| 57 | + } elseif ( isset( $options['easy'] ) ) { |
| 58 | + $this->checks = $this->easyChecks(); |
57 | 59 | } else { |
58 | 60 | $this->checks = $this->defaultChecks(); |
59 | 61 | } |
60 | 62 | |
61 | | - if ( isset($options['output']) ) { |
| 63 | + if ( isset( $options['output'] ) ) { |
62 | 64 | $this->output = $options['output']; |
63 | 65 | } |
64 | 66 | |
— | — | @@ -78,7 +80,7 @@ |
79 | 81 | } |
80 | 82 | |
81 | 83 | /** |
82 | | - * Get the non-message checks. |
| 84 | + * Get the checks which check other things than messages. |
83 | 85 | * @return A list of the non-message checks. |
84 | 86 | */ |
85 | 87 | protected function nonMessageChecks() { |
— | — | @@ -89,6 +91,17 @@ |
90 | 92 | } |
91 | 93 | |
92 | 94 | /** |
| 95 | + * Get the checks that can easily be treated by non-speakers of the language. |
| 96 | + * @return A list of the easy checks. |
| 97 | + */ |
| 98 | + protected function easyChecks() { |
| 99 | + return array( |
| 100 | + 'duplicate', 'obsolete', 'empty', 'whitespace', 'xhtml', 'chars', 'magic-old', |
| 101 | + 'magic-over', 'magic-case', 'special-old', |
| 102 | + ); |
| 103 | + } |
| 104 | + |
| 105 | + /** |
93 | 106 | * Get all checks. |
94 | 107 | * @return An array of all check names mapped to their function names. |
95 | 108 | */ |
— | — | @@ -183,6 +196,7 @@ |
184 | 197 | * wikilang: For the links, what is the content language of the wiki to display the output in (default en). |
185 | 198 | * whitelist: Do only the following checks (form: code,code). |
186 | 199 | * blacklist: Don't do the following checks (form: code,code). |
| 200 | + * easy: Do only the easy checks, which can be treated by non-speakers of the language. |
187 | 201 | * noexif: Don't check for EXIF messages (a bit hard and boring to translate), if you know that they are currently not translated and want to focus on other problems (default off). |
188 | 202 | Check codes (ideally, all of them should result 0; all the checks are executed by default (except language-specific check blacklists in checkLanguage.inc): |
189 | 203 | * untranslated: Messages which are required to translate, but are not translated. |
— | — | @@ -452,20 +466,20 @@ |
453 | 467 | exit(); |
454 | 468 | } |
455 | 469 | |
456 | | - if ( isset($options['lang']) ) { |
| 470 | + if ( isset( $options['lang'] ) ) { |
457 | 471 | $this->code = $options['lang']; |
458 | 472 | } else { |
459 | 473 | global $wgLanguageCode; |
460 | 474 | $this->code = $wgLanguageCode; |
461 | 475 | } |
462 | 476 | |
463 | | - if ( isset($options['level']) ) { |
| 477 | + if ( isset( $options['level'] ) ) { |
464 | 478 | $this->level = $options['level']; |
465 | 479 | } |
466 | 480 | |
467 | | - $this->doLinks = isset($options['links']); |
| 481 | + $this->doLinks = isset( $options['links'] ); |
468 | 482 | |
469 | | - if ( isset($options['wikilang']) ) { |
| 483 | + if ( isset( $options['wikilang'] ) ) { |
470 | 484 | $this->wikiCode = $options['wikilang']; |
471 | 485 | } |
472 | 486 | |
— | — | @@ -473,14 +487,16 @@ |
474 | 488 | $this->checks = explode( ',', $options['whitelist'] ); |
475 | 489 | } elseif ( isset( $options['blacklist'] ) ) { |
476 | 490 | $this->checks = array_diff( |
477 | | - $this->defaultChecks(), |
| 491 | + isset( $options['easy'] ) ? $this->easyChecks() : $this->defaultChecks(), |
478 | 492 | explode( ',', $options['blacklist'] ) |
479 | 493 | ); |
| 494 | + } elseif ( isset( $options['easy'] ) ) { |
| 495 | + $this->checks = $this->easyChecks(); |
480 | 496 | } else { |
481 | 497 | $this->checks = $this->defaultChecks(); |
482 | 498 | } |
483 | 499 | |
484 | | - if ( isset($options['output']) ) { |
| 500 | + if ( isset( $options['output'] ) ) { |
485 | 501 | $this->output = $options['output']; |
486 | 502 | } |
487 | 503 | |
— | — | @@ -492,23 +508,23 @@ |
493 | 509 | $this->extensions = array(); |
494 | 510 | $extensions = new PremadeMediawikiExtensionGroups(); |
495 | 511 | $extensions->addAll(); |
496 | | - if( $extension == 'all' ) { |
497 | | - foreach( MessageGroups::singleton()->getGroups() as $group ) { |
498 | | - if( strpos( $group->getId(), 'ext-' ) === 0 && !$group->isMeta() ) { |
| 512 | + if ( $extension == 'all' ) { |
| 513 | + foreach ( MessageGroups::singleton()->getGroups() as $group ) { |
| 514 | + if ( strpos( $group->getId(), 'ext-' ) === 0 && !$group->isMeta() ) { |
499 | 515 | $this->extensions[] = new extensionLanguages( $group ); |
500 | 516 | } |
501 | 517 | } |
502 | | - } elseif( $extension == 'wikimedia' ) { |
| 518 | + } elseif ( $extension == 'wikimedia' ) { |
503 | 519 | $wikimedia = MessageGroups::getGroup( 'ext-0-wikimedia' ); |
504 | | - foreach( $wikimedia->wmfextensions() as $extension ) { |
| 520 | + foreach ( $wikimedia->wmfextensions() as $extension ) { |
505 | 521 | $group = MessageGroups::getGroup( $extension ); |
506 | 522 | $this->extensions[] = new extensionLanguages( $group ); |
507 | 523 | } |
508 | 524 | } else { |
509 | 525 | $extensions = explode( ',', $extension ); |
510 | | - foreach( $extensions as $extension ) { |
| 526 | + foreach ( $extensions as $extension ) { |
511 | 527 | $group = MessageGroups::getGroup( 'ext-' . $extension ); |
512 | | - if( $group ) { |
| 528 | + if ( $group ) { |
513 | 529 | $extension = new extensionLanguages( $group ); |
514 | 530 | $this->extensions[] = $extension; |
515 | 531 | } else { |
— | — | @@ -530,6 +546,24 @@ |
531 | 547 | } |
532 | 548 | |
533 | 549 | /** |
| 550 | + * Get the checks which check other things than messages. |
| 551 | + * @return A list of the non-message checks. |
| 552 | + */ |
| 553 | + protected function nonMessageChecks() { |
| 554 | + return array(); |
| 555 | + } |
| 556 | + |
| 557 | + /** |
| 558 | + * Get the checks that can easily be treated by non-speakers of the language. |
| 559 | + * @return A list of the easy checks. |
| 560 | + */ |
| 561 | + protected function easyChecks() { |
| 562 | + return array( |
| 563 | + 'duplicate', 'obsolete', 'empty', 'whitespace', 'xhtml', 'chars', |
| 564 | + ); |
| 565 | + } |
| 566 | + |
| 567 | + /** |
534 | 568 | * Get help. |
535 | 569 | * @return The help string. |
536 | 570 | */ |
— | — | @@ -546,7 +580,7 @@ |
547 | 581 | * wikilang: For the links, what is the content language of the wiki to display the output in (default en). |
548 | 582 | * whitelist: Do only the following checks (form: code,code). |
549 | 583 | * blacklist: Do not perform the following checks (form: code,code). |
550 | | - * duplicate: Additionally check for messages which are translated the same to English (default off). |
| 584 | + * easy: Do only the easy checks, which can be treated by non-speakers of the language. |
551 | 585 | Check codes (ideally, all of them should result 0; all the checks are executed by default (except language-specific check blacklists in checkLanguage.inc): |
552 | 586 | * untranslated: Messages which are required to translate, but are not translated. |
553 | 587 | * duplicate: Messages which translation equal to fallback |