Raimond Spekking has submitted this change and it was merged.

Change subject: Migrate to JSON i18n
......................................................................


Migrate to JSON i18n

Procedure per https://www.mediawiki.org/wiki/Manual:GenerateJsonI18n.php
with shim.

Change-Id: I062ebbc8b6b81ec3811a3dea44edf5bd865895f9
---
M FeedsFromPrivateWikis.i18n.php
M FeedsFromPrivateWikis.php
A i18n/en.json
3 files changed, 35 insertions(+), 15 deletions(-)

Approvals:
  Raimond Spekking: Verified; Looks good to me, approved



diff --git a/FeedsFromPrivateWikis.i18n.php b/FeedsFromPrivateWikis.i18n.php
index 19e5bf5..eeb2776 100644
--- a/FeedsFromPrivateWikis.i18n.php
+++ b/FeedsFromPrivateWikis.i18n.php
@@ -1,20 +1,31 @@
 <?php
 /**
- * Internationalisation file for FeedsFromPrivateWikis extension.
+ * This is a backwards-compatibility shim, generated by:
+ * 
https://git.wikimedia.org/blob/mediawiki%2Fcore.git/HEAD/maintenance%2FgenerateJsonI18n.php
  *
- * @file
- * @ingroup Extensions
- * @author Raimond Spekking
- * @copyright © 2011 Raimond Spekking for Wikimedia Deutschland e.V.
- * @license GNU General Public Licence 2.0 or later
+ * 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'] );
+       foreach ( $codeSequence as $csCode ) {
+               $fileName = __DIR__ . "/i18n/$csCode.json";
+               if ( is_readable( $fileName ) ) {
+                       $data = FormatJson::decode( file_get_contents( 
$fileName ), true );
+                       foreach ( array_keys( $data ) as $key ) {
+                               if ( $key === '' || $key[0] === '@' ) {
+                                       unset( $data[$key] );
+                               }
+                       }
+                       $cachedData['messages'] = array_merge( $data, 
$cachedData['messages'] );
+               }
 
-/** English
- * @author Raimond Spekking
- */
-$messages['en'] = array(
-       'feedsfromprivatewikis-desc' => 'Adds possibilty to get feeds from 
private wikis',
-);
-
+               $cachedData['deps'][] = new FileDependency( $fileName );
+       }
+       return true;
+};
diff --git a/FeedsFromPrivateWikis.php b/FeedsFromPrivateWikis.php
index 857cc6d..eb80974 100644
--- a/FeedsFromPrivateWikis.php
+++ b/FeedsFromPrivateWikis.php
@@ -18,13 +18,14 @@
 $wgExtensionCredits['specialpage'][] = array(
        'path' => __FILE__,
        'name' => 'FeedsFromPrivateWikis',
-       'version' => '0.1',
+       'version' => '0.2.0',
        'author' => 'Raimond Spekking',
        'url' => 
'https://www.mediawiki.org/wiki/Extension:FeedsFromPrivateWikis',
        'descriptionmsg' => 'feedsfromprivatewikis-desc',
 );
 
 $dir = dirname( __FILE__ ) . '/';
+$wgMessagesDirs['FeedsFromPrivateWikis'] = __DIR__ . '/i18n';
 $wgExtensionMessagesFiles['FeedsFromPrivateWikis'] = $dir . 
'FeedsFromPrivateWikis.i18n.php';
 
 $wgAutoloadClasses['FeedsFromPrivateWikis'] = $dir . 
'FeedsFromPrivateWikis.hooks.php';
diff --git a/i18n/en.json b/i18n/en.json
new file mode 100644
index 0000000..b16d33d
--- /dev/null
+++ b/i18n/en.json
@@ -0,0 +1,8 @@
+{
+    "@metadata": {
+        "authors": [
+            "Raimond Spekking"
+        ]
+    },
+    "feedsfromprivatewikis-desc": "Adds possibilty to get feeds from private 
wikis"
+}

-- 
To view, visit https://gerrit.wikimedia.org/r/123565
To unsubscribe, visit https://gerrit.wikimedia.org/r/settings

Gerrit-MessageType: merged
Gerrit-Change-Id: I062ebbc8b6b81ec3811a3dea44edf5bd865895f9
Gerrit-PatchSet: 1
Gerrit-Project: mediawiki/extensions/FeedsFromPrivateWikis
Gerrit-Branch: master
Gerrit-Owner: Siebrand <[email protected]>
Gerrit-Reviewer: Raimond Spekking <[email protected]>

_______________________________________________
MediaWiki-commits mailing list
[email protected]
https://lists.wikimedia.org/mailman/listinfo/mediawiki-commits

Reply via email to