Raimond Spekking has uploaded a new change for review.

  https://gerrit.wikimedia.org/r/159107

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

Change i18n to JSON

Move magic definiton into its own file
Use array for authors in extension credit

Change-Id: I9b2f00904bc1e4491c98eae893717a90f5cf393d
---
A SacredText.i18n.magic.php
M SacredText.i18n.php
M SacredText.php
A i18n/en.json
4 files changed, 58 insertions(+), 17 deletions(-)


  git pull ssh://gerrit.wikimedia.org:29418/mediawiki/extensions/SacredText 
refs/changes/07/159107/1

diff --git a/SacredText.i18n.magic.php b/SacredText.i18n.magic.php
new file mode 100644
index 0000000..0288321
--- /dev/null
+++ b/SacredText.i18n.magic.php
@@ -0,0 +1,15 @@
+<?php
+/**
+ * Internationalisation file for extension SacredText.
+ *
+ * @file
+ * @ingroup Extensions
+ */
+
+$magicWords = array();
+
+/** English (English) */
+$magicWords['en'] = array(
+       'bible' => array( 0, 'bible' ),
+       'sacredtext' => array( 0, 'sacredtext' ),
+);
\ No newline at end of file
diff --git a/SacredText.i18n.php b/SacredText.i18n.php
index b1a87d4..3f196ba 100644
--- a/SacredText.i18n.php
+++ b/SacredText.i18n.php
@@ -1,16 +1,35 @@
 <?php
 /**
- * Internationalization file.
+ * 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.
  */
- 
-$magicWords = array();
 $messages = array();
- 
-$magicWords['en'] = array(
-   'bible' => array( 0, 'bible' ),
-   'sacredtext' => array( 0, 'sacredtext' ),
-);
- 
-$messages['en'] = array(
-        'sacredtext-desc' => "Makes it easy to quote religious scriptures",
-);
+if ( !function_exists( 'wfJsonI18nShimd0145ea562fabd73' ) ) {
+       function wfJsonI18nShimd0145ea562fabd73( $cache, $code, &$cachedData ) {
+               $codeSequence = array_merge( array( $code ), 
$cachedData['fallbackSequence'] );
+               foreach ( $codeSequence as $csCode ) {
+                       $fileName = dirname( __FILE__ ) . "/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'] );
+                       }
+
+                       $cachedData['deps'][] = new FileDependency( $fileName );
+               }
+               return true;
+       }
+
+       $GLOBALS['wgHooks']['LocalisationCacheRecache'][] = 
'wfJsonI18nShimd0145ea562fabd73';
+}
diff --git a/SacredText.php b/SacredText.php
index f118975..f6ce109 100644
--- a/SacredText.php
+++ b/SacredText.php
@@ -40,12 +40,11 @@
 $wgExtensionCredits['parserhook'][] = array(
        'path' => __FILE__,
        'name' => 'SacredText',
-       'author' => '[https://www.mediawiki.org/wiki/User:JonathanWilliford 
Jonathan Williford], '
-               . '[https://www.mediawiki.org/wiki/User:Leucosticte 
Leucosticte]',
-       'description' => 'Makes it easy to quote religious scriptures',
+       'author' => array( 
'[https://www.mediawiki.org/wiki/User:JonathanWilliford Jonathan Williford]',
+               '[https://www.mediawiki.org/wiki/User:Leucosticte Leucosticte]' 
),
        'descriptionmsg' => 'sacredtext-desc',
        'url' => 'https://www.mediawiki.org/wiki/Extension:SacredText',
-       'version' => '0.0.2',
+       'version' => '0.0.3',
 );
  
 $dir = dirname(__FILE__) . '/';
@@ -147,7 +146,9 @@
 $wgHooks['ParserFirstCallInit'][] = 'efSacredTextParserInit';
 $wgHooks['LoadExtensionSchemaUpdates'][] = 'updateSacredTextDB';
 $wgExtensionMessagesFiles['SacredText'] = __DIR__ . '/SacredText.i18n.php';
- 
+$wgMessagesDirs['SacredText'] = __DIR__ . '/i18n';
+$wgExtensionMessagesFiles['SacredTextMagic'] = __DIR__ . 
'/SacredText.i18n.magic.php';
+
 function efSacredTextParserInit( $parser ) {
        global $wgSacredUseBibleTag;
        $parser->setHook( 'sacredtext', 'SacredTextLookup::hookSacredText' );
diff --git a/i18n/en.json b/i18n/en.json
new file mode 100644
index 0000000..77b25a0
--- /dev/null
+++ b/i18n/en.json
@@ -0,0 +1,6 @@
+{
+       "@metadata": {
+               "authors": []
+       },
+       "sacredtext-desc": "Makes it easy to quote religious scriptures"
+}

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

Gerrit-MessageType: newchange
Gerrit-Change-Id: I9b2f00904bc1e4491c98eae893717a90f5cf393d
Gerrit-PatchSet: 1
Gerrit-Project: mediawiki/extensions/SacredText
Gerrit-Branch: master
Gerrit-Owner: Raimond Spekking <[email protected]>

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

Reply via email to