Raimond Spekking has uploaded a new change for review. https://gerrit.wikimedia.org/r/170297
Change subject: Convert i18n to JSON ...................................................................... Convert i18n to JSON Change-Id: Ib5fb7115622195a93f2d6084a4e1f6a2be2c04c0 --- M CollapsibleVector.i18n.php M CollapsibleVector.php A i18n/en.json A i18n/qqq.json 4 files changed, 57 insertions(+), 28 deletions(-) git pull ssh://gerrit.wikimedia.org:29418/mediawiki/extensions/CollapsibleVector refs/changes/97/170297/1 diff --git a/CollapsibleVector.i18n.php b/CollapsibleVector.i18n.php index 1183f50..5eb3bcd 100644 --- a/CollapsibleVector.i18n.php +++ b/CollapsibleVector.i18n.php @@ -1,34 +1,35 @@ <?php /** - * Internationalisation for Vector extension + * This is a backwards-compatibility shim, generated by: + * https://git.wikimedia.org/blob/mediawiki%2Fcore.git/HEAD/maintenance%2FgenerateJsonI18n.php * - * @file - * @ingroup Extensions + * 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(); +if ( !function_exists( 'wfJsonI18nShim838dd91d281628a2' ) ) { + function wfJsonI18nShim838dd91d281628a2( $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'] ); + } -/** English - * @author Trevor Parscal - */ -$messages['en'] = array( - 'vector' => 'UI improvements for Vector', - 'collapsiblevector-desc' => 'Enhances the user interface when using the Vector skin', - 'vector-collapsiblenav-preference' => 'Enable collapsing of items in the sidebar in Vector skin', - 'vector-collapsiblenav-more' => 'More languages', - 'vector-noexperiments-preference' => 'Exclude me from feature experiments', -); + $cachedData['deps'][] = new FileDependency( $fileName ); + } + return true; + } -/** Message documentation (Message documentation) - * @author Fryed-peach - * @author Lloffiwr - * @author Nemo bis - * @author Shirayuki - * @author Srtxg - * @author Umherirrender - */ -$messages['qqq'] = array( - 'vector' => 'UI means User Interface. Vector is the name of an interface skin.', - 'collapsiblevector-desc' => '{{desc|name=CollapsibleVector|url=http://www.mediawiki.org/wiki/Extension:CollapsibleVector}}', - 'vector-collapsiblenav-preference' => 'The message refers to the sidebar, whose sections are collapsible in Vector skin (some of them collapsed by default and some no); the preference disables collapsing entirely and is among "Advanced options" in the "Appearence" section.', -); + $GLOBALS['wgHooks']['LocalisationCacheRecache'][] = 'wfJsonI18nShim838dd91d281628a2'; +} diff --git a/CollapsibleVector.php b/CollapsibleVector.php index da95a8c..f1c87ff 100644 --- a/CollapsibleVector.php +++ b/CollapsibleVector.php @@ -35,12 +35,13 @@ 'path' => __FILE__, 'name' => 'CollapsibleVector', 'author' => array( 'paladox' ), - 'version' => '0.1.0', + 'version' => '0.1.1', 'url' => 'https://www.mediawiki.org/wiki/Extension:CollapsibleVector', 'descriptionmsg' => 'collapsiblevector-desc', ); $wgAutoloadClasses['VectorHooks'] = dirname( __FILE__ ) . '/CollapsibleVector.hooks.php'; $wgExtensionMessagesFiles['CollapsibleVector'] = dirname( __FILE__ ) . '/CollapsibleVector.i18n.php'; +$wgMessagesDirs['CollapsibleVector'] = __DIR__ . '/i18n'; $wgHooks['BeforePageDisplay'][] = 'VectorHooks::beforePageDisplay'; $wgHooks['GetPreferences'][] = 'VectorHooks::getPreferences'; $wgHooks['ResourceLoaderGetConfigVars'][] = 'VectorHooks::resourceLoaderGetConfigVars'; diff --git a/i18n/en.json b/i18n/en.json new file mode 100644 index 0000000..7b69a64 --- /dev/null +++ b/i18n/en.json @@ -0,0 +1,12 @@ +{ + "@metadata": { + "authors": [ + "Trevor Parscal" + ] + }, + "vector": "UI improvements for Vector", + "collapsiblevector-desc": "Enhances the user interface when using the Vector skin", + "vector-collapsiblenav-preference": "Enable collapsing of items in the sidebar in Vector skin", + "vector-collapsiblenav-more": "More languages", + "vector-noexperiments-preference": "Exclude me from feature experiments" +} diff --git a/i18n/qqq.json b/i18n/qqq.json new file mode 100644 index 0000000..597dd39 --- /dev/null +++ b/i18n/qqq.json @@ -0,0 +1,15 @@ +{ + "@metadata": { + "authors": [ + "Fryed-peach", + "Lloffiwr", + "Nemo bis", + "Shirayuki", + "Srtxg", + "Umherirrender" + ] + }, + "vector": "UI means User Interface. Vector is the name of an interface skin.", + "collapsiblevector-desc": "{{desc|name=CollapsibleVector|url=http://www.mediawiki.org/wiki/Extension:CollapsibleVector}}", + "vector-collapsiblenav-preference": "The message refers to the sidebar, whose sections are collapsible in Vector skin (some of them collapsed by default and some no); the preference disables collapsing entirely and is among \"Advanced options\" in the \"Appearence\" section." +} -- To view, visit https://gerrit.wikimedia.org/r/170297 To unsubscribe, visit https://gerrit.wikimedia.org/r/settings Gerrit-MessageType: newchange Gerrit-Change-Id: Ib5fb7115622195a93f2d6084a4e1f6a2be2c04c0 Gerrit-PatchSet: 1 Gerrit-Project: mediawiki/extensions/CollapsibleVector Gerrit-Branch: master Gerrit-Owner: Raimond Spekking <[email protected]> _______________________________________________ MediaWiki-commits mailing list [email protected] https://lists.wikimedia.org/mailman/listinfo/mediawiki-commits
