X-Git-Url: https://scripts.mit.edu/gitweb/autoinstallsdev/mediawiki.git/blobdiff_plain/19e297c21b10b1b8a3acad5e73fc71dcb35db44a..6932310fd58ebef145fa01eb76edf7150284d8ea:/maintenance/language/checkLanguage.inc diff --git a/maintenance/language/checkLanguage.inc b/maintenance/language/checkLanguage.inc index d8480c0f..9e9fd3ee 100644 --- a/maintenance/language/checkLanguage.inc +++ b/maintenance/language/checkLanguage.inc @@ -1,31 +1,51 @@ help(); - exit(1); + exit( 1 ); } if ( isset( $options['lang'] ) ) { @@ -68,122 +88,126 @@ class CheckLanguageCLI { $this->output = $options['output']; } - $this->L = new languages( $this->includeExif ); + $this->L = new Languages( $this->includeExif ); } /** * Get the default checks. - * @return A list of the default checks. + * @return array A list of the default checks. */ protected function defaultChecks() { - return array( + return [ 'untranslated', 'duplicate', 'obsolete', 'variables', 'empty', 'plural', 'whitespace', 'xhtml', 'chars', 'links', 'unbalanced', 'namespace', 'projecttalk', 'magic', 'magic-old', 'magic-over', 'magic-case', 'special', 'special-old', - ); + ]; } /** * Get the checks which check other things than messages. - * @return A list of the non-message checks. + * @return array A list of the non-message checks. */ protected function nonMessageChecks() { - return array( + return [ 'namespace', 'projecttalk', 'magic', 'magic-old', 'magic-over', 'magic-case', 'special', 'special-old', - ); + ]; } /** * Get the checks that can easily be treated by non-speakers of the language. - * @return A list of the easy checks. + * @return array A list of the easy checks. */ protected function easyChecks() { - return array( + return [ 'duplicate', 'obsolete', 'empty', 'whitespace', 'xhtml', 'chars', 'magic-old', 'magic-over', 'magic-case', 'special-old', - ); + ]; } /** * Get all checks. - * @return An array of all check names mapped to their function names. + * @return array An array of all check names mapped to their function names. */ protected function getChecks() { - return array( + return [ 'untranslated' => 'getUntranslatedMessages', - 'duplicate' => 'getDuplicateMessages', - 'obsolete' => 'getObsoleteMessages', - 'variables' => 'getMessagesWithMismatchVariables', - 'plural' => 'getMessagesWithoutPlural', - 'empty' => 'getEmptyMessages', - 'whitespace' => 'getMessagesWithWhitespace', - 'xhtml' => 'getNonXHTMLMessages', - 'chars' => 'getMessagesWithWrongChars', - 'links' => 'getMessagesWithDubiousLinks', - 'unbalanced' => 'getMessagesWithUnbalanced', - 'namespace' => 'getUntranslatedNamespaces', - 'projecttalk' => 'getProblematicProjectTalks', - 'magic' => 'getUntranslatedMagicWords', - 'magic-old' => 'getObsoleteMagicWords', - 'magic-over' => 'getOverridingMagicWords', - 'magic-case' => 'getCaseMismatchMagicWords', - 'special' => 'getUntraslatedSpecialPages', - 'special-old' => 'getObsoleteSpecialPages', - ); + 'duplicate' => 'getDuplicateMessages', + 'obsolete' => 'getObsoleteMessages', + 'variables' => 'getMessagesWithMismatchVariables', + 'plural' => 'getMessagesWithoutPlural', + 'empty' => 'getEmptyMessages', + 'whitespace' => 'getMessagesWithWhitespace', + 'xhtml' => 'getNonXHTMLMessages', + 'chars' => 'getMessagesWithWrongChars', + 'links' => 'getMessagesWithDubiousLinks', + 'unbalanced' => 'getMessagesWithUnbalanced', + 'namespace' => 'getUntranslatedNamespaces', + 'projecttalk' => 'getProblematicProjectTalks', + 'magic' => 'getUntranslatedMagicWords', + 'magic-old' => 'getObsoleteMagicWords', + 'magic-over' => 'getOverridingMagicWords', + 'magic-case' => 'getCaseMismatchMagicWords', + 'special' => 'getUntraslatedSpecialPages', + 'special-old' => 'getObsoleteSpecialPages', + ]; } /** * Get total count for each check non-messages check. - * @return An array of all check names mapped to a two-element array: + * @return array An array of all check names mapped to a two-element array: * function name to get the total count and language code or null * for checked code. */ protected function getTotalCount() { - return array( - 'namespace' => array( 'getNamespaceNames', 'en' ), - 'projecttalk' => null, - 'magic' => array( 'getMagicWords', 'en' ), - 'magic-old' => array( 'getMagicWords', null ), - 'magic-over' => array( 'getMagicWords', null ), - 'magic-case' => array( 'getMagicWords', null ), - 'special' => array( 'getSpecialPageAliases', 'en' ), - 'special-old' => array( 'getSpecialPageAliases', null ), - ); + return [ + 'namespace' => [ 'getNamespaceNames', 'en' ], + 'projecttalk' => null, + 'magic' => [ 'getMagicWords', 'en' ], + 'magic-old' => [ 'getMagicWords', null ], + 'magic-over' => [ 'getMagicWords', null ], + 'magic-case' => [ 'getMagicWords', null ], + 'special' => [ 'getSpecialPageAliases', 'en' ], + 'special-old' => [ 'getSpecialPageAliases', null ], + ]; } /** * Get all check descriptions. - * @return An array of all check names mapped to their descriptions. + * @return array An array of all check names mapped to their descriptions. */ protected function getDescriptions() { - return array( + return [ 'untranslated' => '$1 message(s) of $2 are not translated to $3, but exist in en:', - 'duplicate' => '$1 message(s) of $2 are translated the same in en and $3:', - 'obsolete' => '$1 message(s) of $2 do not exist in en or are in the ignore list, but exist in $3:', - 'variables' => '$1 message(s) of $2 in $3 don\'t match the variables used in en:', - 'plural' => '$1 message(s) of $2 in $3 don\'t use {{plural}} while en uses:', - 'empty' => '$1 message(s) of $2 in $3 are empty or -:', - 'whitespace' => '$1 message(s) of $2 in $3 have trailing whitespace:', - 'xhtml' => '$1 message(s) of $2 in $3 contain illegal XHTML:', - 'chars' => '$1 message(s) of $2 in $3 include hidden chars which should not be used in the messages:', - 'links' => '$1 message(s) of $2 in $3 have problematic link(s):', - 'unbalanced' => '$1 message(s) of $2 in $3 have unbalanced {[]}:', - 'namespace' => '$1 namespace name(s) of $2 are not translated to $3, but exist in en:', - 'projecttalk' => '$1 namespace name(s) and alias(es) in $3 are project talk namespaces without the parameter:', - 'magic' => '$1 magic word(s) of $2 are not translated to $3, but exist in en:', - 'magic-old' => '$1 magic word(s) of $2 do not exist in en, but exist in $3:', - 'magic-over' => '$1 magic word(s) of $2 in $3 do not contain the original en word(s):', - 'magic-case' => '$1 magic word(s) of $2 in $3 change the case-sensitivity of the original en word:', - 'special' => '$1 special page alias(es) of $2 are not translated to $3, but exist in en:', - 'special-old' => '$1 special page alias(es) of $2 do not exist in en, but exist in $3:', - ); + 'duplicate' => '$1 message(s) of $2 are translated the same in en and $3:', + 'obsolete' => + '$1 message(s) of $2 do not exist in en or are in the ignore list, but exist in $3:', + 'variables' => '$1 message(s) of $2 in $3 don\'t match the variables used in en:', + 'plural' => '$1 message(s) of $2 in $3 don\'t use {{plural}} while en uses:', + 'empty' => '$1 message(s) of $2 in $3 are empty or -:', + 'whitespace' => '$1 message(s) of $2 in $3 have trailing whitespace:', + 'xhtml' => '$1 message(s) of $2 in $3 contain illegal XHTML:', + 'chars' => + '$1 message(s) of $2 in $3 include hidden chars which should not be used in the messages:', + 'links' => '$1 message(s) of $2 in $3 have problematic link(s):', + 'unbalanced' => '$1 message(s) of $2 in $3 have unbalanced {[]}:', + 'namespace' => '$1 namespace name(s) of $2 are not translated to $3, but exist in en:', + 'projecttalk' => + '$1 namespace name(s) and alias(es) in $3 are project talk namespaces without the parameter:', + 'magic' => '$1 magic word(s) of $2 are not translated to $3, but exist in en:', + 'magic-old' => '$1 magic word(s) of $2 do not exist in en, but exist in $3:', + 'magic-over' => '$1 magic word(s) of $2 in $3 do not contain the original en word(s):', + 'magic-case' => + '$1 magic word(s) of $2 in $3 change the case-sensitivity of the original en word:', + 'special' => '$1 special page alias(es) of $2 are not translated to $3, but exist in en:', + 'special-old' => '$1 special page alias(es) of $2 do not exist in en, but exist in $3:', + ]; } /** * Get help. - * @return The help string. + * @return string The help string. */ protected function help() { return <<