summaryrefslogtreecommitdiff
path: root/maintenance/language/rebuildLanguage.php
diff options
context:
space:
mode:
authorPierre Schmitz <pierre@archlinux.de>2007-05-16 20:58:53 +0000
committerPierre Schmitz <pierre@archlinux.de>2007-05-16 20:58:53 +0000
commitcecb985bee3bdd252e1b8dc0bd500b37cd52be01 (patch)
tree17266aa237742640aabee7856f0202317a45d540 /maintenance/language/rebuildLanguage.php
parent0bac06c301f2a83edb0236e4c2434da16848d549 (diff)
Aktualisierung auf MediaWiki 1.10.0
Plugins angepasst und verbessert kleine Korrekturen am Design
Diffstat (limited to 'maintenance/language/rebuildLanguage.php')
-rw-r--r--maintenance/language/rebuildLanguage.php38
1 files changed, 10 insertions, 28 deletions
diff --git a/maintenance/language/rebuildLanguage.php b/maintenance/language/rebuildLanguage.php
index 1643d30b..d4753c4a 100644
--- a/maintenance/language/rebuildLanguage.php
+++ b/maintenance/language/rebuildLanguage.php
@@ -2,8 +2,7 @@
/**
* Rewrite the messages array in the files languages/messages/MessagesXX.php.
*
- * @package MediaWiki
- * @subpackage Maintenance
+ * @addtogroup Maintenance
*/
require_once( dirname(__FILE__).'/../commandLine.inc' );
@@ -15,32 +14,13 @@ require_once( 'writeMessagesArray.inc' );
*
* @param $code The language code.
* @param $write Write to the messages file?
+ * @param $listUnknown List the unknown messages?
*/
-function rebuildLanguage( $code, $write ) {
- global $wgLanguages, $wg;
-
- # Get messages
+function rebuildLanguage( $code, $write, $listUnknown ) {
+ global $wgLanguages;
$messages = $wgLanguages->getMessages( $code );
$messages = $messages['all'];
-
- # Rewrite messages array
- $messagesText = writeMessagesArray( $messages, $code == 'en' );
-
- # Write to the file
- if ( $write ) {
- $filename = Language::getMessagesFileName( $code );
- $contents = file_get_contents( $filename );
- if ( strpos( $contents, '$messages' ) !== false ) {
- $new = explode( '$messages', $contents );
- $new = $new[0];
- $new .= $messagesText;
- $new .= "\n?>\n";
- file_put_contents( $filename, $new );
- echo "Generated and wrote messages in language $code.\n";
- }
- } else {
- echo "Generated messages in language $code.\n";
- }
+ writeMessagesToFile( $messages, $code, $write, $listUnknown );
}
# Show help
@@ -52,6 +32,7 @@ Parameters:
* help: Show this help.
Options:
* dry-run: Don't write the array to the file.
+ * no-unknown: Don't list the unknown messages.
END;
exit();
@@ -64,8 +45,9 @@ if ( isset( $options['lang'] ) ) {
$wgCode = $wgContLang->getCode();
}
-# Get the write options
+# Get the options
$wgWriteToFile = !isset( $options['dry-run'] );
+$wgListUnknownMessages = !isset( $options['no-unknown'] );
# Get language objects
$wgLanguages = new languages();
@@ -73,10 +55,10 @@ $wgLanguages = new languages();
# Write all the language
if ( $wgCode == 'all' ) {
foreach ( $wgLanguages->getLanguages() as $language ) {
- rebuildLanguage( $language, $wgWriteToFile );
+ rebuildLanguage( $language, $wgWriteToFile, $wgListUnknownMessages );
}
} else {
- rebuildLanguage( $wgCode, $wgWriteToFile );
+ rebuildLanguage( $wgCode, $wgWriteToFile, $wgListUnknownMessages );
}
?>