[MediaWiki-commits] [Gerrit] Migrate to JSON i18n - change (mediawiki...Bootstrap)
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: I238d8098451a4a96da6d77daa3794ec83b2e938d --- M Bootstrap.i18n.php M Bootstrap.php A i18n/ast.json A i18n/bcl.json A i18n/be-tarask.json A i18n/ca.json A i18n/de.json A i18n/dsb.json A i18n/en.json A i18n/es.json A i18n/eu.json A i18n/fa.json A i18n/fr.json A i18n/gl.json A i18n/he.json A i18n/hsb.json A i18n/ia.json A i18n/it.json A i18n/ja.json A i18n/ko.json A i18n/ksh.json A i18n/mk.json A i18n/ms.json A i18n/nl.json A i18n/oc.json A i18n/pl.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/sco.json A i18n/sv.json A i18n/uk.json A i18n/zh-hans.json A i18n/zh-hant.json 36 files changed, 296 insertions(+), 239 deletions(-) Approvals: Siebrand: Verified Raimond Spekking: Looks good to me, approved diff --git a/Bootstrap.i18n.php b/Bootstrap.i18n.php index 122d2b7..eeb2776 100644 --- a/Bootstrap.i18n.php +++ b/Bootstrap.i18n.php @@ -1,244 +1,31 @@ ?php /** - * Internationalisation file for extension Bootstrap. + * This is a backwards-compatibility shim, generated by: + * https://git.wikimedia.org/blob/mediawiki%2Fcore.git/HEAD/maintenance%2FgenerateJsonI18n.php * - * @file - * @ingroup Bootstrap + * 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( - 'bootstrap-desc' = 'Provides the [http://getbootstrap.com/ Bootstrap] framework in the wiki', -); - -/** Message documentation (Message documentation) - */ -$messages['qqq'] = array( - 'bootstrap-desc' = '{{desc|name=Bootstrap|url=http://www.mediawiki.org/wiki/Extension:Bootstrap}}', -); - -/** Asturian (asturianu) - * @author Xuacu - */ -$messages['ast'] = array( - 'bootstrap-desc' = 'Proporciona la estructura [http://getbootstrap.com/ Bootstrap] na wiki.', -); - -/** Bikol Central (Bikol Central) - * @author Geopoet - */ -$messages['bcl'] = array( - 'bootstrap-desc' = 'Minatao sa [http://getbootstrap.com/ Estrapa-na-pambotas] premang gibo sa laog nin wiki', -); - -/** Belarusian (Taraškievica orthography) (беларуская (тарашкевіца)) - * @author Wizardist - */ -$messages['be-tarask'] = array( - 'bootstrap-desc' = 'Падтрымка фрэймворку [http://getbootstrap.com/ Bootstrap].', -); - -/** Catalan (català) - * @author Alvaro Vidal-Abarca - */ -$messages['ca'] = array( - 'bootstrap-desc' = Proporciona l'entorn de desenvolupament [http://getbootstrap.com/ Bootstrap] a la viqui, -); - -/** German (Deutsch) - * @author Metalhead64 - */ -$messages['de'] = array( - 'bootstrap-desc' = 'Erweitert das Wiki um das [http://getbootstrap.com/ Bootstrap]-Framework', -); - -/** Lower Sorbian (dolnoserbski) - * @author Michawiki - */ -$messages['dsb'] = array( - 'bootstrap-desc' = 'Stoj framework [http://getbootstrap.com/ Bootstrap] we wikiju k dispoziciji.', -); - -/** Spanish (español) - * @author VegaDark - */ -$messages['es'] = array( - 'bootstrap-desc' = 'Proporciona la estructura [http://getbootstrap.com/ Bootstrap] en el wiki.', -); - -/** Basque (euskara) - * @author Theklan - */ -$messages['eu'] = array( - 'bootstrap-desc' = '[http://getbootstrap.com/ Bootstrap] tresna sartzen du wikian.', -); - -/** Persian (فارسی) - * @author Ebraminio - * @author Reza1615 - */ -$messages['fa'] = array( - 'bootstrap-desc' = 'چارچوب [http://getbootstrap.com/ بوتاسترپ] را در ویکی فراهم میکند.', -); - -/** French (français) - * @author Gomoko - */ -$messages['fr'] = array( - 'bootstrap-desc' = 'Fournit l’environnement de travail [http://getbootstrap.com/ Bootstrap] dans le wiki.', -); - -/**
[MediaWiki-commits] [Gerrit] Migrate to JSON i18n - change (mediawiki...Bootstrap)
Siebrand has uploaded a new change for review. https://gerrit.wikimedia.org/r/122258 Change subject: Migrate to JSON i18n .. Migrate to JSON i18n Procedure per https://www.mediawiki.org/wiki/Manual:GenerateJsonI18n.php with shim. Change-Id: I238d8098451a4a96da6d77daa3794ec83b2e938d --- M Bootstrap.i18n.php M Bootstrap.php A i18n/ast.json A i18n/bcl.json A i18n/be-tarask.json A i18n/ca.json A i18n/de.json A i18n/dsb.json A i18n/en.json A i18n/es.json A i18n/eu.json A i18n/fa.json A i18n/fr.json A i18n/gl.json A i18n/he.json A i18n/hsb.json A i18n/ia.json A i18n/it.json A i18n/ja.json A i18n/ko.json A i18n/ksh.json A i18n/mk.json A i18n/ms.json A i18n/nl.json A i18n/oc.json A i18n/pl.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/sco.json A i18n/sv.json A i18n/uk.json A i18n/zh-hans.json A i18n/zh-hant.json 36 files changed, 295 insertions(+), 238 deletions(-) git pull ssh://gerrit.wikimedia.org:29418/mediawiki/extensions/Bootstrap refs/changes/58/122258/1 diff --git a/Bootstrap.i18n.php b/Bootstrap.i18n.php index 122d2b7..eeb2776 100644 --- a/Bootstrap.i18n.php +++ b/Bootstrap.i18n.php @@ -1,244 +1,31 @@ ?php /** - * Internationalisation file for extension Bootstrap. + * This is a backwards-compatibility shim, generated by: + * https://git.wikimedia.org/blob/mediawiki%2Fcore.git/HEAD/maintenance%2FgenerateJsonI18n.php * - * @file - * @ingroup Bootstrap + * 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( - 'bootstrap-desc' = 'Provides the [http://getbootstrap.com/ Bootstrap] framework in the wiki', -); - -/** Message documentation (Message documentation) - */ -$messages['qqq'] = array( - 'bootstrap-desc' = '{{desc|name=Bootstrap|url=http://www.mediawiki.org/wiki/Extension:Bootstrap}}', -); - -/** Asturian (asturianu) - * @author Xuacu - */ -$messages['ast'] = array( - 'bootstrap-desc' = 'Proporciona la estructura [http://getbootstrap.com/ Bootstrap] na wiki.', -); - -/** Bikol Central (Bikol Central) - * @author Geopoet - */ -$messages['bcl'] = array( - 'bootstrap-desc' = 'Minatao sa [http://getbootstrap.com/ Estrapa-na-pambotas] premang gibo sa laog nin wiki', -); - -/** Belarusian (Taraškievica orthography) (беларуская (тарашкевіца)) - * @author Wizardist - */ -$messages['be-tarask'] = array( - 'bootstrap-desc' = 'Падтрымка фрэймворку [http://getbootstrap.com/ Bootstrap].', -); - -/** Catalan (català) - * @author Alvaro Vidal-Abarca - */ -$messages['ca'] = array( - 'bootstrap-desc' = Proporciona l'entorn de desenvolupament [http://getbootstrap.com/ Bootstrap] a la viqui, -); - -/** German (Deutsch) - * @author Metalhead64 - */ -$messages['de'] = array( - 'bootstrap-desc' = 'Erweitert das Wiki um das [http://getbootstrap.com/ Bootstrap]-Framework', -); - -/** Lower Sorbian (dolnoserbski) - * @author Michawiki - */ -$messages['dsb'] = array( - 'bootstrap-desc' = 'Stoj framework [http://getbootstrap.com/ Bootstrap] we wikiju k dispoziciji.', -); - -/** Spanish (español) - * @author VegaDark - */ -$messages['es'] = array( - 'bootstrap-desc' = 'Proporciona la estructura [http://getbootstrap.com/ Bootstrap] en el wiki.', -); - -/** Basque (euskara) - * @author Theklan - */ -$messages['eu'] = array( - 'bootstrap-desc' = '[http://getbootstrap.com/ Bootstrap] tresna sartzen du wikian.', -); - -/** Persian (فارسی) - * @author Ebraminio - * @author Reza1615 - */ -$messages['fa'] = array( - 'bootstrap-desc' = 'چارچوب [http://getbootstrap.com/ بوتاسترپ] را در ویکی فراهم میکند.', -); - -/** French (français) - * @author Gomoko - */ -$messages['fr'] = array( - 'bootstrap-desc' = 'Fournit l’environnement de travail