From c6f256a8f737cc45fe25f8720eca62f8e95f04cd Mon Sep 17 00:00:00 2001 From: Siebrand Mazeland Date: Mon, 11 Nov 2013 16:13:11 +0100 Subject: [PATCH] Break long lines Also: * Remove an unneeded constant MEDIAWIKI check in a file with all classes. * Document some variables. Reduces PHP CodeSniffer errors and warnings. Change-Id: I67bccf82e90302d13ad8fd04c8a4b75ac5edd984 --- maintenance/language/StatOutputs.php | 16 +-- maintenance/language/checkLanguage.inc | 109 ++++++++++++------ .../language/generateNormalizerData.php | 3 +- maintenance/language/languages.inc | 88 +++++++++----- maintenance/language/messages.inc | 9 +- maintenance/language/rebuildLanguage.php | 41 ++++++- maintenance/language/transstat.php | 25 +++- maintenance/language/writeMessagesArray.inc | 42 +++++-- 8 files changed, 239 insertions(+), 94 deletions(-) diff --git a/maintenance/language/StatOutputs.php b/maintenance/language/StatOutputs.php index e102a3c409..e7e230ffcc 100644 --- a/maintenance/language/StatOutputs.php +++ b/maintenance/language/StatOutputs.php @@ -1,7 +1,4 @@ " . $version . "\n\n"; - echo "'''Note:''' These statistics can be generated by running php maintenance/language/transstat.php.\n\n"; - echo "For additional information on specific languages (the message names, the actual problems, etc.), run php maintenance/language/checkLanguage.php --lang=foo.\n\n"; + echo "'''Note:''' These statistics can be generated by running " . + "php maintenance/language/transstat.php.\n\n"; + echo "For additional information on specific languages (the message names, the actual " . + "problems, etc.), run php maintenance/language/checkLanguage.php --lang=foo.\n\n"; echo 'English (en) is excluded because it is the default localization'; if ( is_array( $wgDummyLanguageCodes ) ) { $dummyCodes = array(); foreach ( $wgDummyLanguageCodes as $dummyCode => $correctCode ) { $dummyCodes[] = Language::fetchLanguageName( $dummyCode ) . ' (' . $dummyCode . ')'; } - echo ', as well as the following languages that are not intended for system message translations, usually because they redirect to other language codes: ' . implode( ', ', $dummyCodes ); + echo ', as well as the following languages that are not intended for ' . + 'system message translations, usually because they redirect to other ' . + 'language codes: ' . implode( ', ', $dummyCodes ); } echo ".\n\n"; # dot to end sentence - echo '{| class="sortable wikitable" border="2" style="background-color: #F9F9F9; border: 1px #AAAAAA solid; border-collapse: collapse; clear:both; width:100%;"' . "\n"; + echo '{| class="sortable wikitable" border="2" style="background-color: #F9F9F9; ' . + 'border: 1px #AAAAAA solid; border-collapse: collapse; clear:both; width:100%;"' . "\n"; } function footer() { diff --git a/maintenance/language/checkLanguage.inc b/maintenance/language/checkLanguage.inc index 62cc6cb229..212a0d1567 100644 --- a/maintenance/language/checkLanguage.inc +++ b/maintenance/language/checkLanguage.inc @@ -182,21 +182,25 @@ class CheckLanguageCLI { return array( '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:', + '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:', + '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:', + '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:', + '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:', ); @@ -216,35 +220,49 @@ Parameters: --all: Check all customized languages. --level: Show the following display level (default: 2): * 0: Skip the checks (useful for checking syntax). - * 1: Show only the stub headers and number of wrong messages, without list of messages. - * 2: Show only the headers and the message keys, without the message values. - * 3: Show both the headers and the complete messages, with both keys and values. + * 1: Show only the stub headers and number of wrong messages, without + list of messages. + * 2: Show only the headers and the message keys, without the message + values. + * 3: Show both the headers and the complete messages, with both keys and + values. --links: Link the message values (default off). --prefix: prefix to add to links. - --wikilang: For the links, what is the content language of the wiki to display the output in (default en). - --noexif: Do not 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). + --wikilang: For the links, what is the content language of the wiki to + display the output in (default en). + --noexif: Do not check for Exif messages (a bit hard and boring to + translate), if you know what they are currently not translated and want + to focus on other problems (default off). --whitelist: Do only the following checks (form: code,code). --blacklist: Do not do the following checks (form: code,code). - --easy: Do only the easy checks, which can be treated by non-speakers of the language. - -Check codes (ideally, all of them should result 0; all the checks are executed by default (except language-specific check blacklists in checkLanguage.inc): - * untranslated: Messages which are required to translate, but are not translated. - * duplicate: Messages which translation equal to fallback - * obsolete: Messages which are untranslatable or do not exist, but are translated. - * variables: Messages without variables which should be used, or with variables which should not be used. + --easy: Do only the easy checks, which can be treated by non-speakers of + the language. + +Check codes (ideally, all of them should result 0; all the checks are executed +by default (except language-specific check blacklists in checkLanguage.inc): + * untranslated: Messages which are required to translate, but are not + translated. + * duplicate: Messages which translation equal to fallback. + * obsolete: Messages which are untranslatable or do not exist, but are + translated. + * variables: Messages without variables which should be used, or with + variables which should not be used. * empty: Empty messages and messages that contain only -. * whitespace: Messages which have trailing whitespace. - * xhtml: Messages which are not well-formed XHTML (checks only few common errors). + * xhtml: Messages which are not well-formed XHTML (checks only few common + errors). * chars: Messages with hidden characters. * links: Messages which contains broken links to pages (does not find all). - * unbalanced: Messages which contains unequal numbers of opening {[ and closing ]}. + * unbalanced: Messages which contains unequal numbers of opening {[ and + closing ]}. * namespace: Namespace names that were not translated. - * projecttalk: Namespace names and aliases where the project talk does not contain $1. + * projecttalk: Namespace names and aliases where the project talk does not + contain $1. * magic: Magic words that were not translated. * magic-old: Magic words which do not exist. * magic-over: Magic words that override the original English word. - * magic-case: Magic words whose translation changes the case-sensitivity of the original English word. + * magic-case: Magic words whose translation changes the case-sensitivity of + the original English word. * special: Special page names that were not translated. * special-old: Special page names which do not exist. @@ -457,7 +475,8 @@ ENDS; */ function outputWiki() { $detailText = ''; - $rows[] = '! Language !! Code !! Total !! ' . implode( ' !! ', array_diff( $this->checks, $this->nonMessageChecks() ) ); + $rows[] = '! Language !! Code !! Total !! ' . + implode( ' !! ', array_diff( $this->checks, $this->nonMessageChecks() ) ); foreach ( $this->results as $code => $results ) { $detailTextForLang = "==$code==\n"; $numbers = array(); @@ -497,6 +516,7 @@ ENDS; $tableRows = implode( "\n|-\n", $rows ); $version = SpecialVersion::getVersion( 'nodb' ); + // @codingStandardsIgnoreStart Long line. echo <<$version @@ -508,6 +528,7 @@ $tableRows $detailText EOL; + // @codingStandardsIgnoreEnd } /** @@ -653,34 +674,50 @@ class CheckExtensionsCLI extends CheckLanguageCLI { */ protected function help() { return <<