diff options
author | Pierre Schmitz <pierre@archlinux.de> | 2013-01-18 16:46:04 +0100 |
---|---|---|
committer | Pierre Schmitz <pierre@archlinux.de> | 2013-01-18 16:46:04 +0100 |
commit | 63601400e476c6cf43d985f3e7b9864681695ed4 (patch) | |
tree | f7846203a952e38aaf66989d0a4702779f549962 /maintenance/language | |
parent | 8ff01378c9e0207f9169b81966a51def645b6a51 (diff) |
Update to MediaWiki 1.20.2
this update includes:
* adjusted Arch Linux skin
* updated FluxBBAuthPlugin
* patch for https://bugzilla.wikimedia.org/show_bug.cgi?id=44024
Diffstat (limited to 'maintenance/language')
21 files changed, 383 insertions, 260 deletions
diff --git a/maintenance/language/StatOutputs.php b/maintenance/language/StatOutputs.php index befd0d72..d77029e7 100644 --- a/maintenance/language/StatOutputs.php +++ b/maintenance/language/StatOutputs.php @@ -46,7 +46,7 @@ class statsOutput { /** Outputs WikiText */ class wikiStatsOutput extends statsOutput { function heading() { - global $wgDummyLanguageCodes, $wgContLang; + global $wgDummyLanguageCodes; $version = SpecialVersion::getVersion( 'nodb' ); echo "'''Statistics are based on:''' <code>" . $version . "</code>\n\n"; echo "'''Note:''' These statistics can be generated by running <code>php maintenance/language/transstat.php</code>.\n\n"; @@ -55,7 +55,7 @@ class wikiStatsOutput extends statsOutput { if( is_array( $wgDummyLanguageCodes ) ) { $dummyCodes = array(); foreach( $wgDummyLanguageCodes as $dummyCode => $correctCode ) { - $dummyCodes[] = $wgContLang->getLanguageName( $dummyCode ) . ' (' . $dummyCode . ')'; + $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 ); } diff --git a/maintenance/language/alltrans.php b/maintenance/language/alltrans.php index f872e6a6..8caf8677 100644 --- a/maintenance/language/alltrans.php +++ b/maintenance/language/alltrans.php @@ -17,11 +17,18 @@ * 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301, USA. * http://www.gnu.org/copyleft/gpl.html * + * @file * @ingroup MaintenanceLanguage */ -require_once( dirname( __FILE__ ) . '/../Maintenance.php' ); +require_once( __DIR__ . '/../Maintenance.php' ); +/** + * Maintenance script that gets all messages as defined by the + * English language file. + * + * @ingroup MaintenanceLanguage + */ class AllTrans extends Maintenance { public function __construct() { parent::__construct(); diff --git a/maintenance/language/checkDupeMessages.php b/maintenance/language/checkDupeMessages.php index ea5b1870..6abf7b44 100644 --- a/maintenance/language/checkDupeMessages.php +++ b/maintenance/language/checkDupeMessages.php @@ -1,6 +1,6 @@ <?php /** - * Script to print out duplicates in message array + * Print out duplicates in message array * * 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 @@ -21,8 +21,8 @@ * @ingroup MaintenanceLanguage */ -require_once( dirname( __FILE__ ) . '/../commandLine.inc' ); -$messagesDir = dirname( __FILE__ ) . '/../../languages/messages/'; +require_once( __DIR__ . '/../commandLine.inc' ); +$messagesDir = __DIR__ . '/../../languages/messages/'; $runTest = false; $run = false; $runMode = 'text'; diff --git a/maintenance/language/checkExtensions.php b/maintenance/language/checkExtensions.php index a58a8f5c..ebc62b60 100644 --- a/maintenance/language/checkExtensions.php +++ b/maintenance/language/checkExtensions.php @@ -21,7 +21,7 @@ * @ingroup MaintenanceLanguage */ -require_once( dirname( __FILE__ ) . '/../commandLine.inc' ); +require_once( __DIR__ . '/../commandLine.inc' ); require_once( 'languages.inc' ); require_once( 'checkLanguage.inc' ); diff --git a/maintenance/language/checkLanguage.inc b/maintenance/language/checkLanguage.inc index 8ab6125b..11b00e14 100644 --- a/maintenance/language/checkLanguage.inc +++ b/maintenance/language/checkLanguage.inc @@ -41,7 +41,7 @@ class CheckLanguageCLI { /** * Constructor. - * @param $options Options for script. + * @param $options array Options for script. */ public function __construct( Array $options ) { if ( isset( $options['help'] ) ) { @@ -94,7 +94,7 @@ class CheckLanguageCLI { /** * Get the default checks. - * @return A list of the default checks. + * @return array A list of the default checks. */ protected function defaultChecks() { return array( @@ -107,7 +107,7 @@ class CheckLanguageCLI { /** * 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( @@ -129,7 +129,7 @@ class CheckLanguageCLI { /** * 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( @@ -157,7 +157,7 @@ class CheckLanguageCLI { /** * 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. */ @@ -176,7 +176,7 @@ class CheckLanguageCLI { /** * 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( @@ -204,7 +204,7 @@ class CheckLanguageCLI { /** * Get help. - * @return The help string. + * @return string The help string. */ protected function help() { return <<<ENDS @@ -222,17 +222,17 @@ Parameters: --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 + --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). --whitelist: Do only the following checks (form: code,code). - --blacklist: Don't do 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 shouldn't be used. + * 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). @@ -295,7 +295,7 @@ ENDS; /** * Get the check blacklist. - * @return The list of checks which should not be executed. + * @return array The list of checks which should not be executed. */ protected function getCheckBlacklist() { global $checkBlacklist; @@ -336,9 +336,9 @@ ENDS; /** * Format a message key. - * @param $key The message key. - * @param $code The language code. - * @return The formatted message key. + * @param $key string The message key. + * @param $code string The language code. + * @return string The formatted message key. */ protected function formatKey( $key, $code ) { if ( $this->doLinks ) { @@ -355,7 +355,6 @@ ENDS; /** * Output the checks results as plain text. - * @return The checks results as plain text. */ protected function outputText() { foreach ( $this->results as $code => $results ) { @@ -401,10 +400,8 @@ ENDS; /** * Output the checks results as wiki text. - * @return The checks results as wiki text. */ function outputWiki() { - global $wgContLang; $detailText = ''; $rows[] = '! Language !! Code !! Total !! ' . implode( ' !! ', array_diff( $this->checks, $this->nonMessageChecks() ) ); foreach ( $this->results as $code => $results ) { @@ -440,7 +437,7 @@ ENDS; # Don't list languages without problems continue; } - $language = $wgContLang->getLanguageName( $code ); + $language = Language::fetchLanguageName( $code ); $rows[] = "| $language || $code || $problems || " . implode( ' || ', $numbers ); } @@ -462,7 +459,7 @@ EOL; /** * Check if there are any results for the checks, in any language. - * @return True if there are any results, false if not. + * @return bool True if there are any results, false if not. */ protected function isEmpty() { foreach( $this->results as $results ) { @@ -484,8 +481,8 @@ class CheckExtensionsCLI extends CheckLanguageCLI { /** * Constructor. - * @param $options Options for script. - * @param $extension The extension name (or names). + * @param $options array Options for script. + * @param $extension string The extension name (or names). */ public function __construct( Array $options, $extension ) { if ( isset( $options['help'] ) ) { @@ -569,7 +566,7 @@ class CheckExtensionsCLI extends CheckLanguageCLI { /** * Get the default checks. - * @return A list of the default checks. + * @return array A list of the default checks. */ protected function defaultChecks() { return array( @@ -580,7 +577,7 @@ class CheckExtensionsCLI extends CheckLanguageCLI { /** * 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(); @@ -588,7 +585,7 @@ class CheckExtensionsCLI extends CheckLanguageCLI { /** * Get the checks that can easily be treated by non-speakers of the language. - * @return A list of the easy checks. + * @return arrayA list of the easy checks. */ protected function easyChecks() { return array( @@ -598,7 +595,7 @@ class CheckExtensionsCLI extends CheckLanguageCLI { /** * Get help. - * @return The help string. + * @return string The help string. */ protected function help() { return <<<ENDS diff --git a/maintenance/language/checkLanguage.php b/maintenance/language/checkLanguage.php index 69f61084..99ba4e98 100644 --- a/maintenance/language/checkLanguage.php +++ b/maintenance/language/checkLanguage.php @@ -21,7 +21,7 @@ * @ingroup MaintenanceLanguage */ -require_once( dirname( __FILE__ ) . '/../commandLine.inc' ); +require_once( __DIR__ . '/../commandLine.inc' ); require_once( 'checkLanguage.inc' ); require_once( 'languages.inc' ); diff --git a/maintenance/language/countMessages.php b/maintenance/language/countMessages.php index f949ddc2..5058a549 100644 --- a/maintenance/language/countMessages.php +++ b/maintenance/language/countMessages.php @@ -17,11 +17,18 @@ * 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301, USA. * http://www.gnu.org/copyleft/gpl.html * + * @file * @ingroup MaintenanceLanguage */ -require_once( dirname( __FILE__ ) . '/../Maintenance.php' ); +require_once( __DIR__ . '/../Maintenance.php' ); +/** + * Maintenance script that counts how many messages we have defined + * for each language. + * + * @ingroup MaintenanceLanguage + */ class CountMessages extends Maintenance { public function __construct() { parent::__construct(); diff --git a/maintenance/language/date-formats.php b/maintenance/language/date-formats.php index 04f5e8ba..ed12b786 100644 --- a/maintenance/language/date-formats.php +++ b/maintenance/language/date-formats.php @@ -17,11 +17,17 @@ * 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301, USA. * http://www.gnu.org/copyleft/gpl.html * + * @file * @ingroup MaintenanceLanguage */ -require_once( dirname( __FILE__ ) . '/../Maintenance.php' ); +require_once( __DIR__ . '/../Maintenance.php' ); +/** + * Maintenance script that tests various language time and date functions. + * + * @ingroup MaintenanceLanguage + */ class DateFormats extends Maintenance { private $ts = '20010115123456'; diff --git a/maintenance/language/digit2html.php b/maintenance/language/digit2html.php index a80ac014..9d4cbe7e 100644 --- a/maintenance/language/digit2html.php +++ b/maintenance/language/digit2html.php @@ -1,5 +1,7 @@ <?php /** + * Check digit transformation + * * 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 @@ -15,11 +17,17 @@ * 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301, USA. * http://www.gnu.org/copyleft/gpl.html * + * @file * @ingroup MaintenanceLanguage */ -require_once( dirname( __FILE__ ) . '/../Maintenance.php' ); +require_once( __DIR__ . '/../Maintenance.php' ); +/** + * Maintenance script that check digit transformation. + * + * @ingroup MaintenanceLanguage + */ class Digit2Html extends Maintenance { # A list of unicode numerals is available at: diff --git a/maintenance/language/dumpMessages.php b/maintenance/language/dumpMessages.php index 9bdda09d..0292d314 100644 --- a/maintenance/language/dumpMessages.php +++ b/maintenance/language/dumpMessages.php @@ -18,24 +18,30 @@ * 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301, USA. * http://www.gnu.org/copyleft/gpl.html * + * @file * @ingroup MaintenanceLanguage - * @todo Make this more useful, right now just dumps $wgContentLang + * @todo Make this more useful, right now just dumps $wgContLang */ -require_once( dirname( __FILE__ ) . '/../Maintenance.php' ); +require_once( __DIR__ . '/../Maintenance.php' ); +/** + * Maintenance script that dumps an entire language, using the keys from English. + * + * @ingroup MaintenanceLanguage + */ class DumpMessages extends Maintenance { public function __construct() { parent::__construct(); $this->mDescription = "Dump an entire language, using the keys from English"; } - + public function execute() { global $wgVersion; $messages = array(); foreach ( array_keys( Language::getMessagesFor( 'en' ) ) as $key ) { - $messages[$key] = wfMsg( $key ); + $messages[$key] = wfMessage( $key )->text(); } $this->output( "MediaWiki $wgVersion language file\n" ); $this->output( serialize( $messages ) ); diff --git a/maintenance/language/generateCollationData.php b/maintenance/language/generateCollationData.php index e5ce5c87..e34d9a13 100644 --- a/maintenance/language/generateCollationData.php +++ b/maintenance/language/generateCollationData.php @@ -1,13 +1,32 @@ <?php /** - * @ingroup Maintenance + * Maintenance script to generate first letter data files for Collation.php. + * + * 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 */ -require_once( dirname( __FILE__ ) .'/../Maintenance.php' ); +require_once( __DIR__ .'/../Maintenance.php' ); /** * Generate first letter data files for Collation.php + * + * @ingroup MaintenanceLanguage */ class GenerateCollationData extends Maintenance { /** The directory with source data files in it */ @@ -386,4 +405,3 @@ class UcdXmlReader { $maintClass = 'GenerateCollationData'; require_once( RUN_MAINTENANCE_IF_MAIN ); - diff --git a/maintenance/language/generateNormalizerData.php b/maintenance/language/generateNormalizerData.php index a958abf1..54dfa39a 100644 --- a/maintenance/language/generateNormalizerData.php +++ b/maintenance/language/generateNormalizerData.php @@ -21,13 +21,15 @@ * @ingroup MaintenanceLanguage */ -require_once( dirname( __FILE__ ) . '/../Maintenance.php' ); +require_once( __DIR__ . '/../Maintenance.php' ); -require_once( dirname( __FILE__ ) . '/../../includes/normal/UtfNormalUtil.php' ); +require_once( __DIR__ . '/../../includes/normal/UtfNormalUtil.php' ); /** * Generates normalizer data files for Arabic and Malayalam. * For NFC see includes/normal. + * + * @ingroup MaintenanceLanguage */ class GenerateNormalizerData extends Maintenance { var $dataFile; @@ -155,4 +157,3 @@ class GenerateNormalizerData extends Maintenance { $maintClass = 'GenerateNormalizerData'; require_once( RUN_MAINTENANCE_IF_MAIN ); - diff --git a/maintenance/language/lang2po.php b/maintenance/language/lang2po.php deleted file mode 100644 index 7e5dc472..00000000 --- a/maintenance/language/lang2po.php +++ /dev/null @@ -1,166 +0,0 @@ -<?php -/** - * Convert Language files to .po files ! - * - * Todo: - * - generate .po header - * - fix escaping of \ - * - * 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 - * - * @ingroup MaintenanceLanguage - */ - -/** This is a command line script */ -require_once( dirname( __FILE__ ) . '/../Maintenance.php' ); -require_once( dirname( __FILE__ ) . '/languages.inc' ); - -define( 'ALL_LANGUAGES', true ); -define( 'XGETTEXT_BIN', 'xgettext' ); -define( 'MSGMERGE_BIN', 'msgmerge' ); - -// used to generate the .pot -define( 'XGETTEXT_OPTIONS', '-n --keyword=wfMsg --keyword=wfMsgForContent --keyword=wfMsgHtml --keyword=wfMsgWikiHtml ' ); -define( 'MSGMERGE_OPTIONS', ' -v ' ); - -define( 'LOCALE_OUTPUT_DIR', $IP . '/locale' ); - -class Lang2Po extends Maintenance { - public function __construct() { - parent::__construct(); - $this->mDescription = ""; - $this->addOption( 'lang', 'a lang code you want to generate a .po for (default: all langs)', false, true ); - } - - public function execute() { - // Generate a template .pot based on source tree - $this->output( "Getting 'gettext' default messages from sources:" ); - $this->generatePot(); - $this->output( "done.\n" ); - - - $langTool = new languages(); - if ( $this->getOption( 'lang', ALL_LANGUAGES ) === ALL_LANGUAGES ) { - $codes = $langTool->getLanguages(); - } else { - $codes = array( $this->getOption( 'lang' ) ); - } - - // Do all languages - foreach ( $codes as $langcode ) { - $this->output( "Loading messages for $langcode:\n" ); - if ( !$this->generatePo( $langcode, $langTool->getMessages( $langcode ) ) ) { - $this->error( "ERROR: Failed to write file." ); - } else { - $this->output( "Applying template:" ); - $this->applyPot( $langcode ); - } - } - } - - /** - * Return a dummy header for later edition. - * - * @return String: a dummy header - */ - private function poHeader() { - return '# SOME DESCRIPTIVE TITLE. -# Copyright (C) 2005 MediaWiki -# This file is distributed under the same license as the MediaWiki package. -# FIRST AUTHOR <EMAIL@ADDRESS>, YEAR. -# -#, fuzzy -msgid "" -msgstr "" -"Project-Id-Version: PACKAGE VERSION\n" -"Report-Msgid-Bugs-To: bugzilllaaaaa\n" -"POT-Creation-Date: 2005-08-16 20:13+0200\n" -"PO-Revision-Date: YEAR-MO-DA HO:MI+ZONE\n" -"Last-Translator: VARIOUS <nobody>\n" -"Language-Team: LANGUAGE <nobody>\n" -"MIME-Version: 1.0\n" -"Content-Type: text/plain; charset=UTF-8\n" -"Content-Transfer-Encoding: 8bit\n" -'; - } - - /** - * generate and write a file in .po format. - * - * @param $langcode String: code of a language it will process. - * @param $messages Array containing the various messages. - * @return string Filename where stuff got saved or false. - */ - private function generatePo( $langcode, $messages ) { - $data = $this->poHeader(); - - // Generate .po entries - foreach ( $messages['all'] as $identifier => $content ) { - $data .= "msgid \"$identifier\"\n"; - - // Escape backslashes - $tmp = str_replace( '\\', '\\\\', $content ); - // Escape doublelquotes - $tmp = preg_replace( "/(?<!\\\\)\"/", '\"', $tmp ); - // Rewrite multilines to gettext format - $tmp = str_replace( "\n", "\"\n\"", $tmp ); - - $data .= 'msgstr "' . $tmp . "\"\n\n"; - } - - // Write the content to a file in locale/XX/messages.po - $dir = LOCALE_OUTPUT_DIR . '/' . $langcode; - if ( !is_dir( $dir ) ) { mkdir( $dir, 0770 ); } - $filename = $dir . '/fromlanguagefile.po'; - - $file = fopen( $filename , 'wb' ); - if ( fwrite( $file, $data ) ) { - fclose( $file ); - return $filename; - } else { - fclose( $file ); - return false; - } - } - - private function generatePot() { - global $IP; - $curdir = getcwd(); - chdir( $IP ); - exec( XGETTEXT_BIN - . ' ' . XGETTEXT_OPTIONS - . ' -o ' . LOCALE_OUTPUT_DIR . '/wfMsg.pot' - . ' includes/*php' - ); - chdir( $curdir ); - } - - private function applyPot( $langcode ) { - $langdir = LOCALE_OUTPUT_DIR . '/' . $langcode; - - $from = $langdir . '/fromlanguagefile.po'; - $pot = LOCALE_OUTPUT_DIR . '/wfMsg.pot'; - $dest = $langdir . '/messages.po'; - - // Merge template and generate file to get final .po - exec( MSGMERGE_BIN . MSGMERGE_OPTIONS . " $from $pot -o $dest " ); - // delete no more needed file - // unlink($from); - } -} - -$maintClass = "Lang2Po"; -require_once( RUN_MAINTENANCE_IF_MAIN ); diff --git a/maintenance/language/langmemusage.php b/maintenance/language/langmemusage.php index 28fe120e..2323638e 100644 --- a/maintenance/language/langmemusage.php +++ b/maintenance/language/langmemusage.php @@ -22,8 +22,8 @@ */ /** This is a command line script */ -require_once( dirname( __FILE__ ) . '/../Maintenance.php' ); -require_once( dirname( __FILE__ ) . '/languages.inc' ); +require_once( __DIR__ . '/../Maintenance.php' ); +require_once( __DIR__ . '/languages.inc' ); class LangMemUsage extends Maintenance { diff --git a/maintenance/language/languages.inc b/maintenance/language/languages.inc index 06102ac1..b76f921d 100644 --- a/maintenance/language/languages.inc +++ b/maintenance/language/languages.inc @@ -43,10 +43,10 @@ class languages { * Load the list of languages: all the Messages*.php * files in the languages directory. * - * @param $exif Treat the EXIF messages? + * @param $exif bool Treat the EXIF messages? */ function __construct( $exif = true ) { - require( dirname(__FILE__) . '/messageTypes.inc' ); + require( __DIR__ . '/messageTypes.inc' ); $this->mIgnoredMessages = $wgIgnoredMessages; if ( $exif ) { $this->mOptionalMessages = array_merge( $wgOptionalMessages ); @@ -54,7 +54,7 @@ class languages { $this->mOptionalMessages = array_merge( $wgOptionalMessages, $wgEXIFMessages ); } - $this->mLanguages = array_keys( Language::getLanguageNames( true ) ); + $this->mLanguages = array_keys( Language::fetchLanguageNames( null, 'mwfile' ) ); sort( $this->mLanguages ); } @@ -244,7 +244,7 @@ class languages { * * @param $code string The language code. * - * @return Namespace names. + * @return array Namespace names. */ public function getNamespaceNames( $code ) { $this->loadFile( $code ); @@ -256,7 +256,7 @@ class languages { * * @param $code string The language code. * - * @return Namespace aliases. + * @return array Namespace aliases. */ public function getNamespaceAliases( $code ) { $this->loadFile( $code ); @@ -268,7 +268,7 @@ class languages { * * @param $code string The language code. * - * @return Magic words. + * @return array Magic words. */ public function getMagicWords( $code ) { $this->loadFile( $code ); @@ -280,7 +280,7 @@ class languages { * * @param $code string The language code. * - * @return Special page aliases. + * @return array Special page aliases. */ public function getSpecialPageAliases( $code ) { $this->loadFile( $code ); @@ -734,7 +734,7 @@ class extensionLanguages extends languages { /** * Load the messages group. - * @param $group The messages group. + * @param $group MessageGroup The messages group. */ function __construct( MessageGroup $group ) { $this->mMessageGroup = $group; diff --git a/maintenance/language/messageTypes.inc b/maintenance/language/messageTypes.inc index 1c33667a..ce1dbb9b 100644 --- a/maintenance/language/messageTypes.inc +++ b/maintenance/language/messageTypes.inc @@ -123,6 +123,7 @@ $wgIgnoredMessages = array( 'pubmedurl', 'randompage-url', 'recentchanges-url', + 'recentchangestext', 'revision-info-current', 'revision-nav', 'rfcurl', @@ -136,6 +137,7 @@ $wgIgnoredMessages = array( 'sitetitle', 'sp-contributions-footer', 'sp-contributions-footer-anon', + 'sp-contributions-footer-newbies', 'statistics-summary', 'statistics-footer', 'talkpagetext', @@ -161,11 +163,13 @@ $wgIgnoredMessages = array( 'wantedcategories-summary', 'wantedfiles-summary', 'wantedpages-summary', + 'watchlist-summary', 'mostlinked-summary', 'mostlinkedcategories-summary', 'mostlinkedtemplates-summary', 'mostcategories-summary', 'mostimages-summary', + 'mostinterwikis-summary', 'mostrevisions-summary', 'prefixindex-summary', 'shortpages-summary', @@ -185,12 +189,63 @@ $wgIgnoredMessages = array( 'wantedtemplates-summary', 'activeusers-summary', 'search-summary', + 'editpage-head-copy-warn', 'editpage-tos-summary', 'addsection-preload', 'addsection-editintro', 'longpage-hint', 'javascripttest-backlink', 'javascripttest-qunit-name', + 'revdelete-logentry', + 'logdelete-logentry', + 'revdelete-content', + 'revdelete-summary', + 'revdelete-uname', + 'revdelete-hid', + 'revdelete-unhid', + 'revdelete-log-message', + 'logdelete-log-message', + 'deletedarticle', + 'suppressedarticle', + 'undeletedarticle', + 'patrol-log-line', + 'patrol-log-auto', + 'patrol-log-diff', + '1movedto2', + '1movedto2_redir', + 'move-redirect-suppressed', + // 'newuserlog-byemail', + 'newuserlog-create-entry', + 'newuserlog-create2-entry', + 'newuserlog-autocreate-entry', + 'suppressedarticle', + 'deletedarticle', + // 'uploadedimage', + // 'overwroteimage', + 'userlogout-summary', + 'changeemail-summary', + 'changepassword-summary', + 'unusedcategories-summary', + 'unusedimages-summary', + 'deletedcontributions-summary', + 'linksearch-summary', + 'emailuser-summary', + 'undelete-summary', + 'contributions-summary', + 'unblock-summary', + 'movepage-summary', + 'export-summary', + 'import-summary', + 'editwatchlist-summary', + 'version-summary', + 'tags-summary', + 'comparepages-summary', + 'version-entrypoints-index-php', + 'version-entrypoints-api-php', + 'version-entrypoints-load-php', + 'ipb-default-expiry', + 'pageinfo-header', + 'pageinfo-footer', ); /** Optional messages, which may be translated only if changed in the target language. */ @@ -201,7 +256,6 @@ $wgOptionalMessages = array( 'feed-rss', 'unit-pixel', 'userrights-irreversible-marker', - 'tog-nolangconversion', 'tog-noconvertlink', 'variantname-zh-hans', 'variantname-zh-hant', @@ -402,6 +456,7 @@ $wgOptionalMessages = array( 'ellipsis', 'percent', 'parentheses', + 'brackets', 'autocomment-prefix', 'listgrouprights-right-display', 'listgrouprights-right-revoked', @@ -418,6 +473,12 @@ $wgOptionalMessages = array( 'metadata-langitem', 'metadata-langitem-default', 'nocookiesforlogin', + 'version-entrypoints-articlepath', + 'version-entrypoints-scriptpath', + 'mergehistory-revisionrow', + 'categoryviewer-pagedlinks', + 'undelete-revisionrow', + 'pageinfo-redirects-value', ); /** EXIF messages, which may be set as optional in several checks, but are generally mandatory */ diff --git a/maintenance/language/messages.inc b/maintenance/language/messages.inc index bee5a67c..29269175 100644 --- a/maintenance/language/messages.inc +++ b/maintenance/language/messages.inc @@ -28,7 +28,6 @@ $wgMessageStructure = array( ), 'toggles' => array( 'tog-underline', - 'tog-highlightbroken', 'tog-justify', 'tog-hideminor', 'tog-hidepatrolled', @@ -68,7 +67,6 @@ $wgMessageStructure = array( 'tog-watchlisthideliu', 'tog-watchlisthideanons', 'tog-watchlisthidepatrolled', - 'tog-nolangconversion', 'tog-ccmeonemails', 'tog-diffonly', 'tog-showhiddencats', @@ -158,6 +156,7 @@ $wgMessageStructure = array( 'index-category', 'noindex-category', 'broken-file-category', + 'categoryviewer-pagedlinks', ), 'mainpage' => array( 'linkprefix', @@ -306,6 +305,10 @@ $wgMessageStructure = array( 'youhavenewmessages', 'newmessageslink', 'newmessagesdifflink', + 'youhavenewmessagesfromusers', + 'youhavenewmessagesmanyusers', + 'newmessageslinkplural', + 'newmessagesdifflinkplural', 'youhavenewmessagesmulti', 'newtalkseparator', 'editsection', @@ -368,9 +371,9 @@ $wgMessageStructure = array( 'readonly', 'enterlockreason', 'readonlytext', - 'missing-article', - 'missingarticle-rev', - 'missingarticle-diff', + 'missing-article', // not used anymore in core, but kept for extensions + 'missingarticle-rev', // not used anymore in core, but kept for extensions + 'missingarticle-diff', // not used anymore in core, but kept for extensions 'readonly_lag', 'internalerror', 'internalerror_info', @@ -387,6 +390,7 @@ $wgMessageStructure = array( 'badarticleerror', 'cannotdelete', 'cannotdelete-title', + 'delete-hook-aborted', 'badtitle', 'badtitletext', 'perfcached', @@ -409,6 +413,11 @@ $wgMessageStructure = array( 'customjsprotected', 'ns-specialprotected', 'titleprotected', + 'filereadonlyerror', + 'invalidtitle-knownnamespace', + 'invalidtitle-unknownnamespace', + 'exception-nologin', + 'exception-nologin-text', ), 'virus' => array( 'virus-badscanner', @@ -424,6 +433,7 @@ $wgMessageStructure = array( 'remembermypassword', 'securelogin-stick-https', 'yourdomainname', + 'password-change-forbidden', 'externaldberror', 'login', 'nav-login-createaccount', @@ -432,6 +442,7 @@ $wgMessageStructure = array( 'userloginnocreate', 'logout', 'userlogout', + 'userlogout-summary', 'notloggedin', 'nologin', 'nologinlink', @@ -484,6 +495,7 @@ $wgMessageStructure = array( 'emailconfirmlink', 'invalidemailaddress', 'cannotchangeemail', + 'emaildisabled', 'accountcreated', 'accountcreatedtext', 'createaccount-title', @@ -539,6 +551,7 @@ $wgMessageStructure = array( ), 'changeemail' => array( 'changeemail', + 'changeemail-summary', 'changeemail-header', 'changeemail-text', 'changeemail-no-info', @@ -606,6 +619,7 @@ $wgMessageStructure = array( 'noarticletext', 'noarticletext-nopermission', 'noarticletextanon', + 'missing-revision', 'userpage-userdoesnotexist', 'userpage-userdoesnotexist-view', 'blocked-notice-logextract', @@ -620,12 +634,14 @@ $wgMessageStructure = array( 'updated', 'note', 'previewnote', + 'continue-editing', 'previewconflict', 'session_fail_preview', 'session_fail_preview_html', 'token_suffix_mismatch', 'edit_form_incomplete', 'editing', + 'creating', 'editingsection', 'editingcomment', 'editconflict', @@ -637,6 +653,7 @@ $wgMessageStructure = array( 'yourdiff', 'copyrightwarning', 'copyrightwarning2', + 'editpage-head-copy-warn', 'editpage-tos-summary', 'longpage-hint', 'longpageerror', @@ -671,6 +688,7 @@ $wgMessageStructure = array( 'edit-already-exists', 'addsection-preload', 'addsection-editintro', + 'defaultmessagetext', ), 'parserwarnings' => array( 'expensive-parserfunction-warning', @@ -682,6 +700,13 @@ $wgMessageStructure = array( 'parser-template-loop-warning', 'parser-template-recursion-depth-warning', 'language-converter-depth-warning', + 'node-count-exceeded-category', + 'node-count-exceeded-warning', + 'expansion-depth-exceeded-category', + 'expansion-depth-exceeded-warning', + 'parser-unstrip-loop-warning', + 'parser-unstrip-recursion-limit', + 'converter-manual-rule-error', ), 'undo' => array( 'undo-success', @@ -818,7 +843,8 @@ $wgMessageStructure = array( 'mergehistory-autocomment', 'mergehistory-comment', 'mergehistory-same-destination', - 'mergehistory-reason' + 'mergehistory-reason', + 'mergehistory-revisionrow' ), 'mergelog' => array( 'mergelog', @@ -828,7 +854,8 @@ $wgMessageStructure = array( ), 'diffs' => array( 'history-title', - 'difference', + 'difference-title', + 'difference-title-multipage', 'difference-multipage', 'lineno', 'compareselectedversions', @@ -836,6 +863,7 @@ $wgMessageStructure = array( 'editundo', 'diff-multi', 'diff-multi-manyusers', + 'difference-missing-revision', ), 'search' => array( 'search-summary', @@ -882,8 +910,6 @@ $wgMessageStructure = array( 'search-interwiki-default', 'search-interwiki-custom', 'search-interwiki-more', - 'search-mwsuggest-enabled', - 'search-mwsuggest-disabled', 'search-relatedarticle', 'mwsuggest-disable', 'searcheverything-enable', @@ -926,12 +952,14 @@ $wgMessageStructure = array( 'prefsnologin', 'prefsnologintext', 'changepassword', + 'changepassword-summary', 'prefs-skin', 'skin-preview', 'datedefault', 'prefs-beta', 'prefs-datetime', 'prefs-labs', + 'prefs-user-pages', 'prefs-personal', 'prefs-rc', 'prefs-watchlist', @@ -1112,6 +1140,7 @@ $wgMessageStructure = array( 'right-writeapi', 'right-delete', 'right-bigdelete', + 'right-deletelogentry', 'right-deleterevision', 'right-deletedhistory', 'right-deletedtext', @@ -1197,6 +1226,7 @@ $wgMessageStructure = array( 'recentchanges', 'recentchanges-url', 'recentchanges-legend', + 'recentchanges-summary', 'recentchangestext', 'recentchanges-feed-description', 'recentchanges-label-newpage', @@ -1346,6 +1376,7 @@ $wgMessageStructure = array( 'upload-too-many-redirects', 'upload-unknown-size', 'upload-http-error', + 'upload-copy-upload-invalid-domain', ), 'filebackend-errors' => array( @@ -1365,12 +1396,19 @@ $wgMessageStructure = array( 'backend-fail-closetemp', 'backend-fail-read', 'backend-fail-create', + 'backend-fail-maxsize', 'backend-fail-readonly', 'backend-fail-synced', 'backend-fail-connect', 'backend-fail-internal', 'backend-fail-contenttype', - 'backend-fail-batchsize' + 'backend-fail-batchsize', + 'backend-fail-usable' + ), + + 'filejournal-errors' => array( + 'filejournal-fail-dbconnect', + 'filejournal-fail-dbquery' ), 'lockmanager-errors' => array( @@ -1379,9 +1417,11 @@ $wgMessageStructure = array( 'lockmanager-fail-deletelock', 'lockmanager-fail-acquirelock', 'lockmanager-fail-openlock', + 'lockmanager-fail-acquirelock', 'lockmanager-fail-releaselock', 'lockmanager-fail-db-bucket', 'lockmanager-fail-db-release', + 'lockmanager-fail-svr-acquire', 'lockmanager-fail-svr-release' ), @@ -1484,6 +1524,8 @@ $wgMessageStructure = array( 'sharedupload', 'sharedupload-desc-there', 'sharedupload-desc-here', + 'sharedupload-desc-edit', + 'sharedupload-desc-create', 'shareddescriptionfollows', 'filepage-nofile', 'filepage-nofile-link', @@ -1492,6 +1534,7 @@ $wgMessageStructure = array( 'shared-repo', 'shared-repo-name-wikimediacommons', 'filepage.css', + 'upload-disallowed-here', ), 'filerevert' => array( 'filerevert', @@ -1607,6 +1650,7 @@ $wgMessageStructure = array( 'specialpages' => array( 'nbytes', 'ncategories', + 'ninterwikis', 'nlinks', 'nmembers', 'nrevisions', @@ -1627,7 +1671,9 @@ $wgMessageStructure = array( 'uncategorizedtemplates', 'uncategorizedtemplates-summary', 'unusedcategories', + 'unusedcategories-summary', 'unusedimages', + 'unusedimages-summary', 'popularpages', 'popularpages-summary', 'wantedcategories', @@ -1651,6 +1697,8 @@ $wgMessageStructure = array( 'mostcategories-summary', 'mostimages', 'mostimages-summary', + 'mostinterwikis', + 'mostinterwikis-summary', 'mostrevisions', 'mostrevisions-summary', 'prefixindex', @@ -1718,6 +1766,7 @@ $wgMessageStructure = array( 'alllogstext', 'logempty', 'log-title-wildcard', + 'showhideselectedlogentries', ), 'allpages' => array( 'allpages', @@ -1736,6 +1785,12 @@ $wgMessageStructure = array( 'allpagesprefix', 'allpagesbadtitle', 'allpages-bad-ns', + 'allpages-hide-redirects', + ), + 'cachedspecial' => array( + 'cachedspecial-viewing-cached-ttl', + 'cachedspecial-viewing-cached-ts', + 'cachedspecial-refresh-now', ), 'categories' => array( 'categories', @@ -1747,11 +1802,13 @@ $wgMessageStructure = array( ), 'deletedcontribs' => array( 'deletedcontributions', + 'deletedcontributions-summary', 'deletedcontributions-title', 'sp-deletedcontributions-contribs', ), 'linksearch' => array( 'linksearch', + 'linksearch-summary', 'linksearch-pat', 'linksearch-ns', 'linksearch-ok', @@ -1804,6 +1861,9 @@ $wgMessageStructure = array( 'mailnologin', 'mailnologintext', 'emailuser', + 'emailuser-title-target', + 'emailuser-title-notarget', + 'emailuser-summary', 'emailpage', 'emailpagetext', 'usermailererror', @@ -1837,6 +1897,7 @@ $wgMessageStructure = array( ), 'watchlist' => array( 'watchlist', + 'watchlist-summary', 'mywatchlist', 'watchlistfor2', 'nowatchlist', @@ -1913,6 +1974,8 @@ $wgMessageStructure = array( 'rollback', 'rollback_short', 'rollbacklink', + 'rollbacklinkcount', + 'rollbacklinkcount-morethan', 'rollbackfailed', 'cantrollback', 'alreadyrolled', @@ -1985,6 +2048,7 @@ $wgMessageStructure = array( ), 'undelete' => array( 'undelete', + 'undelete-summary', 'undeletepage', 'undeletepagetitle', 'viewdeletedpage', @@ -2024,6 +2088,7 @@ $wgMessageStructure = array( 'undelete-error-long', 'undelete-show-file-confirm', 'undelete-show-file-submit', + 'undelete-revisionrow', ), 'nsform' => array( 'namespace', @@ -2035,6 +2100,7 @@ $wgMessageStructure = array( ), 'contributions' => array( 'contributions', + 'contributions-summary', 'contributions-title', 'mycontris', 'contribsub2', @@ -2062,6 +2128,7 @@ $wgMessageStructure = array( 'sp-contributions-explain', 'sp-contributions-footer', 'sp-contributions-footer-anon', + 'sp-contributions-footer-newbies', ), 'whatlinkshere' => array( 'whatlinkshere', @@ -2087,6 +2154,7 @@ $wgMessageStructure = array( 'autoblockid', 'block', 'unblock', + 'unblock-summary', 'blockip', 'blockip-title', 'blockip-legend', @@ -2197,6 +2265,7 @@ $wgMessageStructure = array( 'cant-see-hidden-user', 'ipbblocked', 'ipbnounblockself', + 'ipb-default-expiry', ), 'developertools' => array( 'lockdb', @@ -2218,6 +2287,7 @@ $wgMessageStructure = array( ), 'movepage' => array( 'move-page', + 'movepage-summary', 'move-page-legend', 'movepagetext', 'movepagetext-noredirectfixer', @@ -2279,6 +2349,7 @@ $wgMessageStructure = array( ), 'export' => array( 'export', + 'export-summary', 'exporttext', 'exportall', 'exportcuronly', @@ -2325,6 +2396,7 @@ $wgMessageStructure = array( ), 'import' => array( 'import', + 'import-summary', 'importinterwiki', 'import-interwiki-text', 'import-interwiki-source', @@ -2332,6 +2404,7 @@ $wgMessageStructure = array( 'import-interwiki-templates', 'import-interwiki-submit', 'import-interwiki-namespace', + 'import-interwiki-rootpage', 'import-upload-filename', 'import-comment', 'importtext', @@ -2363,6 +2436,9 @@ $wgMessageStructure = array( 'import-error-interwiki', 'import-error-special', 'import-error-invalid', + 'import-options-wrong', + 'import-rootpage-invalid', + 'import-rootpage-nosubpage', ), 'importlog' => array( 'importlogpage', @@ -2583,19 +2659,41 @@ $wgMessageStructure = array( 'spambot_username', 'spam_reverting', 'spam_blanking', + 'spam_deleting', ), 'info' => array( + 'pageinfo-header', 'pageinfo-title', + 'pageinfo-not-current', + 'pageinfo-header-basic', 'pageinfo-header-edits', - 'pageinfo-header-watchlist', - 'pageinfo-header-views', - 'pageinfo-subjectpage', - 'pageinfo-talkpage', + 'pageinfo-header-restrictions', + 'pageinfo-header-properties', + 'pageinfo-display-title', + 'pageinfo-default-sort', + 'pageinfo-length', + 'pageinfo-article-id', + 'pageinfo-robot-policy', + 'pageinfo-robot-index', + 'pageinfo-robot-noindex', + 'pageinfo-views', 'pageinfo-watchers', + 'pageinfo-redirects-name', + 'pageinfo-redirects-value', + 'pageinfo-subpages-name', + 'pageinfo-subpages-value', + 'pageinfo-firstuser', + 'pageinfo-firsttime', + 'pageinfo-lastuser', + 'pageinfo-lasttime', 'pageinfo-edits', 'pageinfo-authors', - 'pageinfo-views', - 'pageinfo-viewsperedit', + 'pageinfo-recent-edits', + 'pageinfo-recent-authors', + 'pageinfo-magic-words', + 'pageinfo-hidden-categories', + 'pageinfo-templates', + 'pageinfo-footer', ), 'skin' => array( 'skinname-standard', @@ -2649,6 +2747,7 @@ $wgMessageStructure = array( 'file-info-size-pages', 'file-nohires', 'svg-long-desc', + 'svg-long-desc-animated', 'show-big-image', 'show-big-image-preview', 'show-big-image-other', @@ -2658,6 +2757,8 @@ $wgMessageStructure = array( 'file-info-png-looped', 'file-info-png-repeat', 'file-info-png-frames', + 'file-no-thumb-animation', + 'file-no-thumb-animation-gif', ), 'newfiles' => array( 'newimages', @@ -3274,6 +3375,7 @@ $wgMessageStructure = array( 'ellipsis', 'percent', 'parentheses', + 'brackets', ), 'imgmulti' => array( 'imgmultipageprev', @@ -3338,6 +3440,7 @@ $wgMessageStructure = array( 'confirm-watch-button', ), 'watchlisteditor' => array( + 'editwatchlist-summary', 'watchlistedit-numitems', 'watchlistedit-noitems', 'watchlistedit-normal-title', @@ -3428,6 +3531,7 @@ $wgMessageStructure = array( ), 'version' => array( 'version', + 'version-summary', 'version-extensions', 'version-specialpages', 'version-parserhooks', @@ -3452,6 +3556,14 @@ $wgMessageStructure = array( 'version-software', 'version-software-product', 'version-software-version', + 'version-entrypoints', + 'version-entrypoints-header-entrypoint', + 'version-entrypoints-header-url', + 'version-entrypoints-articlepath', + 'version-entrypoints-scriptpath', + 'version-entrypoints-index-php', + 'version-entrypoints-api-php', + 'version-entrypoints-load-php', ), 'filepath' => array( 'filepath', @@ -3496,6 +3608,7 @@ $wgMessageStructure = array( ), 'special-tags' => array( 'tags', + 'tags-summary', 'tag-filter', 'tag-filter-submit', 'tags-title', @@ -3509,6 +3622,7 @@ $wgMessageStructure = array( ), 'comparepages' => array( 'comparepages', + 'comparepages-summary', 'compare-selector', 'compare-page1', 'compare-page2', @@ -3579,6 +3693,34 @@ $wgMessageStructure = array( 'logentry-newusers-autocreate', 'newuserlog-byemail', ), + 'logging-irc' => array( + 'revdelete-logentry', + 'logdelete-logentry', + 'revdelete-content', + 'revdelete-summary', + 'revdelete-uname', + 'revdelete-hid', + 'revdelete-unhid', + 'revdelete-log-message', + 'logdelete-log-message', + 'deletedarticle', + 'suppressedarticle', + 'undeletedarticle', + 'patrol-log-line', + 'patrol-log-auto', + 'patrol-log-diff', + '1movedto2', + '1movedto2_redir', + 'move-redirect-suppressed', + // 'newuserlog-byemail', + 'newuserlog-create-entry', + 'newuserlog-create2-entry', + 'newuserlog-autocreate-entry', + 'suppressedarticle', + 'deletedarticle', + // 'uploadedimage', + // 'overwroteimage', + ), 'feedback' => array( 'feedback-bugornote', 'feedback-subject', @@ -3594,6 +3736,10 @@ $wgMessageStructure = array( 'feedback-bugcheck', 'feedback-bugnew', ), + 'searchsuggestions' => array( + 'searchsuggest-search', + 'searchsuggest-containing', + ), 'apierrors' => array( 'api-error-badaccess-groups', 'api-error-badtoken', @@ -3605,9 +3751,12 @@ $wgMessageStructure = array( 'api-error-empty-file', 'api-error-emptypage', 'api-error-fetchfileerror', + 'api-error-fileexists-forbidden', + 'api-error-fileexists-shared-forbidden', 'api-error-file-too-large', 'api-error-filename-tooshort', 'api-error-filetype-banned', + 'api-error-filetype-banned-type', 'api-error-filetype-missing', 'api-error-hookaborted', 'api-error-http', @@ -3632,6 +3781,17 @@ $wgMessageStructure = array( 'api-error-uploaddisabled', 'api-error-verification-error', ), + 'duration' => array( + 'duration-seconds', + 'duration-minutes', + 'duration-hours', + 'duration-days', + 'duration-weeks', + 'duration-years', + 'duration-decades', + 'duration-centuries', + 'duration-millennia' + ), ); /** Comments for each block */ @@ -3696,6 +3856,7 @@ XHTML id names.", 'zip' => 'ZipDirectoryReader', 'upload-errors' => '', 'filebackend-errors' => 'File backend', + 'filejournal-errors' => 'File journal errors', 'lockmanager-errors' => 'Lock manager', 'uploadstash' => 'Special:UploadStash', 'img-auth' => 'img_auth script messages', @@ -3866,6 +4027,10 @@ Variants for Chinese language", 'html-forms' => 'HTML forms', 'sqlite' => 'SQLite database support', 'logging' => 'New logging system', + 'logging-irc' => 'For IRC, see bug 34508. Do not change', 'feedback' => 'Feedback', + 'searchsuggestions' => 'Search suggestions', 'apierrors' => 'API errors', + 'duration' => 'Durations', + 'cachedspecial' => 'SpecialCachedPage', ); diff --git a/maintenance/language/rebuildLanguage.php b/maintenance/language/rebuildLanguage.php index 9b3a4b9d..ad839054 100644 --- a/maintenance/language/rebuildLanguage.php +++ b/maintenance/language/rebuildLanguage.php @@ -22,7 +22,7 @@ * @defgroup MaintenanceLanguage MaintenanceLanguage */ -require_once( dirname( __FILE__ ) . '/../commandLine.inc' ); +require_once( __DIR__ . '/../commandLine.inc' ); require_once( 'languages.inc' ); require_once( 'writeMessagesArray.inc' ); @@ -30,27 +30,28 @@ require_once( 'writeMessagesArray.inc' ); * Rewrite a messages array. * * @param $languages - * @param $code The language code. + * @param $code string The language code. * @param bool $write Write to the messages file? * @param bool $listUnknown List the unknown messages? * @param bool $removeUnknown Remove the unknown messages? * @param bool $removeDupes Remove the duplicated messages? - * @param $dupeMsgSource The source file intended to remove from the array. + * @param $dupeMsgSource string The source file intended to remove from the array. + * @param $messagesFolder String: path to a folder to store the MediaWiki messages. */ -function rebuildLanguage( $languages, $code, $write, $listUnknown, $removeUnknown, $removeDupes, $dupeMsgSource ) { +function rebuildLanguage( $languages, $code, $write, $listUnknown, $removeUnknown, $removeDupes, $dupeMsgSource, $messagesFolder ) { $messages = $languages->getMessages( $code ); $messages = $messages['all']; if ( $removeDupes ) { $messages = removeDupes( $messages, $dupeMsgSource ); } - MessageWriter::writeMessagesToFile( $messages, $code, $write, $listUnknown, $removeUnknown ); + MessageWriter::writeMessagesToFile( $messages, $code, $write, $listUnknown, $removeUnknown, $messagesFolder ); } /** * Remove duplicates from a message array. * - * @param $oldMsgArray The input message array. - * @param $dupeMsgSource The source file path for duplicates. + * @param $oldMsgArray array The input message array. + * @param $dupeMsgSource string The source file path for duplicates. * @return Array $newMsgArray The output message array, with duplicates removed. */ function removeDupes( $oldMsgArray, $dupeMsgSource ) { @@ -85,6 +86,7 @@ Options: * no-unknown: Do not list the unknown messages. * remove-unknown: Remove unknown messages. * remove-duplicates: Remove duplicated messages based on a PHP source file. + * messages-folder: An alternative folder with MediaWiki messages. TEXT; exit( 1 ); @@ -109,6 +111,7 @@ $wgWriteToFile = !isset( $options['dry-run'] ); $wgListUnknownMessages = !isset( $options['no-unknown'] ); $wgRemoveUnknownMessages = isset( $options['remove-unknown'] ); $wgRemoveDuplicateMessages = isset( $options['remove-duplicates'] ); +$messagesFolder = isset( $options['messages-folder'] ) ? $options['messages-folder'] : false; # Get language objects $languages = new languages(); @@ -116,8 +119,8 @@ $languages = new languages(); # Write all the language if ( $wgCode == 'all' ) { foreach ( $languages->getLanguages() as $languageCode ) { - rebuildLanguage( $languages, $languageCode, $wgWriteToFile, $wgListUnknownMessages, $wgRemoveUnknownMessages, $wgRemoveDuplicateMessages, $wgDupeMessageSource ); + rebuildLanguage( $languages, $languageCode, $wgWriteToFile, $wgListUnknownMessages, $wgRemoveUnknownMessages, $wgRemoveDuplicateMessages, $wgDupeMessageSource, $messagesFolder ); } } else { - rebuildLanguage( $languages, $wgCode, $wgWriteToFile, $wgListUnknownMessages, $wgRemoveUnknownMessages, $wgRemoveDuplicateMessages, $wgDupeMessageSource ); + rebuildLanguage( $languages, $wgCode, $wgWriteToFile, $wgListUnknownMessages, $wgRemoveUnknownMessages, $wgRemoveDuplicateMessages, $wgDupeMessageSource, $messagesFolder ); } diff --git a/maintenance/language/transstat.php b/maintenance/language/transstat.php index fb08b7d0..ba503224 100644 --- a/maintenance/language/transstat.php +++ b/maintenance/language/transstat.php @@ -28,9 +28,9 @@ */ $optionsWithArgs = array( 'output' ); -require_once( dirname( __FILE__ ) . '/../commandLine.inc' ); +require_once( __DIR__ . '/../commandLine.inc' ); require_once( 'languages.inc' ); -require_once( dirname( __FILE__ ) . '/StatOutputs.php' ); +require_once( __DIR__ . '/StatOutputs.php' ); if ( isset( $options['help'] ) ) { @@ -102,7 +102,7 @@ foreach ( $wgLanguages->getLanguages() as $code ) { } # Calculate the numbers - $language = $wgContLang->getLanguageName( $code ); + $language = Language::fetchLanguageName( $code ); $fallback = $wgLanguages->getFallback( $code ); $messages = $wgLanguages->getMessages( $code ); $messagesNumber = count( $messages['translated'] ); @@ -134,5 +134,3 @@ foreach ( $wgLanguages->getLanguages() as $code ) { # Footer $output->footer(); - - diff --git a/maintenance/language/validate.php b/maintenance/language/validate.php index 57517644..751e744d 100644 --- a/maintenance/language/validate.php +++ b/maintenance/language/validate.php @@ -30,7 +30,7 @@ array_shift( $argv ); define( 'MEDIAWIKI', 1 ); define( 'NOT_REALLY_MEDIAWIKI', 1 ); -$IP = dirname( __FILE__ ) . '/../..'; +$IP = __DIR__ . '/../..'; require_once( "$IP/includes/Defines.php" ); require_once( "$IP/languages/Language.php" ); @@ -58,4 +58,3 @@ function getVars( $filename ) { unset( $vars['filename'] ); return $vars; } - diff --git a/maintenance/language/writeMessagesArray.inc b/maintenance/language/writeMessagesArray.inc index 524c2ba6..b2e04c7f 100644 --- a/maintenance/language/writeMessagesArray.inc +++ b/maintenance/language/writeMessagesArray.inc @@ -41,16 +41,28 @@ class MessageWriter { * @param $write Boolean: write to the messages file? * @param $listUnknown Boolean: list the unknown messages? * @param $removeUnknown Boolean: whether to remove unkown messages + * @param $messagesFolder String: path to a folder to store the MediaWiki messages. Defaults to the current install. */ - public static function writeMessagesToFile( $messages, $code, $write, $listUnknown, $removeUnknown ) { + public static function writeMessagesToFile( $messages, $code, $write, $listUnknown, $removeUnknown, $messagesFolder = false ) { # Rewrite the messages array $messages = self::writeMessagesArray( $messages, $code == 'en', false, $removeUnknown ); $messagesText = $messages[0]; $sortedMessages = $messages[1]; # Write to the file - $filename = Language::getMessagesFileName( $code ); - $contents = file_get_contents( $filename ); + if ( $messagesFolder ) + $filename = Language::getFileName( "$messagesFolder/Messages", $code ); + else + $filename = Language::getMessagesFileName( $code ); + + if ( file_exists( $filename ) ) + $contents = file_get_contents( $filename ); + else + $contents = '<?php +$messages = array( +); +'; + if( strpos( $contents, '$messages' ) !== false ) { $contents = explode( '$messages', $contents ); if( $messagesText == '$messages' . $contents[1] ) { @@ -93,7 +105,7 @@ class MessageWriter { */ public static function writeMessagesArray( $messages, $ignoredComments = false, $prefix = false, $removeUnknown = false ) { # Load messages - $dir = $prefix ? $prefix : dirname( __FILE__ ); + $dir = $prefix ? $prefix : __DIR__; require( $dir . '/messages.inc' ); self::$messageStructure = $wgMessageStructure; @@ -156,6 +168,7 @@ class MessageWriter { * @param $messages Array: key of messages. * @param $ignored Array: list of ingored message keys. * @param $optional Array: list of optional message keys. + * @return array */ public static function makeComments( $messages, $ignored, $optional ) { # Comment collector @@ -181,7 +194,7 @@ class MessageWriter { * @param $messageComments Array: optional comments for messages in this block. * @param $prefix String: prefix for every line, for indenting purposes. * - * @return The block, formatted in PHP. + * @return string The block, formatted in PHP. */ public static function writeMessagesBlock( $blockComment, $messages, $messageComments = array(), $prefix = '' ) { |