From 370e83bb0dfd0c70de268c93bf07ad5ee0897192 Mon Sep 17 00:00:00 2001 From: Pierre Schmitz Date: Fri, 15 Aug 2008 01:29:47 +0200 Subject: Update auf 1.13.0 --- maintenance/language/checkLanguage.php | 306 +-------------------------------- 1 file changed, 3 insertions(+), 303 deletions(-) (limited to 'maintenance/language/checkLanguage.php') diff --git a/maintenance/language/checkLanguage.php b/maintenance/language/checkLanguage.php index 36d32a48..f8553a1e 100644 --- a/maintenance/language/checkLanguage.php +++ b/maintenance/language/checkLanguage.php @@ -2,313 +2,13 @@ /** * Check a language file. * - * @addtogroup Maintenance + * @file + * @ingroup MaintenanceLanguage */ require_once( dirname(__FILE__).'/../commandLine.inc' ); +require_once( 'checkLanguage.inc' ); require_once( 'languages.inc' ); $cli = new CheckLanguageCLI( $options ); $cli->execute(); - -class CheckLanguageCLI { - private $code = null; - private $level = 2; - private $doLinks = false; - private $wikiCode = 'en'; - private $includeExif = false; - private $checkAll = false; - private $output = 'plain'; - private $checks = array(); - - private $defaultChecks = array( - 'untranslated', 'obsolete', 'variables', 'empty', 'plural', - 'whitespace', 'xhtml', 'chars', 'links', 'unbalanced' - ); - - private $L = null; - - /** - * GLOBALS: $wgLanguageCode; - */ - public function __construct( Array $options ) { - - if ( isset( $options['help'] ) ) { - echo $this->help(); - exit(); - } - - if ( isset($options['lang']) ) { - $this->code = $options['lang']; - } else { - global $wgLanguageCode; - $this->code = $wgLanguageCode; - } - - if ( isset($options['level']) ) { - $this->level = $options['level']; - } - - $this->doLinks = isset($options['links']); - $this->includeExif = !isset($options['noexif']); - $this->checkAll = isset($options['all']); - - if ( isset($options['wikilang']) ) { - $this->wikiCode = $options['wikilang']; - } - - if ( isset( $options['whitelist'] ) ) { - $this->checks = explode( ',', $options['whitelist'] ); - } elseif ( isset( $options['blacklist'] ) ) { - $this->checks = array_diff( - $this->defaultChecks, - explode( ',', $options['blacklist'] ) - ); - } else { - $this->checks = $this->defaultChecks; - } - - if ( isset($options['output']) ) { - $this->output = $options['output']; - } - - # Some additional checks not enabled by default - if ( isset( $options['duplicate'] ) ) { - $this->checks[] = 'duplicate'; - } - - $this->L = new languages( $this->includeExif ); - } - - protected function getChecks() { - $checks = array(); - $checks['untranslated'] = 'getUntranslatedMessages'; - $checks['duplicate'] = 'getDuplicateMessages'; - $checks['obsolete'] = 'getObsoleteMessages'; - $checks['variables'] = 'getMessagesWithoutVariables'; - $checks['plural'] = 'getMessagesWithoutPlural'; - $checks['empty'] = 'getEmptyMessages'; - $checks['whitespace'] = 'getMessagesWithWhitespace'; - $checks['xhtml'] = 'getNonXHTMLMessages'; - $checks['chars'] = 'getMessagesWithWrongChars'; - $checks['links'] = 'getMessagesWithDubiousLinks'; - $checks['unbalanced'] = 'getMessagesWithUnbalanced'; - return $checks; - } - - protected function getDescriptions() { - $descriptions = array(); - $descriptions['untranslated'] = '$1 message(s) of $2 are not translated to $3, but exist in en:'; - $descriptions['duplicate'] = '$1 message(s) of $2 are translated the same in en and $3:'; - $descriptions['obsolete'] = '$1 message(s) of $2 do not exist in en or are in the ignore list, but are in $3'; - $descriptions['variables'] = '$1 message(s) of $2 in $3 don\'t use some variables that en uses:'; - $descriptions['plural'] = '$1 message(s) of $2 in $3 don\'t use {{plural}} while en uses:'; - $descriptions['empty'] = '$1 message(s) of $2 in $3 are empty or -:'; - $descriptions['whitespace'] = '$1 message(s) of $2 in $3 have trailing whitespace:'; - $descriptions['xhtml'] = '$1 message(s) of $2 in $3 contain illegal XHTML:'; - $descriptions['chars'] = '$1 message(s) of $2 in $3 include hidden chars which should not be used in the messages:'; - $descriptions['links'] = '$1 message(s) of $2 in $3 have problematic link(s):'; - $descriptions['unbalanced'] = '$1 message(s) of $2 in $3 have unbalanced {[]}:'; - return $descriptions; - } - - protected function help() { - return <<