[MediaWiki-commits] [Gerrit] Migrate to JSON i18n - change (mediawiki...CoreEvents)
Siebrand has uploaded a new change for review. https://gerrit.wikimedia.org/r/122304 Change subject: Migrate to JSON i18n .. Migrate to JSON i18n Procedure per https://www.mediawiki.org/wiki/Manual:GenerateJsonI18n.php with shim. Change-Id: I1dec0ff90518482a768fbe4e67ea729fcb62b109 --- M CoreEvents.i18n.php M CoreEvents.php A i18n/ast.json A i18n/bcl.json A i18n/be-tarask.json A i18n/cs.json A i18n/cy.json A i18n/da.json A i18n/de.json A i18n/en.json A i18n/es.json A i18n/fa.json A i18n/fr.json A i18n/gl.json A i18n/he.json A i18n/ia.json A i18n/ilo.json A i18n/it.json A i18n/ja.json A i18n/ko.json A i18n/ksh.json A i18n/lb.json A i18n/mk.json A i18n/ml.json A i18n/ms.json A i18n/nl.json A i18n/oc.json A i18n/pt-br.json A i18n/pt.json A i18n/qqq.json A i18n/roa-tara.json A i18n/ru.json A i18n/sv.json A i18n/uk.json A i18n/vi.json A i18n/zh-hans.json A i18n/zh-hant.json 37 files changed, 308 insertions(+), 250 deletions(-) git pull ssh://gerrit.wikimedia.org:29418/mediawiki/extensions/CoreEvents refs/changes/04/122304/1 diff --git a/CoreEvents.i18n.php b/CoreEvents.i18n.php index 287fb74..eeb2776 100644 --- a/CoreEvents.i18n.php +++ b/CoreEvents.i18n.php @@ -1,255 +1,31 @@ ?php /** - * Internationalisation for CoreEvents extension + * This is a backwards-compatibility shim, generated by: + * https://git.wikimedia.org/blob/mediawiki%2Fcore.git/HEAD/maintenance%2FgenerateJsonI18n.php * - * @license GPL v2 or later - * @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(); +$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 Matthew Flaschen - */ -$messages['en'] = array( - 'coreevents-desc' = 'Use EventLogging extension to log events that occur in core MediaWiki', -); - -/** Message documentation (Message documentation) - * @author Matthew Flaschen - * @author Shirayuki - */ -$messages['qqq'] = array( - 'coreevents-desc' = '{{desc|name=Core Events|url=http://www.mediawiki.org/wiki/Extension:CoreEvents}}', -); - -/** Asturian (asturianu) - * @author Xuacu - */ -$messages['ast'] = array( - 'coreevents-desc' = Use la estensión EventLogging pa rexistrar los socesos qu'ocurren nel nucleu de MediaWiki, -); - -/** Bikol Central (Bikol Central) - * @author Geopoet - */ -$messages['bcl'] = array( - 'coreevents-desc' = 'Gamiton an ekstensyon kan EventLogging tanganing itala an mga pangyayari na nangyari sa katahawan kan MediaWiki', -); - -/** Belarusian (Taraškievica orthography) (беларуская (тарашкевіца)) - * @author Wizardist - */ -$messages['be-tarask'] = array( - 'coreevents-desc' = 'Выкарыстаньне пашырэньня EventLogging для запісу падзеяў унутры ядра MediaWiki', -); - -/** Czech (česky) - * @author Mormegil - */ -$messages['cs'] = array( - 'coreevents-desc' = 'Používá rozšíření EventLogging k zaznamenávání událostí, které se staly v jádře MediaWiki', -); - -/** Welsh (Cymraeg) - * @author Lloffiwr - */ -$messages['cy'] = array( - 'coreevents-desc' = Defnyddio'r estyniad EventLogging i gofnodi digwyddiadau yng nghrombil MediaWiki ar lòg, -); - -/** Danish (dansk) - * @author Christian List - */ -$messages['da'] = array( - 'coreevents-desc' = 'Brug EventLogging udvidelsen til at logge hændelser, der sker i MediaWikis kerne', -); - -/** German (Deutsch) - * @author Metalhead64 - */ -$messages['de'] = array( - 'coreevents-desc' = 'Ermöglicht die Verwendung der Erweiterung EventLogging, um auftretende Ereignisse im MediaWiki-Kern zu protokollieren', -); - -/** Spanish (español) - * @author Luis Felipe Schenone - */ -$messages['es'] = array( - 'coreevents-desc' = 'Utiliza la extensión EventLogging para registrar eventos que ocurren en core MediaWiki', -); - -/** Persian (فارسی) - * @author Reza1615 - */ -$messages['fa'] = array(
[MediaWiki-commits] [Gerrit] Migrate to JSON i18n - change (mediawiki...CoreEvents)
Siebrand 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: I1dec0ff90518482a768fbe4e67ea729fcb62b109 --- M CoreEvents.i18n.php M CoreEvents.php A i18n/ast.json A i18n/bcl.json A i18n/be-tarask.json A i18n/cs.json A i18n/cy.json A i18n/da.json A i18n/de.json A i18n/en.json A i18n/es.json A i18n/fa.json A i18n/fr.json A i18n/gl.json A i18n/he.json A i18n/ia.json A i18n/ilo.json A i18n/it.json A i18n/ja.json A i18n/ko.json A i18n/ksh.json A i18n/lb.json A i18n/mk.json A i18n/ml.json A i18n/ms.json A i18n/nl.json A i18n/oc.json A i18n/pt-br.json A i18n/pt.json A i18n/qqq.json A i18n/roa-tara.json A i18n/ru.json A i18n/sv.json A i18n/uk.json A i18n/vi.json A i18n/zh-hans.json A i18n/zh-hant.json 37 files changed, 308 insertions(+), 250 deletions(-) Approvals: Siebrand: Verified Raimond Spekking: Looks good to me, approved diff --git a/CoreEvents.i18n.php b/CoreEvents.i18n.php index 287fb74..eeb2776 100644 --- a/CoreEvents.i18n.php +++ b/CoreEvents.i18n.php @@ -1,255 +1,31 @@ ?php /** - * Internationalisation for CoreEvents extension + * This is a backwards-compatibility shim, generated by: + * https://git.wikimedia.org/blob/mediawiki%2Fcore.git/HEAD/maintenance%2FgenerateJsonI18n.php * - * @license GPL v2 or later - * @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(); +$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 Matthew Flaschen - */ -$messages['en'] = array( - 'coreevents-desc' = 'Use EventLogging extension to log events that occur in core MediaWiki', -); - -/** Message documentation (Message documentation) - * @author Matthew Flaschen - * @author Shirayuki - */ -$messages['qqq'] = array( - 'coreevents-desc' = '{{desc|name=Core Events|url=http://www.mediawiki.org/wiki/Extension:CoreEvents}}', -); - -/** Asturian (asturianu) - * @author Xuacu - */ -$messages['ast'] = array( - 'coreevents-desc' = Use la estensión EventLogging pa rexistrar los socesos qu'ocurren nel nucleu de MediaWiki, -); - -/** Bikol Central (Bikol Central) - * @author Geopoet - */ -$messages['bcl'] = array( - 'coreevents-desc' = 'Gamiton an ekstensyon kan EventLogging tanganing itala an mga pangyayari na nangyari sa katahawan kan MediaWiki', -); - -/** Belarusian (Taraškievica orthography) (беларуская (тарашкевіца)) - * @author Wizardist - */ -$messages['be-tarask'] = array( - 'coreevents-desc' = 'Выкарыстаньне пашырэньня EventLogging для запісу падзеяў унутры ядра MediaWiki', -); - -/** Czech (česky) - * @author Mormegil - */ -$messages['cs'] = array( - 'coreevents-desc' = 'Používá rozšíření EventLogging k zaznamenávání událostí, které se staly v jádře MediaWiki', -); - -/** Welsh (Cymraeg) - * @author Lloffiwr - */ -$messages['cy'] = array( - 'coreevents-desc' = Defnyddio'r estyniad EventLogging i gofnodi digwyddiadau yng nghrombil MediaWiki ar lòg, -); - -/** Danish (dansk) - * @author Christian List - */ -$messages['da'] = array( - 'coreevents-desc' = 'Brug EventLogging udvidelsen til at logge hændelser, der sker i MediaWikis kerne', -); - -/** German (Deutsch) - * @author Metalhead64 - */ -$messages['de'] = array( - 'coreevents-desc' = 'Ermöglicht die Verwendung der Erweiterung EventLogging, um auftretende Ereignisse im MediaWiki-Kern zu protokollieren', -); - -/** Spanish (español) - * @author Luis Felipe Schenone - */ -$messages['es'] = array( - 'coreevents-desc' = 'Utiliza la extensión EventLogging para registrar eventos que ocurren en core MediaWiki', -); - -/** Persian (فارسی) - * @author Reza1615 - */ -$messages['fa'] = array( - 'coreevents-desc' = 'از افزونهٔ سیاههٔ