6c2076ebb4cc2abaaf9514a2dd1b75ecf86ff9d9
3 * Rewrite the messages array in the files languages/messages/MessagesXX.php.
5 * @addtogroup Maintenance
8 require_once( dirname(__FILE__
).'/../commandLine.inc' );
9 require_once( 'languages.inc' );
10 require_once( 'writeMessagesArray.inc' );
13 * Rewrite a messages array.
15 * @param $code The language code.
16 * @param $write Write to the messages file?
17 * @param $listUnknown List the unknown messages?
19 function rebuildLanguage( $code, $write, $listUnknown ) {
21 $messages = $wgLanguages->getMessages( $code );
22 $messages = $messages['all'];
23 MessageWriter
::writeMessagesToFile( $messages, $code, $write, $listUnknown );
27 if ( isset( $options['help'] ) ) {
29 Run this script to rewrite the messages array in the files languages/messages/MessagesXX.php.
31 * lang: Language code (default: the installation default language). You can also specify "all" to check all the languages.
32 * help: Show this help.
34 * dry-run: Don't write the array to the file.
35 * no-unknown: Don't list the unknown messages.
41 # Get the language code
42 if ( isset( $options['lang'] ) ) {
43 $wgCode = $options['lang'];
45 $wgCode = $wgContLang->getCode();
49 $wgWriteToFile = !isset( $options['dry-run'] );
50 $wgListUnknownMessages = !isset( $options['no-unknown'] );
52 # Get language objects
53 $wgLanguages = new languages();
55 # Write all the language
56 if ( $wgCode == 'all' ) {
57 foreach ( $wgLanguages->getLanguages() as $language ) {
58 rebuildLanguage( $language, $wgWriteToFile, $wgListUnknownMessages );
61 rebuildLanguage( $wgCode, $wgWriteToFile, $wgListUnknownMessages );