Siebrand has uploaded a new change for review. https://gerrit.wikimedia.org/r/123588
Change subject: Migrate to JSON i18n ...................................................................... Migrate to JSON i18n Procedure per https://www.mediawiki.org/wiki/Manual:GenerateJsonI18n.php with shim. Change-Id: I0651aee45de35291f1d48f725a7dffd564c10f17 --- M QuizTabulate.i18n.php M QuizTabulate.php A i18n/en.json 3 files changed, 37 insertions(+), 14 deletions(-) git pull ssh://gerrit.wikimedia.org:29418/mediawiki/extensions/QuizTabulate refs/changes/88/123588/1 diff --git a/QuizTabulate.i18n.php b/QuizTabulate.i18n.php index 5c4ef11..eeb2776 100644 --- a/QuizTabulate.i18n.php +++ b/QuizTabulate.i18n.php @@ -1,16 +1,31 @@ <?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. */ +$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'] ); + } -$messages['en'] = array( - 'quiz-tabulate-description' => 'Tabulates results of the quiz extension', - 'editnotice-' . $GLOBALS['wgQuizNamespace'] => "'''Warning:''' Editing this page will reset this quiz's tabulation statistics. The previous statistics will still be available in the page history.", - 'quiz-tabulate-results' => 'Quiz results' -); - -$magicWords = array(); - -$magicWords['en'] = array( - 'quiztabulate' => array( 0, 'quiztabulate' ), -); + $cachedData['deps'][] = new FileDependency( $fileName ); + } + return true; +}; diff --git a/QuizTabulate.php b/QuizTabulate.php index ed9d1db..38294ba 100644 --- a/QuizTabulate.php +++ b/QuizTabulate.php @@ -7,7 +7,6 @@ * * @file * @ingroup Extensions - * @version 1.1.0 * @author Ike Hecht for [http://www.wikiworks.com/ WikiWorks] * @link http://www.mediawiki.org/wiki/Extension:QuizTabulate Documentation */ @@ -23,7 +22,7 @@ 'path' => __FILE__, 'name' => 'QuizTabulate', 'descriptionmsg' => 'quiz-tabulate-description', - 'version' => '1.1.0', #corresponds to Quiz version it was based on and tested with + 'version' => '1.1.0.1', #corresponds to Quiz version it was based on and tested with 'author' => 'Ike Hecht for [http://www.wikiworks.com/ WikiWorks]', 'url' => 'http://www.mediawiki.org/wiki/Extension:QuizTabulate', ); @@ -31,6 +30,7 @@ $wgAutoloadClasses['QuizTabulate'] = __DIR__ . '/QuizTabulate.class.php'; $wgAutoloadClasses['QuestionTabulate'] = __DIR__ . '/QuizTabulate.class.php'; $wgAutoloadClasses['QuizTabulateHooks'] = __DIR__ . '/QuizTabulate.hooks.php'; +$wgMessagesDirs['QuizTabulate'] = __DIR__ . '/i18n'; $wgExtensionMessagesFiles['QuizTabulate'] = __DIR__ . '/QuizTabulate.i18n.php'; $wgHooks['LoadExtensionSchemaUpdates'][] = 'QuizTabulateHooks::quizTabulateSchemaUpdate'; diff --git a/i18n/en.json b/i18n/en.json new file mode 100644 index 0000000..0dcd9ff --- /dev/null +++ b/i18n/en.json @@ -0,0 +1,8 @@ +{ + "@metadata": { + "authors": [] + }, + "quiz-tabulate-description": "Tabulates results of the quiz extension", + "editnotice-": "'''Warning:''' Editing this page will reset this quiz's tabulation statistics. The previous statistics will still be available in the page history.", + "quiz-tabulate-results": "Quiz results" +} -- To view, visit https://gerrit.wikimedia.org/r/123588 To unsubscribe, visit https://gerrit.wikimedia.org/r/settings Gerrit-MessageType: newchange Gerrit-Change-Id: I0651aee45de35291f1d48f725a7dffd564c10f17 Gerrit-PatchSet: 1 Gerrit-Project: mediawiki/extensions/QuizTabulate Gerrit-Branch: master Gerrit-Owner: Siebrand <[email protected]> _______________________________________________ MediaWiki-commits mailing list [email protected] https://lists.wikimedia.org/mailman/listinfo/mediawiki-commits
