summaryrefslogtreecommitdiff
path: root/maintenance/language
diff options
context:
space:
mode:
Diffstat (limited to 'maintenance/language')
-rw-r--r--maintenance/language/StatOutputs.php14
-rw-r--r--maintenance/language/alltrans.php40
-rw-r--r--maintenance/language/checkDupeMessages.php118
-rw-r--r--maintenance/language/checkExtensions.php4
-rw-r--r--maintenance/language/checkLanguage.inc39
-rw-r--r--maintenance/language/countMessages.php87
-rw-r--r--maintenance/language/date-formats.php102
-rw-r--r--maintenance/language/diffLanguage.php6
-rw-r--r--maintenance/language/digit2html.php68
-rw-r--r--maintenance/language/dumpMessages.php48
-rw-r--r--maintenance/language/generateNormalizerData.php137
-rw-r--r--maintenance/language/lang2po.php225
-rw-r--r--maintenance/language/langmemusage.php58
-rw-r--r--maintenance/language/languages.inc18
-rw-r--r--maintenance/language/makeMessageDB.php45
-rw-r--r--maintenance/language/messageTypes.inc25
-rw-r--r--maintenance/language/messages.inc520
-rw-r--r--maintenance/language/rebuildLanguage.php55
-rw-r--r--maintenance/language/transstat.php71
-rw-r--r--maintenance/language/writeMessagesArray.inc25
20 files changed, 1148 insertions, 557 deletions
diff --git a/maintenance/language/StatOutputs.php b/maintenance/language/StatOutputs.php
index b41278b4..169a4d41 100644
--- a/maintenance/language/StatOutputs.php
+++ b/maintenance/language/StatOutputs.php
@@ -32,7 +32,7 @@ class statsOutput {
class wikiStatsOutput extends statsOutput {
function heading() {
global $IP;
- $version = SpecialVersion::getVersion( $IP );
+ $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";
echo "For additional information on specific languages (the message names, the actual problems, etc.), run <code>php maintenance/language/checkLanguage.php --lang=foo</code>.\n\n";
@@ -72,18 +72,6 @@ class wikiStatsOutput extends statsOutput {
}
}
-/** Outputs WikiText and appends category and text only used for Meta-Wiki */
-class metawikiStatsOutput extends wikiStatsOutput {
- function heading() {
- echo "See [[MediaWiki localisation]] to learn how you can help translating MediaWiki.\n\n";
- parent::heading();
- }
- function footer() {
- parent::footer();
- echo "\n[[Category:Localisation|Statistics]]\n";
- }
-}
-
/** Output text. To be used on a terminal for example. */
class textStatsOutput extends statsOutput {
function element( $in, $heading = false ) {
diff --git a/maintenance/language/alltrans.php b/maintenance/language/alltrans.php
index 67c870e6..420386fd 100644
--- a/maintenance/language/alltrans.php
+++ b/maintenance/language/alltrans.php
@@ -1,16 +1,40 @@
<?php
/**
- * @file
- * @ingroup MaintenanceLanguage
- *
* Get all the translations messages, as defined in the English language file.
+ *
+ * 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
*/
-require_once( dirname(__FILE__).'/../commandLine.inc' );
+require_once( dirname(__FILE__) . '/../Maintenance.php' );
-$wgEnglishMessages = array_keys( Language::getMessagesFor( 'en' ) );
-foreach( $wgEnglishMessages as $key ) {
- echo "$key\n";
-}
+class AllTrans extends Maintenance {
+ public function __construct() {
+ parent::__construct();
+ $this->mDescription = "Get all messages as defined by the English language file";
+ }
+ public function execute() {
+ $wgEnglishMessages = array_keys( Language::getMessagesFor( 'en' ) );
+ foreach( $wgEnglishMessages as $key ) {
+ $this->output( "$key\n" );
+ }
+ }
+}
+$maintClass = "AllTrans";
+require_once( DO_MAINTENANCE );
diff --git a/maintenance/language/checkDupeMessages.php b/maintenance/language/checkDupeMessages.php
new file mode 100644
index 00000000..81eafccf
--- /dev/null
+++ b/maintenance/language/checkDupeMessages.php
@@ -0,0 +1,118 @@
+<?php
+/**
+ * @todo document
+ * @file
+ * @ingroup MaintenanceLanguage
+ */
+
+require_once( dirname(__FILE__).'/../commandLine.inc' );
+$messagesDir = dirname(__FILE__).'/../../languages/messages/';
+$runTest = false;
+$run = false;
+$runMode = 'text';
+
+// Check parameters
+if ( isset( $options['lang'] ) && isset( $options['clang'] )) {
+ if (!isset( $options['mode'] )) {
+ $runMode = 'text';
+ } else {
+ if (!strcmp($options['mode'],'wiki')) {
+ $runMode = 'wiki';
+ } else if (!strcmp($options['mode'],'php')) {
+ $runMode = 'php';
+ } else if (!strcmp($options['mode'],'raw')) {
+ $runMode = 'raw';
+ } else {
+ }
+ }
+ $runTest = true;
+} else {
+ echo <<<TEXT
+Run this script to print out the duplicates against a message array.
+Parameters:
+ * lang: Language code to be checked.
+ * clang: Language code to be compared.
+Options:
+ * mode: Output format, can be either:
+ * text: Text output on the console (default)
+ * wiki: Wiki format, with * at beginning of each line
+ * php: Output text as PHP syntax in a array $dupeMessages
+ * raw: Raw output for duplicates
+TEXT;
+}
+
+// Check file exists
+if ( $runTest ) {
+ $langCode = $options['lang'];
+ $langCodeC = $options['clang'];
+ $langCodeF = ucfirst(strtolower(preg_replace('/-/','_',$langCode)));
+ $langCodeFC = ucfirst(strtolower(preg_replace('/-/','_',$langCodeC)));
+ $messagesFile = $messagesDir.'Messages'.$langCodeF.'.php';
+ $messagesFileC = $messagesDir.'Messages'.$langCodeFC.'.php';
+ if (file_exists($messagesFile) && file_exists($messagesFileC)) {
+ $run = true;
+ }
+ else {
+ echo "Messages file(s) could not be found.\nMake sure both files are exists.\n";
+ }
+}
+
+// Run to check the dupes
+if ( $run ) {
+ if (!strcmp($runMode,'wiki')) {
+ $runMode = 'wiki';
+ } else if (!strcmp($runMode,'raw')) {
+ $runMode = 'raw';
+ }
+ include( $messagesFile );
+ $messageExist = isset($messages);
+ if ($messageExist)
+ $wgMessages[$langCode] = $messages;
+ include( $messagesFileC );
+ $messageCExist = isset($messages);
+ if ($messageCExist)
+ $wgMessages[$langCodeC] = $messages;
+ $count = 0;
+
+ if (($messageExist) && ($messageCExist)) {
+
+ if (!strcmp($runMode,'php')) {
+ print("<?php\n");
+ print('$dupeMessages = array('."\n");
+ }
+ foreach ($wgMessages[$langCodeC] as $key => $value) {
+ foreach ($wgMessages[$langCode] as $ckey => $cvalue) {
+ if (!strcmp($key,$ckey)) {
+ if ((!strcmp($key,$ckey)) && (!strcmp($value,$cvalue))) {
+ if (!strcmp($runMode,'raw')) {
+ print("$key\n");
+ } else if (!strcmp($runMode,'php')) {
+ print("'$key' => '',\n");
+ } else if (!strcmp($runMode,'wiki')) {
+ $uKey = ucfirst($key);
+ print("* MediaWiki:$uKey/$langCode\n");
+ } else {
+ print("* $key\n");
+ }
+ $count++;
+ }
+ }
+ }
+ }
+ if (!strcmp($runMode,'php')) {
+ print(");\n");
+ }
+ if (!strcmp($runMode,'text')) {
+ if ($count == 1) {
+ echo "\nThere are $count duplicated message in $langCode, against to $langCodeC.\n";
+ } else {
+ echo "\nThere are $count duplicated messages in $langCode, against to $langCodeC.\n";
+ }
+ }
+ } else {
+ if (!$messageExist)
+ echo "There are no messages defined in $langCode.\n";
+ if (!$messageCExist)
+ echo "There are no messages defined in $langCodeC.\n";
+ }
+}
diff --git a/maintenance/language/checkExtensions.php b/maintenance/language/checkExtensions.php
index ab6f9ba8..ed1855c1 100644
--- a/maintenance/language/checkExtensions.php
+++ b/maintenance/language/checkExtensions.php
@@ -11,13 +11,13 @@ require_once( 'languages.inc' );
require_once( 'checkLanguage.inc' );
if( !class_exists( 'MessageGroups' ) || !class_exists( 'PremadeMediawikiExtensionGroups' ) ) {
- echo <<<END
+ echo <<<TEXT
Please add the Translate extension to LocalSettings.php, and enable the extension groups:
require_once( 'extensions/Translate/Translate.php' );
\$wgTranslateEC = array_keys( \$wgTranslateAC );
If you still get this message, update Translate to its latest version.
-END;
+TEXT;
exit(-1);
}
diff --git a/maintenance/language/checkLanguage.inc b/maintenance/language/checkLanguage.inc
index 52281b57..fc77aad3 100644
--- a/maintenance/language/checkLanguage.inc
+++ b/maintenance/language/checkLanguage.inc
@@ -7,6 +7,7 @@ class CheckLanguageCLI {
protected $code = null;
protected $level = 2;
protected $doLinks = false;
+ protected $linksPrefix = '';
protected $wikiCode = 'en';
protected $checkAll = false;
protected $output = 'plain';
@@ -24,7 +25,7 @@ class CheckLanguageCLI {
public function __construct( Array $options ) {
if ( isset( $options['help'] ) ) {
echo $this->help();
- exit();
+ exit(1);
}
if ( isset( $options['lang'] ) ) {
@@ -42,6 +43,10 @@ class CheckLanguageCLI {
$this->includeExif = !isset( $options['noexif'] );
$this->checkAll = isset( $options['all'] );
+ if ( isset( $options['prefix'] ) ) {
+ $this->linksPrefix = $options['prefix'];
+ }
+
if ( isset( $options['wikilang'] ) ) {
$this->wikiCode = $options['wikilang'];
}
@@ -190,6 +195,7 @@ Parameters:
* 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).
@@ -292,7 +298,7 @@ ENDS;
foreach ( $this->checks as $check ) {
if ( isset( $checkBlacklist[$code] ) &&
in_array( $check, $checkBlacklist[$code] ) ) {
- $result[$check] = array();
+ $results[$check] = array();
continue;
}
@@ -316,9 +322,9 @@ ENDS;
if ( $this->doLinks ) {
$displayKey = ucfirst( $key );
if ( $code == $this->wikiCode ) {
- return "[[MediaWiki:$displayKey|$key]]";
+ return "[[{$this->linksPrefix}MediaWiki:$displayKey|$key]]";
} else {
- return "[[MediaWiki:$displayKey/$code|$key]]";
+ return "[[{$this->linksPrefix}MediaWiki:$displayKey/$code|$key]]";
}
} else {
return $key;
@@ -378,7 +384,7 @@ ENDS;
function outputWiki() {
global $wgContLang, $IP;
$detailText = '';
- $rows[] = '! Language !! Code !! Total !! ' . implode( ' !! ', $this->checks );
+ $rows[] = '! Language !! Code !! Total !! ' . implode( ' !! ', array_diff( $this->checks, $this->nonMessageChecks() ) );
foreach ( $this->results as $code => $results ) {
$detailTextForLang = "==$code==\n";
$numbers = array();
@@ -418,7 +424,7 @@ ENDS;
$tableRows = implode( "\n|-\n", $rows );
- $version = SpecialVersion::getVersion( $IP );
+ $version = SpecialVersion::getVersion( 'nodb' );
echo <<<EOL
'''Check results are for:''' <code>$version</code>
@@ -459,7 +465,7 @@ class CheckExtensionsCLI extends CheckLanguageCLI {
public function __construct( Array $options, $extension ) {
if ( isset( $options['help'] ) ) {
echo $this->help();
- exit();
+ exit(1);
}
if ( isset( $options['lang'] ) ) {
@@ -587,7 +593,7 @@ Check codes (ideally, all of them should result 0; all the checks are executed b
* untranslated: Messages which are required to translate, but are not translated.
* duplicate: Messages which translation equal to fallback
* obsolete: Messages which are untranslatable, but 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.
* whitespace: Messages which have trailing whitespace.
* xhtml: Messages which are not well-formed XHTML (checks only few common errors).
@@ -645,25 +651,40 @@ ENDS;
# Blacklist some checks for some languages
$checkBlacklist = array(
#'code' => array( 'check1', 'check2' ... )
+'az' => array( 'plural' ),
+'bo' => array( 'plural' ),
+'dz' => array( 'plural' ),
+'id' => array( 'plural' ),
+'fa' => array( 'plural' ),
'gan' => array( 'plural' ),
+'gan-hans' => array( 'plural' ),
+'gan-hant' => array( 'plural' ),
'gn' => array( 'plural' ),
'hak' => array( 'plural' ),
'hu' => array( 'plural' ),
'ja' => array( 'plural' ), // Does not use plural
+'jv' => array( 'plural' ),
'ka' => array( 'plural' ),
'kk-arab' => array( 'plural' ),
'kk-cyrl' => array( 'plural' ),
'kk-latn' => array( 'plural' ),
+'km' => array( 'plural' ),
+'kn' => array( 'plural' ),
'ko' => array( 'plural' ),
+'lzh' => array( 'plural' ),
'mn' => array( 'plural' ),
'ms' => array( 'plural' ),
-'my' => array( 'chars' ), // Uses a lot zwnj
+'my' => array( 'plural', 'chars' ), // Uses a lot zwnj
'sah' => array( 'plural' ),
'sq' => array( 'plural' ),
'tet' => array( 'plural' ),
'th' => array( 'plural' ),
+'to' => array( 'plural' ),
+'tr' => array( 'plural' ),
+'vi' => array( 'plural' ),
'wuu' => array( 'plural' ),
'xmf' => array( 'plural' ),
+'yo' => array( 'plural' ),
'yue' => array( 'plural' ),
'zh' => array( 'plural' ),
'zh-classical' => array( 'plural' ),
diff --git a/maintenance/language/countMessages.php b/maintenance/language/countMessages.php
index 7d16915a..826c43cb 100644
--- a/maintenance/language/countMessages.php
+++ b/maintenance/language/countMessages.php
@@ -1,40 +1,65 @@
<?php
+/**
+ * Count how many messages we have defined for each language.
+ *
+ * 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
+ */
-require_once( dirname(__FILE__).'/../commandLine.inc' );
+require_once( dirname(__FILE__) . '/../Maintenance.php' );
-global $IP;
-
-if ( !isset( $args[0] ) ) {
- $dir = "$IP/languages/messages";
-} else {
- $dir = $args[0];
-}
-
-$total = 0;
-$nonZero = 0;
-foreach ( glob( "$dir/*.php" ) as $file ) {
- $baseName = basename( $file );
- if( !preg_match( '/Messages([A-Z][a-z_]+)\.php$/', $baseName, $m ) ) {
- continue;
+class CountMessages extends Maintenance {
+ public function __construct() {
+ parent::__construct();
+ $this->mDescription = "Count how many messages we have defined for each language";
}
- $code = str_replace( '_', '-', strtolower( $m[1] ) );
- $numMessages = wfGetNumMessages( $file );
- //print "$code: $numMessages\n";
- $total += $numMessages;
- if ( $numMessages > 0 ) {
- $nonZero ++;
+
+ public function execute() {
+ global $IP;
+ $dir = $this->getArg( 0, "$IP/languages/messages" );
+ $total = 0;
+ $nonZero = 0;
+ foreach ( glob( "$dir/*.php" ) as $file ) {
+ $baseName = basename( $file );
+ if( !preg_match( '/Messages([A-Z][a-z_]+)\.php$/', $baseName, $m ) ) {
+ continue;
+ }
+ $code = str_replace( '_', '-', strtolower( $m[1] ) );
+ $numMessages = $this->getNumMessages( $file );
+ //print "$code: $numMessages\n";
+ $total += $numMessages;
+ if ( $numMessages > 0 ) {
+ $nonZero ++;
+ }
+ }
+ $this->output( "\nTotal: $total\n" );
+ $this->output( "Languages: $nonZero\n" );
}
-}
-print "\nTotal: $total\n";
-print "Languages: $nonZero\n";
-function wfGetNumMessages( $file ) {
- // Separate function to limit scope
- require( $file );
- if ( isset( $messages ) ) {
- return count( $messages );
- } else {
- return 0;
+ private function getNumMessages( $file ) {
+ // Separate function to limit scope
+ require( $file );
+ if ( isset( $messages ) ) {
+ return count( $messages );
+ } else {
+ return 0;
+ }
}
}
+$maintClass = "CountMessages";
+require_once( DO_MAINTENANCE );
diff --git a/maintenance/language/date-formats.php b/maintenance/language/date-formats.php
index 834d2bd8..54a6a26d 100644
--- a/maintenance/language/date-formats.php
+++ b/maintenance/language/date-formats.php
@@ -1,50 +1,76 @@
<?php
/**
- * @file
+ * Test various language time and date functions
+ *
+ * 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
*/
-$ts = '20010115123456';
+require_once( dirname(__FILE__) . '/../Maintenance.php' );
-
-$IP = dirname( __FILE__ ) . '/../..';
-require_once( "$IP/maintenance/commandLine.inc" );
+class DateFormats extends Maintenance {
-foreach ( glob( "$IP/languages/messages/Messages*.php" ) as $filename ) {
- $base = basename( $filename );
- $m = array();
- if ( !preg_match( '/Messages(.*)\.php$/', $base, $m ) ) {
- continue;
- }
- $code = str_replace( '_', '-', strtolower( $m[1] ) );
- print "$code ";
- $lang = Language::factory( $code );
- $prefs = $lang->getDatePreferences();
- if ( !$prefs ) {
- $prefs = array( 'default' );
- }
- print "date: ";
- foreach ( $prefs as $index => $pref ) {
- if ( $index > 0 ) {
- print ' | ';
- }
- print $lang->date( $ts, false, $pref );
- }
- print "\n$code time: ";
- foreach ( $prefs as $index => $pref ) {
- if ( $index > 0 ) {
- print ' | ';
- }
- print $lang->time( $ts, false, $pref );
+ private $ts = '20010115123456';
+
+ public function __construct() {
+ parent::__construct();
+ $this->mDescription = "Test various language time and date functions";
}
- print "\n$code both: ";
- foreach ( $prefs as $index => $pref ) {
- if ( $index > 0 ) {
- print ' | ';
+
+ public function execute() {
+ global $IP;
+ foreach ( glob( "$IP/languages/messages/Messages*.php" ) as $filename ) {
+ $base = basename( $filename );
+ $m = array();
+ if ( !preg_match( '/Messages(.*)\.php$/', $base, $m ) ) {
+ continue;
+ }
+ $code = str_replace( '_', '-', strtolower( $m[1] ) );
+ $this->output( "$code " );
+ $lang = Language::factory( $code );
+ $prefs = $lang->getDatePreferences();
+ if ( !$prefs ) {
+ $prefs = array( 'default' );
+ }
+ $this->output( "date: " );
+ foreach ( $prefs as $index => $pref ) {
+ if ( $index > 0 ) {
+ $this->output( ' | ' );
+ }
+ $this->output( $lang->date( $this->ts, false, $pref ) );
+ }
+ $this->output( "\n$code time: " );
+ foreach ( $prefs as $index => $pref ) {
+ if ( $index > 0 ) {
+ $this->output( ' | ' );
+ }
+ $this->output( $lang->time( $this->ts, false, $pref ) );
+ }
+ $this->output( "\n$code both: " );
+ foreach ( $prefs as $index => $pref ) {
+ if ( $index > 0 ) {
+ $this->output( ' | ' );
+ }
+ $this->output( $lang->timeanddate( $this->ts, false, $pref ) );
+ }
+ $this->output( "\n\n" );
}
- print $lang->timeanddate( $ts, false, $pref );
}
- print "\n\n";
}
-
+$maintClass = "DateFormats";
+require_once( DO_MAINTENANCE );
diff --git a/maintenance/language/diffLanguage.php b/maintenance/language/diffLanguage.php
index 9d395b3c..bbdb8653 100644
--- a/maintenance/language/diffLanguage.php
+++ b/maintenance/language/diffLanguage.php
@@ -69,7 +69,7 @@ function ucfirstlcrest($string) {
/**
* Return a $wgAllmessages array shipped in MediaWiki
- * @param string $languageCode Formated language code
+ * @param $languageCode String: formated language code
* @return array The MediaWiki default $wgAllMessages array requested
*/
function getMediawikiMessages($languageCode = 'En') {
@@ -93,8 +93,8 @@ function getMediawikiMessages($languageCode = 'En') {
/**
* Return a $wgAllmessages array in a given file. Language of the array
* need to be given cause we can not detect which language it provides
- * @param string $filename Filename of the file containing a message array
- * @param string $languageCode Language of the external array
+ * @param $filename String: filename of the file containing a message array
+ * @param $languageCode String: language of the external array
* @return array A $wgAllMessages array from an external file.
*/
function getExternalMessages($filename, $languageCode) {
diff --git a/maintenance/language/digit2html.php b/maintenance/language/digit2html.php
index b020d812..54630af0 100644
--- a/maintenance/language/digit2html.php
+++ b/maintenance/language/digit2html.php
@@ -1,29 +1,61 @@
<?php
/**
- * @file
+ * 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
*/
-require( '../commandLine.inc' );
+require_once( dirname(__FILE__).'/../Maintenance.php' );
-# A list of unicode numerals is available at:
-# http://www.fileformat.info/info/unicode/category/Nd/list.htm
-$langs = array( 'Ar', 'As', 'Bh', 'Bo', 'Dz', 'Fa', 'Gu', 'Hi', 'Km', 'Kn', 'Ks', 'Lo', 'Ml', 'Mr', 'Ne', 'New', 'Or', 'Pa', 'Pi', 'Sa' );
+class Digit2Html extends Maintenance {
-foreach( $langs as $code ) {
- $filename = Language::getMessagesFileName( $code );
- echo "Loading language [$code] ... ";
- unset( $digitTransformTable );
- require_once( $filename );
- if( !isset( $digitTransformTable ) ) {
- print "\$digitTransformTable not found\n";
- continue;
+ # A list of unicode numerals is available at:
+ # http://www.fileformat.info/info/unicode/category/Nd/list.htm
+ private $mLangs = array(
+ 'Ar', 'As', 'Bh', 'Bo', 'Dz',
+ 'Fa', 'Gu', 'Hi', 'Km', 'Kn',
+ 'Ks', 'Lo', 'Ml', 'Mr', 'Ne',
+ 'New', 'Or', 'Pa', 'Pi', 'Sa'
+ );
+
+ public function __construct() {
+ parent::__construct();
+ $this->mDescription = "Check digit transformation";
}
- print "OK\n\$digitTransformTable = array(\n";
- foreach( $digitTransformTable as $latin => $translation ) {
- $htmlent = utf8ToHexSequence( $translation );
- print "'$latin' => '$translation', # &#x$htmlent;\n";
+ public function execute() {
+ foreach( $this->mLangs as $code ) {
+ $filename = Language::getMessagesFileName( $code );
+ $this->output( "Loading language [$code] ... " );
+ unset( $digitTransformTable );
+ require_once( $filename );
+ if( !isset( $digitTransformTable ) ) {
+ $this->error( "\$digitTransformTable not found for lang: $code" );
+ continue;
+ }
+
+ $this->output( "OK\n\$digitTransformTable = array(\n" );
+ foreach( $digitTransformTable as $latin => $translation ) {
+ $htmlent = utf8ToHexSequence( $translation );
+ $this->output( "'$latin' => '$translation', # &#x$htmlent;\n" );
+ }
+ $this->output( ");\n" );
+ }
}
- print ");\n";
}
+
+$maintClass = "Digit2Html";
+require_once( DO_MAINTENANCE );
diff --git a/maintenance/language/dumpMessages.php b/maintenance/language/dumpMessages.php
index 35aeeb75..a0f0a9ab 100644
--- a/maintenance/language/dumpMessages.php
+++ b/maintenance/language/dumpMessages.php
@@ -1,18 +1,44 @@
<?php
/**
- * @todo document
- * @file
+ * Dump an entire language, using the keys from English
+ * so we get all the values, not just the customized ones
+ *
+ * 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
+ * @todo Make this more useful, right now just dumps $wgContentLang
*/
-/** */
-require_once( dirname(__FILE__).'/../commandLine.inc' );
-$messages = array();
-$wgEnglishMessages = array_keys( Language::getMessagesFor( 'en' ) );
-foreach ( $wgEnglishMessages as $key ) {
- $messages[$key] = wfMsg( $key );
-}
-print "MediaWiki $wgVersion language file\n";
-print serialize( $messages );
+require_once( dirname(__FILE__) . '/../Maintenance.php' );
+class DumpMessages extends Maintenance {
+ public function __construct() {
+ parent::__construct();
+ $this->mDescription = "Dump an entire language, using the keys from English";
+ }
+
+ public function execute() {
+ $messages = array();
+ foreach ( array_keys( Language::getMessagesFor( 'en' ) ) as $key ) {
+ $messages[$key] = wfMsg( $key );
+ }
+ $this->output( "MediaWiki $wgVersion language file\n" );
+ $this->output( serialize( $messages ) );
+ }
+}
+$maintClass = "DumpMessages";
+require_once( DO_MAINTENANCE );
diff --git a/maintenance/language/generateNormalizerData.php b/maintenance/language/generateNormalizerData.php
new file mode 100644
index 00000000..d6b7aaa6
--- /dev/null
+++ b/maintenance/language/generateNormalizerData.php
@@ -0,0 +1,137 @@
+<?php
+
+require_once( dirname( __FILE__ ) . '/../Maintenance.php' );
+
+require_once( dirname( __FILE__ ) . '/../../includes/normal/UtfNormalUtil.php' );
+
+/**
+ * Generates normalizer data files for Arabic and Malayalam.
+ * For NFC see includes/normal.
+ */
+class GenerateNormalizerData extends Maintenance {
+ var $dataFile;
+
+ public function __construct() {
+ parent::__construct();
+ $this->addOption( 'unicode-data-file', 'The local location of the data file ' .
+ 'from http://unicode.org/Public/UNIDATA/UnicodeData.txt', false, true );
+ }
+
+ public function execute() {
+ if ( !$this->hasOption( 'unicode-data-file' ) ) {
+ $this->dataFile = 'UnicodeData.txt';
+ if ( !file_exists( $this->dataFile ) ) {
+ $this->error( "Unable to find UnicodeData.txt. Please specify its location with --unicode-data-file=<FILE>" );
+ exit( 1 );
+ }
+ } else {
+ $this->dataFile = $this->getOption( 'unicode-data-file' );
+ if ( !file_exists( $this->dataFile ) ) {
+ $this->error( 'Unable to find the specified data file.' );
+ exit( 1 );
+ }
+ }
+
+ $this->generateArabic();
+ $this->generateMalayalam();
+ }
+
+ function generateArabic() {
+ $file = fopen( $this->dataFile, 'r' );
+ if ( !$file ) {
+ $this->error( 'Unable to open the data file.' );
+ exit( 1 );
+ }
+
+ // For the file format, see http://www.unicode.org/reports/tr44/
+ $fieldNames = array(
+ 'Code',
+ 'Name',
+ 'General_Category',
+ 'Canonical_Combining_Class',
+ 'Bidi_Class',
+ 'Decomposition_Type_Mapping',
+ 'Numeric_Type_Value',
+ 'Bidi_Mirrored',
+ 'Unicode_1_Name',
+ 'ISO_Comment',
+ 'Simple_Uppercase_Mapping',
+ 'Simple_Lowercase_Mapping',
+ 'Simple_Titlecase_Mapping'
+ );
+
+ $pairs = array();
+
+ $lineNum = 0;
+ while ( false !== ( $line = fgets( $file ) ) ) {
+ ++$lineNum;
+
+ # Strip comments
+ $line = trim( substr( $line, 0, strcspn( $line, '#' ) ) );
+ if ( $line === '' ) {
+ continue;
+ }
+
+ # Split fields
+ $numberedData = explode( ';', $line );
+ $data = array();
+ foreach ( $fieldNames as $number => $name ) {
+ $data[$name] = $numberedData[$number];
+ }
+
+ $code = base_convert( $data['Code'], 16, 10 );
+ if ( ( $code >= 0xFB50 && $code <= 0xFDFF ) # Arabic presentation forms A
+ || ( $code >= 0xFE70 && $code <= 0xFEFF ) ) # Arabic presentation forms B
+ {
+ if ( $data['Decomposition_Type_Mapping'] === '' ) {
+ // No decomposition
+ continue;
+ }
+ if ( !preg_match( '/^ *(<\w*>) +([0-9A-F ]*)$/',
+ $data['Decomposition_Type_Mapping'], $m ) )
+ {
+ $this->error( "Can't parse Decomposition_Type/Mapping on line $lineNum" );
+ $this->error( $line );
+ continue;
+ }
+
+ $source = hexSequenceToUtf8( $data['Code'] );
+ $dest = hexSequenceToUtf8( $m[2] );
+ $pairs[$source] = $dest;
+ }
+ }
+
+ global $IP;
+ file_put_contents( "$IP/serialized/normalize-ar.ser", serialize( $pairs ) );
+ echo "ar: " . count( $pairs ) . " pairs written.\n";
+ }
+
+ function generateMalayalam() {
+ $hexPairs = array(
+ # From http://unicode.org/versions/Unicode5.1.0/#Malayalam_Chillu_Characters
+ '0D23 0D4D 200D' => '0D7A',
+ '0D28 0D4D 200D' => '0D7B',
+ '0D30 0D4D 200D' => '0D7C',
+ '0D32 0D4D 200D' => '0D7D',
+ '0D33 0D4D 200D' => '0D7E',
+
+ # From http://permalink.gmane.org/gmane.science.linguistics.wikipedia.technical/46413
+ '0D15 0D4D 200D' => '0D7F',
+ );
+
+ $pairs = array();
+ foreach ( $hexPairs as $hexSource => $hexDest ) {
+ $source = hexSequenceToUtf8( $hexSource );
+ $dest = hexSequenceToUtf8( $hexDest );
+ $pairs[$source] = $dest;
+ }
+
+ global $IP;
+ file_put_contents( "$IP/serialized/normalize-ml.ser", serialize( $pairs ) );
+ echo "ml: " . count( $pairs ) . " pairs written.\n";
+ }
+}
+
+$maintClass = 'GenerateNormalizerData';
+require_once( DO_MAINTENANCE );
+
diff --git a/maintenance/language/lang2po.php b/maintenance/language/lang2po.php
index 1009ed6c..c7484d63 100644
--- a/maintenance/language/lang2po.php
+++ b/maintenance/language/lang2po.php
@@ -6,15 +6,27 @@
* - generate .po header
* - fix escaping of \
*
- * @file
+ * 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
*/
-$optionsWithArgs[] = 'lang';
-
/** This is a command line script */
-require_once(dirname(__FILE__).'/../commandLine.inc');
-require_once(dirname(__FILE__).'/languages.inc');
+require_once(dirname(__FILE__) . '/../Maintenance.php' );
+require_once(dirname(__FILE__) . '/languages.inc' );
define('ALL_LANGUAGES', true);
define('XGETTEXT_BIN', 'xgettext');
@@ -26,28 +38,45 @@ 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 );
+ }
-if( isset($options['help']) ) { usage(); wfDie(); }
-// default output is WikiText
-if( !isset($options['lang']) ) { $options['lang'] = ALL_LANGUAGES; }
-
-function usage() {
-print <<<END
-Usage: php lang2po.php [--help] [--lang=<langcode>] [--stdout]
- --help: this message.
- --lang: a lang code you want to generate a .po for (default: all languages).
-
-END;
-}
-
+ 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
- */
-function poHeader() {
-return
-'# SOME DESCRIPTIVE TITLE.
+ /**
+ * 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.
@@ -65,94 +94,72 @@ msgstr ""
"Content-Type: text/plain; charset=UTF-8\n"
"Content-Transfer-Encoding: 8bit\n"
';
-}
-
-/**
- * generate and write a file in .po format.
- *
- * @param string $langcode Code of a language it will process.
- * @param array &$messages Array containing the various messages.
- * @return string Filename where stuff got saved or false.
- */
-function generatePo($langcode, $messages) {
- $data = 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;
+ /**
+ * generate and write a file in .po format.
+ *
+ * @param string $langcode Code of a language it will process.
+ * @param array &$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;
+ }
}
-}
-
-function generatePot() {
- global $IP;
- $curdir = getcwd();
- chdir($IP);
- exec( XGETTEXT_BIN
- .' '.XGETTEXT_OPTIONS
- .' -o '.LOCALE_OUTPUT_DIR.'/wfMsg.pot'
- .' includes/*php'
- );
- chdir($curdir);
-}
-
-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);
-}
-
-// Generate a template .pot based on source tree
-echo "Getting 'gettext' default messages from sources:";
-generatePot();
-echo "done.\n";
-
-
-$langTool = new languages();
-
-if( $options['lang'] === ALL_LANGUAGES ) {
- $codes = $langTool->getLanguages();
-} else {
- $codes = array( $options['lang'] );
-}
-
-// Do all languages
-foreach ( $codes as $langcode) {
- echo "Loading messages for $langcode:\n";
- if( ! generatePo($langcode, $langTool->getMessages($langcode) ) ) {
- echo "ERROR: Failed to write file.\n";
- } else {
- echo "Applying template:";
- applyPot($langcode);
+ 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( DO_MAINTENANCE );
diff --git a/maintenance/language/langmemusage.php b/maintenance/language/langmemusage.php
index 9bfb3cdc..71135474 100644
--- a/maintenance/language/langmemusage.php
+++ b/maintenance/language/langmemusage.php
@@ -3,31 +3,57 @@
* Dumb program that tries to get the memory usage
* for each language file.
*
- * @file
+ * 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__).'/../commandLine.inc');
-require_once(dirname(__FILE__).'/languages.inc');
+require_once( dirname(__FILE__) . '/../Maintenance.php' );
+require_once( dirname(__FILE__) . '/languages.inc' );
-$langtool = new languages();
+class LangMemUsage extends Maintenance {
-if ( ! function_exists( 'memory_get_usage' ) )
- wfDie( "You must compile PHP with --enable-memory-limit\n" );
+ public function __construct() {
+ parent::__construct();
+ $this->mDescription = "Dumb program that tries to get the memory usage\n" .
+ "for each language file";
+ }
-$memlast = $memstart = memory_get_usage();
+ public function execute() {
+ if ( !function_exists( 'memory_get_usage' ) )
+ $this->error( "You must compile PHP with --enable-memory-limit", true );
-print 'Base memory usage: '.$memstart."\n";
+ $langtool = new languages();
+ $memlast = $memstart = memory_get_usage();
-foreach ( $langtool->getLanguages() as $langcode ) {
- Language::factory( $langcode );
- $memstep = memory_get_usage();
- printf( "%12s: %d\n", $langcode, ($memstep- $memlast) );
- $memlast = $memstep;
-}
+ $this->output( "Base memory usage: $memstart\n" );
+
+ foreach ( $langtool->getLanguages() as $langcode ) {
+ Language::factory( $langcode );
+ $memstep = memory_get_usage();
+ $this->output( sprintf( "%12s: %d\n", $langcode, ($memstep- $memlast) ) );
+ $memlast = $memstep;
+ }
-$memend = memory_get_usage();
+ $memend = memory_get_usage();
-echo ' Total Usage: '.($memend - $memstart)."\n";
+ $this->output( ' Total Usage: '.($memend - $memstart)."\n" );
+ }
+}
+$maintClass = "LangMemUsage";
+require_once( DO_MAINTENANCE );
diff --git a/maintenance/language/languages.inc b/maintenance/language/languages.inc
index 6159e844..98464292 100644
--- a/maintenance/language/languages.inc
+++ b/maintenance/language/languages.inc
@@ -14,6 +14,7 @@ class languages {
protected $mRawMessages; # Raw list of the messages in each language
protected $mMessages; # Messages in each language (except for English), divided to groups
+ protected $mFallback; # Fallback language in each language
protected $mGeneralMessages; # General messages in English, divided to groups
protected $mIgnoredMessages; # All the messages which should be exist only in the English file
protected $mOptionalMessages; # All the messages which may be translated or not, depending on the language
@@ -76,6 +77,7 @@ class languages {
*/
protected function loadFile( $code ) {
if ( isset( $this->mRawMessages[$code] ) &&
+ isset( $this->mFallback[$code] ) &&
isset( $this->mNamespaceNames[$code] ) &&
isset( $this->mNamespaceAliases[$code] ) &&
isset( $this->mMagicWords[$code] ) &&
@@ -83,6 +85,7 @@ class languages {
return;
}
$this->mRawMessages[$code] = array();
+ $this->mFallback[$code] = '';
$this->mNamespaceNames[$code] = array();
$this->mNamespaceAliases[$code] = array();
$this->mMagicWords[$code] = array();
@@ -93,6 +96,9 @@ class languages {
if ( isset( $messages ) ) {
$this->mRawMessages[$code] = $messages;
}
+ if ( isset( $fallback ) ) {
+ $this->mFallback[$code] = $fallback;
+ }
if ( isset( $namespaceNames ) ) {
$this->mNamespaceNames[$code] = $namespaceNames;
}
@@ -207,6 +213,18 @@ class languages {
}
/**
+ * Get fallback language code for a specific language.
+ *
+ * @param $code The language code.
+ *
+ * @return Fallback code.
+ */
+ public function getFallback( $code ) {
+ $this->loadFile( $code );
+ return $this->mFallback[$code];
+ }
+
+ /**
* Get namespace names for a specific language.
*
* @param $code The language code.
diff --git a/maintenance/language/makeMessageDB.php b/maintenance/language/makeMessageDB.php
deleted file mode 100644
index f853b395..00000000
--- a/maintenance/language/makeMessageDB.php
+++ /dev/null
@@ -1,45 +0,0 @@
-<?php
-
-/**
- * Proof of principle script
- */
-
-require( dirname( __FILE__ ) . '/../commandLine.inc' );
-
-$obj = new MakeMessagesDB;
-$obj->run();
-
-class MakeMessagesDB {
-
- function run() {
- global $wgExtensionMessagesFiles, $wgMessageCache, $IP;
-
- $nameHash = md5( implode( "\n", array_keys( $wgExtensionMessagesFiles ) ) );
- $dir = "$IP/cache/ext-msgs";
- wfMkdirParents( $dir );
- $db = dba_open( "$dir/$nameHash.cdb", 'n', 'cdb' );
- if ( !$db ) {
- echo "Cannot open DB file\n";
- exit( 1 );
- }
-
- # Load extension messages
- foreach ( $wgExtensionMessagesFiles as $file ) {
- $messages = $magicWords = array();
- require( $file );
- foreach ( $messages as $lang => $unused ) {
- $wgMessageCache->processMessagesArray( $messages, $lang );
- }
- }
-
- # Write them to the file
- foreach ( $wgMessageCache->mExtensionMessages as $lang => $messages ) {
- foreach ( $messages as $key => $text ) {
- dba_insert( "$lang:$key", $text, $db );
- }
- }
-
- dba_close( $db );
- }
-}
-
diff --git a/maintenance/language/messageTypes.inc b/maintenance/language/messageTypes.inc
index d155db94..9b979b19 100644
--- a/maintenance/language/messageTypes.inc
+++ b/maintenance/language/messageTypes.inc
@@ -25,6 +25,7 @@ $wgIgnoredMessages = array(
'accesskey-ca-viewsource',
'accesskey-ca-history',
'accesskey-ca-protect',
+ 'accesskey-ca-unprotect',
'accesskey-ca-delete',
'accesskey-ca-undelete',
'accesskey-ca-move',
@@ -35,6 +36,7 @@ $wgIgnoredMessages = array(
'accesskey-search-fulltext',
'accesskey-p-logo',
'accesskey-n-mainpage',
+ 'accesskey-n-mainpage-description',
'accesskey-n-portal',
'accesskey-n-currentevents',
'accesskey-n-recentchanges',
@@ -65,10 +67,10 @@ $wgIgnoredMessages = array(
'accesskey-preview',
'accesskey-diff',
'accesskey-compareselectedversions',
- 'accesskey-visualcomparison',
'accesskey-watch',
'accesskey-upload',
'addsection',
+ 'talkpageheader',
'anonnotice',
'autoblock_whitelist',
'searchmenu-help',
@@ -152,8 +154,12 @@ $wgIgnoredMessages = array(
'fewestrevisions-summary',
'upload-summary',
'newuserlogentry',
- 'restrictlogpage',
'wantedtemplates-summary',
+ 'activeusers-summary',
+ 'search-summary',
+ 'editpage-tos-summary',
+ 'addsection-preload',
+ 'addsection-editintro',
);
/** Optional messages, which may be translated only if changed in the target language. */
@@ -208,6 +214,7 @@ $wgOptionalMessages = array(
'skinname-chick',
'skinname-simple',
'skinname-modern',
+ 'skinname-vector',
'common.css',
'standard.css',
'nostalgia.css',
@@ -217,6 +224,7 @@ $wgOptionalMessages = array(
'chick.css',
'simple.css',
'modern.css',
+ 'vector.css',
'print.css',
'handheld.css',
'common.js',
@@ -228,6 +236,7 @@ $wgOptionalMessages = array(
'chick.js',
'simple.js',
'modern.js',
+ 'vector.js',
'widthheight',
'exif-fnumber-format',
'exif-focallength-format',
@@ -320,6 +329,7 @@ $wgOptionalMessages = array(
'hebrew-calendar-m10-gen',
'hebrew-calendar-m11-gen',
'hebrew-calendar-m12-gen',
+ 'version-svn-revision',
'catseparator',
'semicolon-separator',
'comma-separator',
@@ -328,15 +338,21 @@ $wgOptionalMessages = array(
'word-separator',
'ellipsis',
'percent',
+ 'parentheses',
'autocomment-prefix',
'listgrouprights-right-display',
+ 'listgrouprights-right-revoked',
'timezone-utc',
'whatlinkshere-backlink',
'recentchangeslinked-backlink',
+ 'unpatrolledletter',
'diff-with-additional',
'pagetitle-view-mainpage',
'trackback',
'trackbackexcerpt',
+ 'prefs-registration-date-time',
+ 'prefs-memberingroups-type',
+ 'shared-repo-name-wikimediacommons',
);
/** EXIF messages, which may be set as optional in several checks, but are generally mandatory */
@@ -559,6 +575,8 @@ $wgEXIFMessages = array(
'exif-gpslatitude-s',
'exif-gpslongitude-e',
'exif-gpslongitude-w',
+ 'exif-gpsaltitude-0',
+ 'exif-gpsaltitude-1',
'exif-gpsstatus-a',
'exif-gpsstatus-v',
'exif-gpsmeasuremode-2',
@@ -566,6 +584,9 @@ $wgEXIFMessages = array(
'exif-gpsspeed-k',
'exif-gpsspeed-m',
'exif-gpsspeed-n',
+ 'exif-gpsdestdistance-k',
+ 'exif-gpsdestdistance-m',
+ 'exif-gpsdestdistance-n',
'exif-gpsdirection-t',
'exif-gpsdirection-m',
);
diff --git a/maintenance/language/messages.inc b/maintenance/language/messages.inc
index fb22bc9c..25bc8fd0 100644
--- a/maintenance/language/messages.inc
+++ b/maintenance/language/messages.inc
@@ -41,6 +41,7 @@ $wgMessageStructure = array(
'tog-enotifminoredits',
'tog-enotifrevealaddr',
'tog-shownumberswatching',
+ 'tog-oldsig',
'tog-fancysig',
'tog-externaleditor',
'tog-externaldiff',
@@ -65,6 +66,13 @@ $wgMessageStructure = array(
'underline-never',
'underline-default',
),
+ 'editfont' => array(
+ 'editfont-style',
+ 'editfont-default',
+ 'editfont-monospace',
+ 'editfont-sansserif',
+ 'editfont-serif',
+ ),
'dates' => array(
'sunday',
'monday',
@@ -133,6 +141,8 @@ $wgMessageStructure = array(
'category-file-count',
'category-file-count-limited',
'listingcontinuesabbrev',
+ 'index-category',
+ 'noindex-category',
),
'mainpage' => array(
'linkprefix',
@@ -144,6 +154,14 @@ $wgMessageStructure = array(
'article',
'newwindow',
'cancel',
+ 'moredotdotdot',
+ 'mypage',
+ 'mytalk',
+ 'anontalk',
+ 'navigation',
+ 'and',
+ ),
+ 'cologneblue' => array(
'qbfind',
'qbbrowse',
'qbedit',
@@ -151,15 +169,37 @@ $wgMessageStructure = array(
'qbpageinfo',
'qbmyoptions',
'qbspecialpages',
- 'moredotdotdot',
- 'mypage',
- 'mytalk',
- 'anontalk',
- 'navigation',
- 'and',
+ 'faq',
+ 'faqpage',
+ 'sitetitle',
+ 'sitesubtitle',
),
- 'metadata_help' => array(
- 'metadata_help',
+ 'vector' => array(
+ 'vector-action-addsection',
+ 'vector-action-delete',
+ 'vector-action-move',
+ 'vector-action-protect',
+ 'vector-action-undelete',
+ 'vector-action-unprotect',
+ 'vector-namespace-category',
+ 'vector-namespace-help',
+ 'vector-namespace-image',
+ 'vector-namespace-main',
+ 'vector-namespace-media',
+ 'vector-namespace-mediawiki',
+ 'vector-namespace-project',
+ 'vector-namespace-special',
+ 'vector-namespace-talk',
+ 'vector-namespace-template',
+ 'vector-namespace-user',
+ 'vector-view-create',
+ 'vector-view-edit',
+ 'vector-view-history',
+ 'vector-view-view',
+ 'vector-view-viewsource',
+ 'actions',
+ 'namespaces',
+ 'variants',
),
'miscellaneous2' => array(
'errorpagetitle',
@@ -211,18 +251,19 @@ $wgMessageStructure = array(
'otherlanguages',
'redirectedfrom',
'redirectpagesub',
+ 'talkpageheader',
'lastmodifiedat',
'viewcount',
'protectedpage',
'jumpto',
'jumptonavigation',
'jumptosearch',
+ 'view-pool-error',
),
'links' => array(
'aboutsite',
'aboutpage',
'copyright',
- 'copyrightpagename',
'copyrightpage',
'currentevents',
'currentevents-url',
@@ -230,8 +271,6 @@ $wgMessageStructure = array(
'disclaimerpage',
'edithelp',
'edithelppage',
- 'faq',
- 'faqpage',
'help',
'helppage',
'mainpage',
@@ -253,10 +292,8 @@ $wgMessageStructure = array(
),
'miscellaneous3' => array(
'ok',
- 'sitetitle',
'pagetitle',
'pagetitle-view-mainpage',
- 'sitesubtitle',
'retrievedfrom',
'youhavenewmessages',
'newmessageslink',
@@ -313,9 +350,6 @@ $wgMessageStructure = array(
'databaseerror',
'dberrortext',
'dberrortextcl',
- 'noconnect',
- 'nodb',
- 'cachederror',
'laggedslavemode',
'readonly',
'enterlockreason',
@@ -326,6 +360,8 @@ $wgMessageStructure = array(
'readonly_lag',
'internalerror',
'internalerror_info',
+ 'fileappenderrorread',
+ 'fileappenderror',
'filecopyerror',
'filerenameerror',
'filedeleteerror',
@@ -363,10 +399,8 @@ $wgMessageStructure = array(
'virus-unknownscanner',
),
'login' => array(
- 'logouttitle',
'logouttext',
'welcomecreation',
- 'loginpagetitle',
'yourname',
'yourpassword',
'yourpasswordagain',
@@ -377,6 +411,7 @@ $wgMessageStructure = array(
'nav-login-createaccount',
'loginprompt',
'userlogin',
+ 'userloginnocreate',
'logout',
'userlogout',
'notloggedin',
@@ -388,26 +423,8 @@ $wgMessageStructure = array(
'createaccountmail',
'badretype',
'userexists',
- 'youremail',
- 'username',
- 'uid',
- 'prefs-memberingroups',
- 'yourrealname',
- 'yourlanguage',
- 'yourvariant',
- 'yournick',
- 'badsig',
- 'badsiglength',
- 'yourgender',
- 'gender-unknown',
- 'gender-male',
- 'gender-female',
- 'prefs-help-gender',
- 'email',
- 'prefs-help-realname',
'loginerror',
- 'prefs-help-email',
- 'prefs-help-email-required',
+ 'createaccounterror',
'nocookiesnew',
'nocookieslogin',
'noname',
@@ -416,13 +433,16 @@ $wgMessageStructure = array(
'nosuchuser',
'nosuchusershort',
'nouserspecified',
+ 'login-userblocked',
'wrongpassword',
'wrongpasswordempty',
'passwordtooshort',
+ 'password-name-match',
'mailmypassword',
'passwordremindertitle',
'passwordremindertext',
'noemail',
+ 'noemailcreate',
'passwordsent',
'blocked-mailpassword',
'eauthentsent',
@@ -441,9 +461,11 @@ $wgMessageStructure = array(
'accountcreatedtext',
'createaccount-title',
'createaccount-text',
+ 'usernamehasherror',
'login-throttled',
'loginlanguagelabel',
'loginlanguagelinks',
+ 'suspicious-userlogout',
),
'resetpass' => array(
'resetpass',
@@ -455,16 +477,12 @@ $wgMessageStructure = array(
'retypenew',
'resetpass_submit',
'resetpass_success',
- 'resetpass_bad_temporary',
'resetpass_forbidden',
'resetpass-no-info',
'resetpass-submit-loggedin',
+ 'resetpass-submit-cancel',
'resetpass-wrong-oldpass',
'resetpass-temp-password',
- 'resetpass-log',
- 'resetpass-logtext',
- 'resetpass-logentry',
- 'resetpass-comment',
),
'toolbar' => array(
'bold_sample',
@@ -512,7 +530,6 @@ $wgMessageStructure = array(
'blockededitsource',
'whitelistedittitle',
'whitelistedittext',
- 'confirmedittitle',
'confirmedittext',
'nosuchsectiontitle',
'nosuchsectiontext',
@@ -527,10 +544,14 @@ $wgMessageStructure = array(
'talkpagetext',
'anontalkpagetext',
'noarticletext',
+ 'noarticletext-nopermission',
'noarticletextanon',
'userpage-userdoesnotexist',
+ 'userpage-userdoesnotexist-view',
+ 'blocked-notice-logextract',
'clearyourcache',
- 'usercssjsyoucanpreview',
+ 'usercssyoucanpreview',
+ 'userjsyoucanpreview',
'usercsspreview',
'userjspreview',
'userinvalidcssjstitle',
@@ -553,6 +574,7 @@ $wgMessageStructure = array(
'yourdiff',
'copyrightwarning',
'copyrightwarning2',
+ 'editpage-tos-summary',
'longpagewarning',
'longpageerror',
'readonlywarning',
@@ -570,17 +592,21 @@ $wgMessageStructure = array(
'nocreatetitle',
'nocreatetext',
'nocreate-loggedin',
+ 'sectioneditnotsupported-title',
+ 'sectioneditnotsupported-text',
'permissionserrors',
'permissionserrorstext',
'permissionserrorstext-withaction',
- 'recreate-deleted-warn',
- 'deleted-notice',
- 'deletelog-fulllog',
+ 'recreate-moveddeleted-warn',
+ 'moveddeleted-notice',
+ 'log-fulllog',
'edit-hook-aborted',
'edit-gone-missing',
'edit-conflict',
'edit-no-change',
'edit-already-exists',
+ 'addsection-preload',
+ 'addsection-editintro',
),
'parserwarnings' => array(
'expensive-parserfunction-warning',
@@ -591,6 +617,7 @@ $wgMessageStructure = array(
'post-expand-template-argument-category',
'parser-template-loop-warning',
'parser-template-recursion-depth-warning',
+ 'language-converter-depth-warning',
),
'undo' => array(
'undo-success',
@@ -622,8 +649,8 @@ $wgMessageStructure = array(
'page_last',
'histlegend',
'history-fieldset-title',
+ 'history-show-deleted',
'history_copyright',
- 'deletedrev',
'histfirst',
'histlast',
'historysize',
@@ -639,32 +666,46 @@ $wgMessageStructure = array(
'rev-deleted-comment',
'rev-deleted-user',
'rev-deleted-event',
+ 'rev-deleted-user-contribs',
'rev-deleted-text-permission',
+ 'rev-deleted-text-unhide',
+ 'rev-suppressed-text-unhide',
'rev-deleted-text-view',
+ 'rev-suppressed-text-view',
'rev-deleted-no-diff',
+ 'rev-suppressed-no-diff',
'rev-deleted-unhide-diff',
+ 'rev-suppressed-unhide-diff',
+ 'rev-deleted-diff-view',
+ 'rev-suppressed-diff-view',
'rev-delundel',
+ 'rev-showdeleted',
'revisiondelete',
'revdelete-nooldid-title',
'revdelete-nooldid-text',
'revdelete-nologtype-title',
'revdelete-nologtype-text',
- 'revdelete-toomanytargets-title',
- 'revdelete-toomanytargets-text',
'revdelete-nologid-title',
'revdelete-nologid-text',
+ 'revdelete-no-file',
+ 'revdelete-show-file-confirm',
+ 'revdelete-show-file-submit',
'revdelete-selected',
'logdelete-selected',
'revdelete-text',
+ 'revdelete-confirm',
'revdelete-suppress-text',
'revdelete-legend',
'revdelete-hide-text',
+ 'revdelete-hide-image',
'revdelete-hide-name',
'revdelete-hide-comment',
'revdelete-hide-user',
'revdelete-hide-restricted',
+ 'revdelete-radio-same',
+ 'revdelete-radio-set',
+ 'revdelete-radio-unset',
'revdelete-suppress',
- 'revdelete-hide-image',
'revdelete-unsuppress',
'revdelete-log',
'revdelete-submit',
@@ -673,7 +714,9 @@ $wgMessageStructure = array(
'revdelete-logaction',
'logdelete-logaction',
'revdelete-success',
+ 'revdelete-failure',
'logdelete-success',
+ 'logdelete-failure',
'revdel-restore',
'pagehist',
'deletedhist',
@@ -686,6 +729,18 @@ $wgMessageStructure = array(
'revdelete-unhid',
'revdelete-log-message',
'logdelete-log-message',
+ 'revdelete-hide-current',
+ 'revdelete-show-no-access',
+ 'revdelete-modify-no-access',
+ 'revdelete-modify-missing',
+ 'revdelete-no-change',
+ 'revdelete-concurrent-change',
+ 'revdelete-only-restricted',
+ 'revdelete-reason-dropdown',
+ 'revdelete-otherreason',
+ 'revdelete-reasonotherlist',
+ 'revdelete-edit-reasonlist',
+ 'revdelete-offender',
),
'suppression' => array(
'suppressionlog',
@@ -724,73 +779,17 @@ $wgMessageStructure = array(
'difference',
'lineno',
'compareselectedversions',
- 'visualcomparison',
- 'wikicodecomparison',
+ 'showhideselectedversions',
'editundo',
'diff-multi',
- 'diff-movedto',
- 'diff-styleadded',
- 'diff-added',
- 'diff-changedto',
- 'diff-movedoutof',
- 'diff-styleremoved',
- 'diff-removed',
- 'diff-changedfrom',
- 'diff-src',
- 'diff-withdestination',
- 'diff-with',
- 'diff-with-additional',
- 'diff-with-final',
- 'diff-width',
- 'diff-height',
- 'diff-p',
- 'diff-blockquote',
- 'diff-h1',
- 'diff-h2',
- 'diff-h3',
- 'diff-h4',
- 'diff-h5',
- 'diff-pre',
- 'diff-div',
- 'diff-ul',
- 'diff-ol',
- 'diff-li',
- 'diff-table',
- 'diff-tbody',
- 'diff-tr',
- 'diff-td',
- 'diff-th',
- 'diff-br',
- 'diff-hr',
- 'diff-code',
- 'diff-dl',
- 'diff-dt',
- 'diff-dd',
- 'diff-input',
- 'diff-form',
- 'diff-img',
- 'diff-span',
- 'diff-a',
- 'diff-i',
- 'diff-b',
- 'diff-strong',
- 'diff-em',
- 'diff-font',
- 'diff-big',
- 'diff-del',
- 'diff-tt',
- 'diff-sub',
- 'diff-sup',
- 'diff-strike',
),
'search' => array(
+ 'search-summary',
'searchresults',
'searchresults-title',
'searchresulttext',
'searchsubtitle',
'searchsubtitleinvalid',
- 'noexactmatch',
- 'noexactmatch-nocreate',
'toomanymatches',
'titlematches',
'notitlematches',
@@ -809,7 +808,6 @@ $wgMessageStructure = array(
'searchmenu-prefix',
'searchmenu-help',
'searchprofile-articles',
- 'searchprofile-articles-and-proj',
'searchprofile-project',
'searchprofile-images',
'searchprofile-everything',
@@ -819,8 +817,6 @@ $wgMessageStructure = array(
'searchprofile-images-tooltip',
'searchprofile-everything-tooltip',
'searchprofile-advanced-tooltip',
- 'prefs-search-nsdefault',
- 'prefs-search-nscustom',
'search-result-size',
'search-result-score',
'search-redirect',
@@ -834,11 +830,12 @@ $wgMessageStructure = array(
'search-mwsuggest-disabled',
'search-relatedarticle',
'mwsuggest-disable',
+ 'searcheverything-enable',
'searchrelated',
'searchall',
'showingresults',
'showingresultsnum',
- 'showingresultstotal',
+ 'showingresultsheader',
'nonefound',
'search-nonefound',
'powersearch',
@@ -846,6 +843,9 @@ $wgMessageStructure = array(
'powersearch-ns',
'powersearch-redir',
'powersearch-field',
+ 'powersearch-togglelabel',
+ 'powersearch-toggleall',
+ 'powersearch-togglenone',
'search-external',
'searchdisabled',
'googlesearch',
@@ -853,6 +853,14 @@ $wgMessageStructure = array(
'opensearch' => array(
'opensearch-desc',
),
+ 'quickbar' => array(
+ 'qbsettings',
+ 'qbsettings-none',
+ 'qbsettings-fixedleft',
+ 'qbsettings-fixedright',
+ 'qbsettings-floatingleft',
+ 'qbsettings-floatingright',
+ ),
'preferences' => array(
'preferences',
'preferences-summary',
@@ -860,29 +868,12 @@ $wgMessageStructure = array(
'prefs-edits',
'prefsnologin',
'prefsnologintext',
- 'prefsreset',
- 'qbsettings',
- 'qbsettings-none',
- 'qbsettings-fixedleft',
- 'qbsettings-fixedright',
- 'qbsettings-floatingleft',
- 'qbsettings-floatingright',
'changepassword',
- 'skin',
+ 'prefs-skin',
'skin-preview',
- 'math',
- 'dateformat',
+ 'prefs-math',
'datedefault',
- 'datetime',
- 'math_failure',
- 'math_unknown_error',
- 'math_unknown_function',
- 'math_lexing_error',
- 'math_syntax_error',
- 'math_image_error',
- 'math_bad_tmpdir',
- 'math_bad_output',
- 'math_notexvc',
+ 'prefs-datetime',
'prefs-personal',
'prefs-rc',
'prefs-watchlist',
@@ -890,12 +881,15 @@ $wgMessageStructure = array(
'prefs-watchlist-days-max',
'prefs-watchlist-edits',
'prefs-watchlist-edits-max',
- 'prefs-misc',
+ 'prefs-watchlist-token',
+ 'prefs-misc', // continue checking if used from here on (r49916)
'prefs-resetpass',
+ 'prefs-email',
+ 'prefs-rendering',
'saveprefs',
'resetprefs',
'restoreprefs',
- 'textboxsize',
+ 'prefs-editing',
'prefs-edit-boxsize',
'rows',
'columns',
@@ -907,11 +901,11 @@ $wgMessageStructure = array(
'recentchangesdays',
'recentchangesdays-max',
'recentchangescount',
+ 'prefs-help-recentchangescount',
+ 'prefs-help-watchlist-token',
'savedprefs',
'timezonelegend',
- 'timezonetext',
'localtime',
- 'timezoneselect',
'timezoneuseserverdefault',
'timezoneuseoffset',
'timezoneoffset',
@@ -933,9 +927,47 @@ $wgMessageStructure = array(
'defaultns',
'default',
'defaultns',
- 'files',
+ 'prefs-files',
'prefs-custom-css',
'prefs-custom-js',
+ 'prefs-reset-intro',
+ 'prefs-emailconfirm-label',
+ 'prefs-textboxsize',
+ 'youremail',
+ 'username',
+ 'uid',
+ 'prefs-memberingroups',
+ 'prefs-memberingroups-type',
+ 'prefs-registration',
+ 'prefs-registration-date-time',
+ 'yourrealname',
+ 'yourlanguage',
+ 'yourvariant',
+ 'yournick',
+ 'prefs-help-signature',
+ 'badsig',
+ 'badsiglength',
+ 'yourgender',
+ 'gender-unknown',
+ 'gender-male',
+ 'gender-female',
+ 'prefs-help-gender',
+ 'email',
+ 'prefs-help-realname',
+ 'prefs-help-email',
+ 'prefs-help-email-required',
+ 'prefs-info',
+ 'prefs-i18n',
+ 'prefs-signature',
+ 'prefs-dateformat',
+ 'prefs-timeoffset',
+ 'prefs-advancedediting',
+ 'prefs-advancedrc',
+ 'prefs-advancedrendering',
+ 'prefs-advancedsearchoptions',
+ 'prefs-advancedwatchlist',
+ 'prefs-display',
+ 'prefs-diffs',
),
'userrights' => array(
'userrights',
@@ -947,6 +979,7 @@ $wgMessageStructure = array(
'userrights-editusergroup',
'saveusergroups',
'userrights-groupsmember',
+ 'userrights-groupsmember-auto',
'userrights-groups-help',
'userrights-reason',
'userrights-no-interwiki',
@@ -1010,6 +1043,7 @@ $wgMessageStructure = array(
'right-bigdelete',
'right-deleterevision',
'right-deletedhistory',
+ 'right-deletedtext',
'right-browsearchive',
'right-undelete',
'right-suppressrevision',
@@ -1023,6 +1057,8 @@ $wgMessageStructure = array(
'right-editprotected',
'right-editinterface',
'right-editusercssjs',
+ 'right-editusercss',
+ 'right-edituserjs',
'right-rollback',
'right-markbotedits',
'right-noratelimit',
@@ -1039,6 +1075,8 @@ $wgMessageStructure = array(
'right-siteadmin',
'right-reset-passwords',
'right-override-export-depth',
+ 'right-versiondetail',
+ 'right-sendemail',
),
'rightslog' => array(
'rightslog',
@@ -1089,6 +1127,15 @@ $wgMessageStructure = array(
'recentchanges-legend',
'recentchangestext',
'recentchanges-feed-description',
+ 'recentchanges-label-legend',
+ 'recentchanges-legend-newpage',
+ 'recentchanges-label-newpage',
+ 'recentchanges-legend-minor',
+ 'recentchanges-label-minor',
+ 'recentchanges-legend-bot',
+ 'recentchanges-label-bot',
+ 'recentchanges-legend-unpatrolled',
+ 'recentchanges-label-unpatrolled',
'rcnote',
'rcnotefrom',
'rclistfrom',
@@ -1106,6 +1153,7 @@ $wgMessageStructure = array(
'minoreditletter',
'newpageletter',
'boteditletter',
+ 'unpatrolledletter',
'sectionlink',
'number_of_watching_users_RCview',
'number_of_watching_users_pageview',
@@ -1118,6 +1166,8 @@ $wgMessageStructure = array(
),
'recentchangeslinked' => array(
'recentchangeslinked',
+ 'recentchangeslinked-feed',
+ 'recentchangeslinked-toolbox',
'recentchangeslinked-title',
'recentchangeslinked-backlink',
'recentchangeslinked-noresult',
@@ -1128,8 +1178,8 @@ $wgMessageStructure = array(
'upload' => array(
'upload',
'uploadbtn',
- 'reupload',
'reuploaddesc',
+ 'upload-tryagain',
'uploadnologin',
'uploadnologintext',
'upload_directory_missing',
@@ -1156,6 +1206,7 @@ $wgMessageStructure = array(
'minlength1',
'illegalfilename',
'badfilename',
+ 'filetype-mime-mismatch',
'filetype-badmime',
'filetype-bad-ie-mime',
'filetype-unwanted-type',
@@ -1167,7 +1218,6 @@ $wgMessageStructure = array(
'fileexists',
'filepageexists',
'fileexists-extension',
- 'fileexists-thumb',
'fileexists-thumbnail-yes',
'file-thumbnail-no',
'fileexists-forbidden',
@@ -1176,6 +1226,7 @@ $wgMessageStructure = array(
'file-deleted-duplicate',
'successfulupload',
'uploadwarning',
+ 'uploadwarning-text',
'savefile',
'uploadedimage',
'overwroteimage',
@@ -1183,11 +1234,14 @@ $wgMessageStructure = array(
'uploaddisabledtext',
'php-uploaddisabledtext',
'uploadscripted',
- 'uploadcorrupt',
'uploadvirus',
+ 'upload-source',
'sourcefilename',
+ 'sourceurl',
'destfilename',
'upload-maxfilesize',
+ 'upload-description',
+ 'upload-options',
'watchthisupload',
'filewasdeleted',
'upload-wasdeleted',
@@ -1201,7 +1255,36 @@ $wgMessageStructure = array(
'upload-file-error-text',
'upload-misc-error',
'upload-misc-error-text',
+ 'upload-too-many-redirects',
+ 'upload-unknown-size',
+ 'upload-http-error',
),
+
+ 'img-auth' => array(
+ 'img-auth-accessdenied',
+ 'img-auth-desc',
+ 'img-auth-nopathinfo',
+ 'img-auth-notindir',
+ 'img-auth-badtitle',
+ 'img-auth-nologinnWL',
+ 'img-auth-nofile',
+ 'img-auth-isdir',
+ 'img-auth-streaming',
+ 'img-auth-public',
+ 'img-auth-noread',
+ ),
+
+ 'http-errors' => array(
+ 'http-invalid-url',
+ 'http-invalid-scheme',
+ 'http-request-error',
+ 'http-read-error',
+ 'http-timed-out',
+ 'http-curl-error',
+ 'http-host-unreachable',
+ 'http-bad-status',
+ ),
+
'upload-curl-errors' => array(
'upload-curl-error6',
'upload-curl-error6-text',
@@ -1210,6 +1293,7 @@ $wgMessageStructure = array(
),
'licenses' => array(
'license',
+ 'license-header',
'nolicense',
'licenses',
'license-nopreview',
@@ -1229,6 +1313,7 @@ $wgMessageStructure = array(
'listfiles_count',
),
'filedescription' => array(
+ 'file-anchor-link',
'filehist',
'filehist-help',
'filehist-deleteall',
@@ -1243,6 +1328,7 @@ $wgMessageStructure = array(
'filehist-dimensions',
'filehist-filesize',
'filehist-comment',
+ 'filehist-missing',
'imagelinks',
'linkstoimage',
'linkstoimage-more',
@@ -1251,15 +1337,15 @@ $wgMessageStructure = array(
'redirectstofile',
'duplicatesoffile',
'sharedupload',
- 'shareduploadwiki',
- 'shareduploadwiki-desc',
- 'shareduploadwiki-linktext',
+ 'sharedupload-desc-there',
+ 'sharedupload-desc-here',
'shareddescriptionfollows',
- 'noimage',
- 'noimage-linktext',
+ 'filepage-nofile',
+ 'filepage-nofile-link',
'uploadnewversion-linktext',
'shared-repo-from',
'shared-repo',
+ 'shared-repo-name-wikimediacommons',
),
'filerevert' => array(
'filerevert',
@@ -1288,6 +1374,7 @@ $wgMessageStructure = array(
'filedelete-reason-otherlist',
'filedelete-reason-dropdown',
'filedelete-edit-reasonlist',
+ 'filedelete-maintenance',
),
'mimesearch' => array(
'mimesearch',
@@ -1325,6 +1412,7 @@ $wgMessageStructure = array(
'statistics-header-edits',
'statistics-header-views',
'statistics-header-users',
+ 'statistics-header-hooks',
'statistics-articles',
'statistics-pages',
'statistics-pages-desc',
@@ -1508,6 +1596,7 @@ $wgMessageStructure = array(
'deletedcontribs' => array(
'deletedcontributions',
'deletedcontributions-title',
+ 'sp-deletedcontributions-contribs',
),
'linksearch' => array(
'linksearch',
@@ -1522,6 +1611,18 @@ $wgMessageStructure = array(
'listusersfrom',
'listusers-submit',
'listusers-noresult',
+ 'listusers-blocked',
+ ),
+ 'activeusers' => array(
+ 'activeusers',
+ 'activeusers-summary',
+ 'activeusers-intro',
+ 'activeusers-count',
+ 'activeusers-from',
+ 'activeusers-hidebots',
+ 'activeusers-hidesysops',
+ 'activeusers-submit',
+ 'activeusers-noresult',
),
'newuserlog' => array(
'newuserlogpage',
@@ -1535,15 +1636,22 @@ $wgMessageStructure = array(
'listgrouprights' => array(
'listgrouprights',
'listgrouprights-summary',
+ 'listgrouprights-key',
'listgrouprights-group',
'listgrouprights-rights',
'listgrouprights-helppage',
'listgrouprights-members',
'listgrouprights-right-display',
+ 'listgrouprights-right-revoked',
'listgrouprights-addgroup',
'listgrouprights-removegroup',
'listgrouprights-addgroup-all',
'listgrouprights-removegroup-all',
+ 'listgrouprights-addgroup-self',
+ 'listgrouprights-removegroup-self',
+ 'listgrouprights-addgroup-self-all',
+ 'listgrouprights-removegroup-self-all',
+
),
'emailuser' => array(
'mailnologin',
@@ -1629,6 +1737,7 @@ $wgMessageStructure = array(
'historywarning',
'confirmdeletetext',
'actioncomplete',
+ 'actionfailed',
'deletedtext',
'deletedarticle',
'suppressedarticle',
@@ -1653,6 +1762,7 @@ $wgMessageStructure = array(
'alreadyrolled',
'editcomment',
'revertpage',
+ 'revertpage-nouser',
'rollback-success',
'sessionfailure',
),
@@ -1671,7 +1781,7 @@ $wgMessageStructure = array(
'protectexpiry',
'protect_expiry_invalid',
'protect_expiry_old',
- 'protect-unchain',
+ 'protect-unchain-permissions',
'protect-text',
'protect-locked-blocked',
'protect-locked-dblock',
@@ -1728,6 +1838,7 @@ $wgMessageStructure = array(
'undelete-nodiff',
'undeletebtn',
'undeletelink',
+ 'undeleteviewlink',
'undeletereset',
'undeleteinvert',
'undeletecomment',
@@ -1771,7 +1882,11 @@ $wgMessageStructure = array(
'sp-contributions-newbies-sub',
'sp-contributions-newbies-title',
'sp-contributions-blocklog',
+ 'sp-contributions-deleted',
'sp-contributions-logs',
+ 'sp-contributions-talk',
+ 'sp-contributions-userrights',
+ 'sp-contributions-blocked-notice',
'sp-contributions-search',
'sp-contributions-username',
'sp-contributions-submit',
@@ -1802,6 +1917,7 @@ $wgMessageStructure = array(
),
'block' => array(
'blockip',
+ 'blockip-title',
'blockip-legend',
'blockiptext',
'ipaddress',
@@ -1845,6 +1961,8 @@ $wgMessageStructure = array(
'ipblocklist-sh-addressblocks',
'ipblocklist-summary',
'ipblocklist-submit',
+ 'ipblocklist-localblock',
+ 'ipblocklist-otherblocks',
'blocklistline',
'infiniteblock',
'expiringblock',
@@ -1861,7 +1979,8 @@ $wgMessageStructure = array(
'contribslink',
'autoblocker',
'blocklogpage',
- 'blocklog-fulllog',
+ 'blocklog-showlog',
+ 'blocklog-showsuppresslog',
'blocklogentry',
'reblock-logentry',
'blocklogtext',
@@ -1879,9 +1998,11 @@ $wgMessageStructure = array(
'ipb_hide_invalid',
'ipb_already_blocked',
'ipb-needreblock',
+ 'ipb-otherblocks-header',
'ipb_cant_unblock',
'ipb_blocked_as_range',
'ip_range_invalid',
+ 'ip_range_toolarge',
'blockme',
'proxyblocker',
'proxyblocker-disabled',
@@ -1891,6 +2012,7 @@ $wgMessageStructure = array(
'sorbsreason',
'sorbs_create_account_reason',
'cant-block-while-blocked',
+ 'cant-see-hidden-user'
),
'developertools' => array(
'lockdb',
@@ -1916,6 +2038,7 @@ $wgMessageStructure = array(
'movepagetext',
'movepagetalktext',
'movearticle',
+ 'moveuserpage-warning',
'movenologin',
'movenologintext',
'movenotallowed',
@@ -1966,6 +2089,10 @@ $wgMessageStructure = array(
'imageinvalidfilename',
'fix-double-redirects',
'move-leave-redirect',
+ 'protectedpagemovewarning',
+ 'semiprotectedpagemovewarning',
+ 'move-over-sharedrepo',
+ 'file-exists-sharedrepo',
),
'export' => array(
'export',
@@ -1988,8 +2115,14 @@ $wgMessageStructure = array(
'allmessagescurrent',
'allmessagestext',
'allmessagesnotsupportedDB',
- 'allmessagesfilter',
- 'allmessagesmodified',
+ 'allmessages-filter-legend',
+ 'allmessages-filter',
+ 'allmessages-filter-unmodified',
+ 'allmessages-filter-all',
+ 'allmessages-filter-modified',
+ 'allmessages-prefix',
+ 'allmessages-language',
+ 'allmessages-filter-submit',
),
'thumbnails' => array(
'thumbnail-more',
@@ -1999,6 +2132,9 @@ $wgMessageStructure = array(
'djvu_no_xml',
'thumbnail_invalid_params',
'thumbnail_dest_directory',
+ 'thumbnail_image-type',
+ 'thumbnail_gd-library',
+ 'thumbnail_image-missing',
),
'import' => array(
'import',
@@ -2060,6 +2196,7 @@ $wgMessageStructure = array(
'accesskey-ca-viewsource',
'accesskey-ca-history',
'accesskey-ca-protect',
+ 'accesskey-ca-unprotect',
'accesskey-ca-delete',
'accesskey-ca-undelete',
'accesskey-ca-move',
@@ -2070,6 +2207,7 @@ $wgMessageStructure = array(
'accesskey-search-fulltext',
'accesskey-p-logo',
'accesskey-n-mainpage',
+ 'accesskey-n-mainpage-description',
'accesskey-n-portal',
'accesskey-n-currentevents',
'accesskey-n-recentchanges',
@@ -2101,7 +2239,6 @@ $wgMessageStructure = array(
'accesskey-preview',
'accesskey-diff',
'accesskey-compareselectedversions',
- 'accesskey-visualcomparison',
'accesskey-watch',
'accesskey-upload',
),
@@ -2122,6 +2259,7 @@ $wgMessageStructure = array(
'tooltip-ca-viewsource',
'tooltip-ca-history',
'tooltip-ca-protect',
+ 'tooltip-ca-unprotect',
'tooltip-ca-delete',
'tooltip-ca-undelete',
'tooltip-ca-move',
@@ -2132,6 +2270,7 @@ $wgMessageStructure = array(
'tooltip-search-fulltext',
'tooltip-p-logo',
'tooltip-n-mainpage',
+ 'tooltip-n-mainpage-description',
'tooltip-n-portal',
'tooltip-n-currentevents',
'tooltip-n-recentchanges',
@@ -2179,6 +2318,7 @@ $wgMessageStructure = array(
'chick.css',
'simple.css',
'modern.css',
+ 'vector.css',
'print.css',
'handheld.css',
),
@@ -2192,6 +2332,7 @@ $wgMessageStructure = array(
'chick.js',
'simple.js',
'modern.js',
+ 'vector.js',
),
'metadata_cc' => array(
'nodublincore',
@@ -2201,10 +2342,12 @@ $wgMessageStructure = array(
'attribution' => array(
'anonymous',
'siteuser',
+ 'anonuser',
'lastmodifiedatby',
'othercontribs',
'others',
'siteusers',
+ 'anonusers',
'creditspage',
'nocredits',
),
@@ -2233,6 +2376,7 @@ $wgMessageStructure = array(
'skinname-chick',
'skinname-simple',
'skinname-modern',
+ 'skinname-vector',
),
'math' => array(
'mw_math_png',
@@ -2242,6 +2386,17 @@ $wgMessageStructure = array(
'mw_math_modern',
'mw_math_mathml',
),
+ 'matherrors' => array(
+ 'math_failure',
+ 'math_unknown_error',
+ 'math_unknown_function',
+ 'math_lexing_error',
+ 'math_syntax_error',
+ 'math_image_error',
+ 'math_bad_tmpdir',
+ 'math_bad_output',
+ 'math_notexvc',
+ ),
'patrolling' => array(
'markaspatrolleddiff',
'markaspatrolledlink',
@@ -2275,9 +2430,6 @@ $wgMessageStructure = array(
'previousdiff',
'nextdiff',
),
- 'visual-comparison' => array(
- 'visual-comparison',
- ),
'media-info' => array(
'mediawarning',
'imagemaxsize',
@@ -2290,6 +2442,8 @@ $wgMessageStructure = array(
'svg-long-desc',
'show-big-image',
'show-big-image-thumb',
+ 'file-info-gif-looped',
+ 'file-info-gif-frames',
),
'newfiles' => array(
'newimages',
@@ -2687,6 +2841,7 @@ $wgMessageStructure = array(
'watchlistall2',
'namespacesall',
'monthsall',
+ 'limitall',
),
'confirmemail' => array(
'confirmemail',
@@ -2743,6 +2898,7 @@ $wgMessageStructure = array(
'word-separator',
'ellipsis',
'percent',
+ 'parentheses',
),
'imgmulti' => array(
'imgmultipageprev',
@@ -2891,6 +3047,7 @@ $wgMessageStructure = array(
'version-hook-name',
'version-hook-subscribedby',
'version-version',
+ 'version-svn-revision',
'version-license',
'version-software',
'version-software-product',
@@ -2958,6 +3115,17 @@ $wgMessageStructure = array(
'dberr-outofdate',
'dberr-cachederror',
),
+ 'html-forms' => array(
+ 'htmlform-invalid-input',
+ 'htmlform-select-badoption',
+ 'htmlform-int-invalid',
+ 'htmlform-float-invalid',
+ 'htmlform-int-toolow',
+ 'htmlform-int-toohigh',
+ 'htmlform-submit',
+ 'htmlform-reset',
+ 'htmlform-selectorother-other',
+ ),
);
/** Comments for each block */
@@ -2970,11 +3138,13 @@ XHTML id it should only appear once and include characters that are legal
XHTML id names.",
'toggles' => 'User preference toggles',
'underline' => '',
+ 'editfont' => 'Font style option in Special:Preferences',
'dates' => 'Dates',
'categorypages' => 'Categories related messages',
'mainpage' => '',
'miscellaneous1' => '',
- 'metadata_help' => 'Metadata in edit box',
+ 'cologneblue' => 'Cologne Blue skin',
+ 'vector' => 'Vector skin',
'miscellaneous2' => '',
'links' => 'All link text and link target definitions of links into project namespace that get used by other message strings, with the exception of user group pages (see grouppage) and the disambiguation template definition (see disambiguations).',
'badaccess' => '',
@@ -3000,6 +3170,7 @@ XHTML id names.",
'diffs' => 'Diffs',
'search' => 'Search results',
'opensearch' => 'OpenSearch description',
+ 'quickbar' => 'Quickbar',
'preferences' => 'Preferences page',
'userrights' => 'User rights',
'group' => 'Groups',
@@ -3012,6 +3183,8 @@ XHTML id names.",
'recentchangeslinked' => 'Recent changes linked',
'upload' => 'Upload',
'upload-errors' => '',
+ 'img-auth' => 'img_auth script messages',
+ 'http-errors' => 'HTTP errors',
'upload-curl-errors' => 'Some likely curl errors. More could be added from <http://curl.haxx.se/libcurl/c/libcurl-errors.html>',
'licenses' => '',
'filelist' => 'Special:ListFiles',
@@ -3039,6 +3212,7 @@ XHTML id names.",
'deletedcontribs' => 'Special:DeletedContributions',
'linksearch' => 'Special:LinkSearch',
'listusers' => 'Special:ListUsers',
+ 'activeusers' => 'Special:ActiveUsers',
'newuserlog' => 'Special:Log/newusers',
'listgrouprights' => 'Special:ListGroupRights',
'emailuser' => 'E-mail user',
@@ -3073,6 +3247,7 @@ XHTML id names.",
'info' => 'Info page',
'skin' => 'Skin names',
'math' => 'Math options',
+ 'matherrors' => 'Math errors',
'patrolling' => 'Patrolling',
'patrol-log' => 'Patrol log',
'imagedeletion' => 'Image deletion',
@@ -3089,7 +3264,6 @@ Variants for Chinese language",
'variantname-kk' => 'Variants for Kazakh language',
'variantname-ku' => 'Variants for Kurdish language',
'variantname-tg' => 'Variants for Tajiki language',
- 'visual-comparison' => 'Visual comparison',
'media-info' => 'Media information',
'metadata' => 'Metadata',
'exif' => 'EXIF tags',
@@ -3124,7 +3298,7 @@ Variants for Chinese language",
'exif-gpslongitude' => 'Pseudotags used for GPSLongitudeRef and GPSDestLongitudeRef',
'exif-gpsstatus' => '',
'exif-gpsmeasuremode' => '',
- 'exif-gpsspeed' => 'Pseudotags used for GPSSpeedRef and GPSDestDistanceRef',
+ 'exif-gpsspeed' => 'Pseudotags used for GPSSpeedRef',
'exif-gpsdirection' => 'Pseudotags used for GPSTrackRef, GPSImgDirectionRef and GPSDestBearingRef',
'edit-externally' => 'External editor support',
'all' => "'all' in various places, this might be different for inflected languages",
@@ -3157,35 +3331,5 @@ Variants for Chinese language",
'external_images' => 'External image whitelist',
'special-tags' => 'Special:Tags',
'db-error-messages' => 'Database error messages',
-);
-
-/** Short comments for standalone messages */
-$wgMessageComments = array(
- 'hidden-category-category' => 'Name of the category where hidden categories will be listed',
- 'lastmodifiedat' => '$1 date, $2 time',
- 'sitenotice' => 'the equivalent to wgSiteNotice',
- 'history-feed-item-nocomment' => 'user at time',
- 'sharedupload' => '$1 is the repo name, $2 is shareduploadwiki(-desc)',
- 'shared-repo-from' => '$1 is the repository name',
- 'shared-repo' => 'used when shared-repo-NAME does not exist',
- 'editcomment' => 'only shown if there is an edit comment',
- 'revertpage' => 'Additionally available: $3: revid of the revision reverted to, $4: timestamp of the revision reverted to, $5: revid of the revision reverted from, $6: timestamp of the revision reverted from',
- 'lastmodifiedatby' => '$1 date, $2 time, $3 user',
- 'exif-orientation-1' => '0th row: top; 0th column: left',
- 'exif-orientation-2' => '0th row: top; 0th column: right',
- 'exif-orientation-3' => '0th row: bottom; 0th column: right',
- 'exif-orientation-4' => '0th row: bottom; 0th column: left',
- 'exif-orientation-5' => '0th row: left; 0th column: top',
- 'exif-orientation-6' => '0th row: right; 0th column: top',
- 'exif-orientation-7' => '0th row: right; 0th column: bottom',
- 'exif-orientation-8' => '0th row: left; 0th column: bottom',
- 'movepage-moved' => 'The two titles are passed in plain text as $3 and $4 to allow additional goodies in the message.',
- 'ipboptions' => 'display1:time1,display2:time2,...',
- 'protect-expiry-options' => 'display1:time1,display2:time2,...',
- 'metadata-fields' => 'Do not translate list items',
- 'version' => 'Not used as normal message but as header for the special page itself',
- 'userrights' => 'Not used as normal message but as header for the special page itself',
- 'revision-info' => 'Additionally available: $3: revision id',
- 'revision-info-current' => 'Available parameters: $1: timestamp; $2: userlinks; $3: revision id',
- 'nocontribs' => 'Optional parameter: $1 is the user name',
+ 'html-forms' => 'HTML forms',
);
diff --git a/maintenance/language/rebuildLanguage.php b/maintenance/language/rebuildLanguage.php
index 91fda3f4..6c624ca3 100644
--- a/maintenance/language/rebuildLanguage.php
+++ b/maintenance/language/rebuildLanguage.php
@@ -17,18 +17,50 @@ require_once( 'writeMessagesArray.inc' );
* @param $code The language code.
* @param $write Write to the messages file?
* @param $listUnknown List the unknown messages?
- * @param $removeUnKnown Remove the unknown messages?
+ * @param $removeUnknown Remove the unknown messages?
+ * @param $removeDupes Remove the duplicated messages?
+ * @param $dupeMsgSource The source file intended to remove from the array.
*/
-function rebuildLanguage( $code, $write, $listUnknown, $removeUnknown ) {
+function rebuildLanguage( $code, $write, $listUnknown, $removeUnknown, $removeDupes, $dupeMsgSource ) {
global $wgLanguages;
$messages = $wgLanguages->getMessages( $code );
$messages = $messages['all'];
+ if ($removeDupes) {
+ $messages = removeDupes( $messages, $dupeMsgSource );
+ }
MessageWriter::writeMessagesToFile( $messages, $code, $write, $listUnknown, $removeUnknown );
}
+/**
+ * Remove duplicates from a message array.
+ *
+ * @param $oldMsgArray The input message array.
+ * @param $dupeMsgSource The source file path for duplicates.
+ * @return $newMsgArray The output message array, with duplicates removed.
+ */
+function removeDupes( $oldMsgArray, $dupeMsgSource ) {
+ if (file_exists($dupeMsgSource)) {
+ include($dupeMsgSource);
+ if (!isset($dupeMessages)) {
+ echo("There are no duplicated messages in the source file provided.");
+ exit(1);
+ }
+ } else {
+ echo ("The specified file $dupeMsgSource cannot be found.");
+ exit(1);
+ }
+ $newMsgArray = $oldMsgArray;
+ foreach ($oldMsgArray as $key => $value) {
+ if ( array_key_exists( $key, $dupeMessages ) ) {
+ unset($newMsgArray[$key]);
+ }
+ }
+ return $newMsgArray;
+}
+
# Show help
if ( isset( $options['help'] ) ) {
- echo <<<END
+ echo <<<TEXT
Run this script to rewrite the messages array in the files languages/messages/MessagesXX.php.
Parameters:
* lang: Language code (default: the installation default language). You can also specify "all" to check all the languages.
@@ -37,9 +69,10 @@ Options:
* dry-run: Do not write the array to the file.
* no-unknown: Do not list the unknown messages.
* remove-unknown: Remove unknown messages.
+ * remove-duplicates: Remove duplicated messages based on a PHP source file.
-END;
- exit();
+TEXT;
+ exit(1);
}
# Get the language code
@@ -49,10 +82,18 @@ if ( isset( $options['lang'] ) ) {
$wgCode = $wgContLang->getCode();
}
+# Get the duplicate message source
+if ( isset( $options['remove-duplicates'] ) && ( strcmp( $options['remove-duplicates'], '' ) ) ) {
+ $wgDupeMessageSource = $options['remove-duplicates'];
+} else {
+ $wgDupeMessageSource = '';
+}
+
# Get the options
$wgWriteToFile = !isset( $options['dry-run'] );
$wgListUnknownMessages = !isset( $options['no-unknown'] );
$wgRemoveUnknownMessages = isset( $options['remove-unknown'] );
+$wgRemoveDuplicateMessages = isset( $options['remove-duplicates'] );
# Get language objects
$wgLanguages = new languages();
@@ -60,8 +101,8 @@ $wgLanguages = new languages();
# Write all the language
if ( $wgCode == 'all' ) {
foreach ( $wgLanguages->getLanguages() as $language ) {
- rebuildLanguage( $language, $wgWriteToFile, $wgListUnknownMessages, $wgRemoveUnknownMessages );
+ rebuildLanguage( $language, $wgWriteToFile, $wgListUnknownMessages, $wgRemoveUnknownMessages, $wgRemoveDuplicateMessages, $wgDupeMessageSource );
}
} else {
- rebuildLanguage( $wgCode, $wgWriteToFile, $wgListUnknownMessages, $wgRemoveUnknownMessages );
+ rebuildLanguage( $wgCode, $wgWriteToFile, $wgListUnknownMessages, $wgRemoveUnknownMessages, $wgRemoveDuplicateMessages, $wgDupeMessageSource );
}
diff --git a/maintenance/language/transstat.php b/maintenance/language/transstat.php
index b433abb4..eeded34e 100644
--- a/maintenance/language/transstat.php
+++ b/maintenance/language/transstat.php
@@ -9,7 +9,7 @@
* @author Ashar Voultoiz <thoane@altern.org>
*
* Output is posted from time to time on:
- * http://meta.wikimedia.org/wiki/Localization_statistics
+ * http://www.mediawiki.org/wiki/Localisation_statistics
*/
$optionsWithArgs = array( 'output' );
@@ -29,18 +29,17 @@ if ( !isset( $options['output'] ) ) {
/** Print a usage message*/
function showUsage() {
- print <<<END
+ print <<<TEXT
Usage: php transstat.php [--help] [--output=csv|text|wiki]
--help : this helpful message
--output : select an output engine one of:
* 'csv' : Comma Separated Values.
* 'wiki' : MediaWiki syntax (default).
- * 'metawiki' : MediaWiki syntax used for Meta-Wiki.
* 'text' : Text with tabs.
Example: php maintenance/transstat.php --output=text
-END;
- exit();
+TEXT;
+ exit(1);
}
@@ -48,16 +47,13 @@ END;
# Select an output engine
switch ( $options['output'] ) {
case 'wiki':
- $wgOut = new wikiStatsOutput();
- break;
- case 'metawiki':
- $wgOut = new metawikiStatsOutput();
+ $output = new wikiStatsOutput();
break;
case 'text':
- $wgOut = new textStatsOutput();
+ $output = new textStatsOutput();
break;
case 'csv':
- $wgOut = new csvStatsOutput();
+ $output = new csvStatsOutput();
break;
default:
showUsage();
@@ -67,17 +63,18 @@ switch ( $options['output'] ) {
$wgLanguages = new languages();
# Header
-$wgOut->heading();
-$wgOut->blockstart();
-$wgOut->element( 'Language', true );
-$wgOut->element( 'Code', true );
-$wgOut->element( 'Translated', true );
-$wgOut->element( '%', true );
-$wgOut->element( 'Obsolete', true );
-$wgOut->element( '%', true );
-$wgOut->element( 'Problematic', true );
-$wgOut->element( '%', true );
-$wgOut->blockend();
+$output->heading();
+$output->blockstart();
+$output->element( 'Language', true );
+$output->element( 'Code', true );
+$output->element( 'Fallback', true );
+$output->element( 'Translated', true );
+$output->element( '%', true );
+$output->element( 'Obsolete', true );
+$output->element( '%', true );
+$output->element( 'Problematic', true );
+$output->element( '%', true );
+$output->blockend();
$wgGeneralMessages = $wgLanguages->getGeneralMessages();
$wgRequiredMessagesNumber = count( $wgGeneralMessages['required'] );
@@ -90,34 +87,36 @@ foreach ( $wgLanguages->getLanguages() as $code ) {
# Calculate the numbers
$language = $wgContLang->getLanguageName( $code );
+ $fallback = $wgLanguages->getFallback( $code );
$messages = $wgLanguages->getMessages( $code );
$messagesNumber = count( $messages['translated'] );
$requiredMessagesNumber = count( $messages['required'] );
- $requiredMessagesPercent = $wgOut->formatPercent( $requiredMessagesNumber, $wgRequiredMessagesNumber );
+ $requiredMessagesPercent = $output->formatPercent( $requiredMessagesNumber, $wgRequiredMessagesNumber );
$obsoleteMessagesNumber = count( $messages['obsolete'] );
- $obsoleteMessagesPercent = $wgOut->formatPercent( $obsoleteMessagesNumber, $messagesNumber, true );
+ $obsoleteMessagesPercent = $output->formatPercent( $obsoleteMessagesNumber, $messagesNumber, true );
$messagesWithMismatchVariables = $wgLanguages->getMessagesWithMismatchVariables( $code );
$emptyMessages = $wgLanguages->getEmptyMessages( $code );
$messagesWithWhitespace = $wgLanguages->getMessagesWithWhitespace( $code );
$nonXHTMLMessages = $wgLanguages->getNonXHTMLMessages( $code );
$messagesWithWrongChars = $wgLanguages->getMessagesWithWrongChars( $code );
$problematicMessagesNumber = count( array_unique( array_merge( $messagesWithMismatchVariables, $emptyMessages, $messagesWithWhitespace, $nonXHTMLMessages, $messagesWithWrongChars ) ) );
- $problematicMessagesPercent = $wgOut->formatPercent( $problematicMessagesNumber, $messagesNumber, true );
+ $problematicMessagesPercent = $output->formatPercent( $problematicMessagesNumber, $messagesNumber, true );
# Output them
- $wgOut->blockstart();
- $wgOut->element( "$language" );
- $wgOut->element( "$code" );
- $wgOut->element( "$requiredMessagesNumber/$wgRequiredMessagesNumber" );
- $wgOut->element( $requiredMessagesPercent );
- $wgOut->element( "$obsoleteMessagesNumber/$messagesNumber" );
- $wgOut->element( $obsoleteMessagesPercent );
- $wgOut->element( "$problematicMessagesNumber/$messagesNumber" );
- $wgOut->element( $problematicMessagesPercent );
- $wgOut->blockend();
+ $output->blockstart();
+ $output->element( "$language" );
+ $output->element( "$code" );
+ $output->element( "$fallback" );
+ $output->element( "$requiredMessagesNumber/$wgRequiredMessagesNumber" );
+ $output->element( $requiredMessagesPercent );
+ $output->element( "$obsoleteMessagesNumber/$messagesNumber" );
+ $output->element( $obsoleteMessagesPercent );
+ $output->element( "$problematicMessagesNumber/$messagesNumber" );
+ $output->element( $problematicMessagesPercent );
+ $output->blockend();
}
# Footer
-$wgOut->footer();
+$output->footer();
diff --git a/maintenance/language/writeMessagesArray.inc b/maintenance/language/writeMessagesArray.inc
index 3a279cb6..e28a5c04 100644
--- a/maintenance/language/writeMessagesArray.inc
+++ b/maintenance/language/writeMessagesArray.inc
@@ -15,7 +15,6 @@ class MessageWriter {
static $messageStructure;
static $blockComments;
- static $messageComments;
static $ignoredMessages;
static $optionalMessages;
@@ -79,13 +78,11 @@ class MessageWriter {
require( $dir . '/messages.inc' );
self::$messageStructure = $wgMessageStructure;
self::$blockComments = $wgBlockComments;
- self::$messageComments = $wgMessageComments;
require( $dir . '/messageTypes.inc' );
self::$ignoredMessages = $wgIgnoredMessages;
self::$optionalMessages = $wgOptionalMessages;
-
# Sort messages to blocks
$sortedMessages['unknown'] = $messages;
foreach( self::$messageStructure as $blockName => $block ) {
@@ -113,7 +110,7 @@ class MessageWriter {
$ignored = array();
$optional = array();
}
- $comments = self::makeComments( array_keys($messages), self::$messageComments, $ignored, $optional );
+ $comments = self::makeComments( array_keys( $messages ), $ignored, $optional );
# Write the block
$messagesText .= self::writeMessagesBlock( self::$blockComments[$block], $messages, $comments );
@@ -134,33 +131,19 @@ class MessageWriter {
* Generates an array of comments for messages.
*
* @param $messages Key of messages.
- * @param $comments Comments for messages, indexed by key.
* @param $ignored List of ingored message keys.
* @param $optional List of optional message keys.
*/
- public static function makeComments( $messages, $comments, $ignored, $optional ) {
+ public static function makeComments( $messages, $ignored, $optional ) {
# Comment collector
$commentArray = array();
# List of keys only
foreach( $messages as $key ) {
- $commentsForKey = array();
-
- # Add descriptive comment for this message if there is one
- if( array_key_exists( $key, $comments ) ) {
- $commentsForKey[] = $comments[$key];
- }
-
- # For translator information only
if( in_array( $key, $ignored ) ) {
- $commentsForKey[] = self::$ignoredComment;
+ $commentArray[$key] = ' # ' . self::$ignoredComment;
} elseif( in_array( $key, $optional ) ) {
- $commentsForKey[] = self::$optionalComment;
- }
-
- # Format one or more comments nicely and store in array
- if( count( $commentsForKey ) ) {
- $commentArray[$key] = ' # ' . implode( '; ', $commentsForKey );
+ $commentArray[$key] = ' # ' . self::$optionalComment;
}
}