<?php
/**
+ * Helper class for checkLanguage.php script.
+ *
+ * This program is free software; you can redistribute it and/or modify
+ * it under the terms of the GNU General Public License as published by
+ * the Free Software Foundation; either version 2 of the License, or
+ * (at your option) any later version.
+ *
+ * This program is distributed in the hope that it will be useful,
+ * but WITHOUT ANY WARRANTY; without even the implied warranty of
+ * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
+ * GNU General Public License for more details.
+ *
+ * You should have received a copy of the GNU General Public License along
+ * with this program; if not, write to the Free Software Foundation, Inc.,
+ * 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301, USA.
+ * http://www.gnu.org/copyleft/gpl.html
+ *
+ * @file
* @ingroup MaintenanceLanguage
*/
+/**
+ * @ingroup MaintenanceLanguage
+ */
class CheckLanguageCLI {
protected $code = null;
protected $level = 2;
/**
* 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(
Run this script to check a specific language file, or all of them.
Command line settings are in form --parameter[=value].
Parameters:
- * lang: Language code (default: the installation default language).
- * all: Check all customized languages.
- * help: Show this help.
- * level: Show the following display level (default: 2).
- * 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).
- * whitelist: Do only the following checks (form: code,code).
- * blacklist: Don't do the following checks (form: code,code).
- * easy: Do only the easy checks, which can be treated by non-speakers of the language.
- * 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).
+ --help: Show this help.
+ --lang: Language code (default: the installation default language).
+ --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.
+ --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: 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).
+ --whitelist: Do only the following checks (form: code,code).
+ --blacklist: Don't 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
* 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.
-Display levels (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.
ENDS;
}
* @return The checks results as wiki text.
*/
function outputWiki() {
- global $wgContLang, $IP;
+ global $wgContLang;
$detailText = '';
$rows[] = '! Language !! Code !! Total !! ' . implode( ' !! ', array_diff( $this->checks, $this->nonMessageChecks() ) );
foreach ( $this->results as $code => $results ) {
* @return True if there are any results, false if not.
*/
protected function isEmpty() {
- foreach( $this->results as $code => $results ) {
- foreach( $results as $check => $messages ) {
+ foreach( $this->results as $results ) {
+ foreach( $results as $messages ) {
if( !empty( $messages ) ) {
return false;
}
}
}
+/**
+ * @ingroup MaintenanceLanguage
+ */
class CheckExtensionsCLI extends CheckLanguageCLI {
private $extensions;