Merge "Removed unneeded spaces and colons in @param and friends"
[lhc/web/wiklou.git] / maintenance / generateJsonI18n.php
index 9c8354c..8dc89ed 100644 (file)
@@ -65,7 +65,7 @@ class GenerateJsonI18n extends Maintenance {
                        $extensionStyle = false;
                        $langcode = $this->getOption( 'langcode' );
                        $messages = array( $langcode => $messages );
-               } else if ( $this->hasOption( 'langcode' ) ) {
+               } elseif ( $this->hasOption( 'langcode' ) ) {
                        $this->output( "Warning: --langcode option set but will not be used.\n" );
                }
 
@@ -83,7 +83,7 @@ class GenerateJsonI18n extends Maintenance {
                        $jsonfile = "$jsondir/$langcode.json";
                        $success = file_put_contents(
                                $jsonfile,
-                               FormatJson::encode( $langmsgs, true, FormatJson::ALL_OK )
+                               FormatJson::encode( $langmsgs, true, FormatJson::ALL_OK ) . "\n"
                        );
                        if ( $success === false ) {
                                $this->error( "FAILED to write $jsonfile", 1 );
@@ -103,6 +103,17 @@ class GenerateJsonI18n extends Maintenance {
        protected function doShim( $jsondir ) {
                $shim = <<<'PHP'
 <?php
+/**
+ * This is a backwards-compatibility shim, generated by:
+ * https://git.wikimedia.org/blob/mediawiki%2Fcore.git/HEAD/maintenance%2FgenerateJsonI18n.php
+ *
+ * Beginning with MediaWiki 1.23, translation strings are stored in json files,
+ * and the EXTENSION.i18n.php file only exists to provide compatibility with
+ * older releases of MediaWiki. For more information about this migration, see:
+ * https://www.mediawiki.org/wiki/Requests_for_comment/Localisation_format
+ *
+ * This shim maintains compatibility back to MediaWiki 1.17.
+ */
 $messages = array();
 $GLOBALS['wgHooks']['LocalisationCacheRecache'][] = function ( $cache, $code, &$cachedData ) {
        $codeSequence = array_merge( array( $code ), $cachedData['fallbackSequence'] );
@@ -125,7 +136,7 @@ $GLOBALS['wgHooks']['LocalisationCacheRecache'][] = function ( $cache, $code, &$
 
 PHP;
 
-               $jsondir = str_replace('\\', '/', $jsondir );
+               $jsondir = str_replace( '\\', '/', $jsondir );
                $shim = str_replace( '{{OUT}}', $jsondir, $shim );
                return $shim;
        }