[MediaWiki-commits] [Gerrit] Migrate to JSON i18n - change (mediawiki...DisqusTag)
Siebrand has uploaded a new change for review. https://gerrit.wikimedia.org/r/122319 Change subject: Migrate to JSON i18n .. Migrate to JSON i18n Procedure per https://www.mediawiki.org/wiki/Manual:GenerateJsonI18n.php with shim. Change-Id: If04e51b977be30ad51e9e76683d48919d31f9d1b --- M DisqusTag.i18n.php M DisqusTag.php A i18n/ast.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/hsb.json A i18n/ia.json A i18n/it.json A i18n/ja.json A i18n/ko.json A i18n/lv.json A i18n/mk.json A i18n/nl.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/sl.json A i18n/sv.json A i18n/uk.json A i18n/zh-hans.json 28 files changed, 237 insertions(+), 188 deletions(-) git pull ssh://gerrit.wikimedia.org:29418/mediawiki/extensions/DisqusTag refs/changes/19/122319/1 diff --git a/DisqusTag.i18n.php b/DisqusTag.i18n.php index aa1f117..eeb2776 100644 --- a/DisqusTag.i18n.php +++ b/DisqusTag.i18n.php @@ -1,192 +1,31 @@ ?php /** - * Internationalisation for DisqusTag 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(); +$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 Luis Felipe Schenone - */ -$messages['en'] = array( - 'disqustag-desc' = 'Adds codelt;disqusgt;/code tag to insert an inline link that pop up [http://disqus.com Disqus] discussions', -); - -/** Message documentation (Message documentation) - * @author Luis Felipe Schenone - */ -$messages['qqq'] = array( - 'disqustag-desc' = '{{desc|name=DisqusTag|url=https://www.mediawiki.org/wiki/Extension:DisqusTag}}', -); - -/** Asturian (asturianu) - * @author Xuacu - */ -$messages['ast'] = array( - 'disqustag-desc' = Amiesta la etiqueta codelt;disqusgt;/code pa inxertar un enllaz en llinia qu'abre una ventana con alderiques de [http://disqus.com Disqus], -); - -/** German (Deutsch) - * @author Metalhead64 - */ -$messages['de'] = array( - 'disqustag-desc' = 'Ergänzt das codelt;disqusgt;/code-Tag zum Einfügen eines Links in Zeilen, das [http://disqus.com Disqus]-Diskussionen erscheinen lässt', -); - -/** Spanish (español) - * @author Fitoschido - * @author Luis Felipe Schenone - */ -$messages['es'] = array( - 'disqustag-desc' = 'Añade la etiqueta codelt;disqusgt;/code que permite insertar enlaces que abren secciones de comentarios de [http://disqus.com Disqus]', -); - -/** Persian (فارسی) - * @author Dalba - */ -$messages['fa'] = array( - 'disqustag-desc' = 'تگ codelt;disqusgt;/code را برای درج پیوند درونیای که یک گفتگوی [http://disqus.com دیسکاس] را بالا میپرانند میافزاید.', -); - -/** French (français) - * @author Gomoko - */ -$messages['fr'] = array( - 'disqustag-desc' = 'Ajoute la balise codelt;disqusgt;/code pour insérer un lien en ligne qui fait surgir les discussions [http://disqus.com Disqus]', -); - -/** Galician (galego) - * @author Toliño - */ -$messages['gl'] = array( - 'disqustag-desc' = 'Engade a etiqueta codelt;disqusgt;/code para inserir unha ligazón en liña que abre ventás emerxentes con conversas de [http://disqus.com Disqus]', -); - -/** Hebrew (עברית) - * @author Yona b - */ -$messages['he'] = array( - 'disqustag-desc' = 'מוסיף תג codelt;disqusgt;/code כדי להוסיף קישור לחלון קופץ לשיחות [http://disqus.com Disqus]', -); - -/** Upper Sorbian (hornjoserbsce) - * @author Michawiki - */ -$messages['hsb'] = array( - 'disqustag-desc' = 'Přidawa element codelt;disqusgt;/code za zasadźenje wotkaza do linkow, kotryž [http://disqus.com Disqus]-diskusije zwobraznja',
[MediaWiki-commits] [Gerrit] Migrate to JSON i18n - change (mediawiki...DisqusTag)
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: If04e51b977be30ad51e9e76683d48919d31f9d1b --- M DisqusTag.i18n.php M DisqusTag.php A i18n/ast.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/hsb.json A i18n/ia.json A i18n/it.json A i18n/ja.json A i18n/ko.json A i18n/lv.json A i18n/mk.json A i18n/nl.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/sl.json A i18n/sv.json A i18n/uk.json A i18n/zh-hans.json 28 files changed, 237 insertions(+), 188 deletions(-) Approvals: Siebrand: Verified Raimond Spekking: Looks good to me, approved diff --git a/DisqusTag.i18n.php b/DisqusTag.i18n.php index aa1f117..eeb2776 100644 --- a/DisqusTag.i18n.php +++ b/DisqusTag.i18n.php @@ -1,192 +1,31 @@ ?php /** - * Internationalisation for DisqusTag 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(); +$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 Luis Felipe Schenone - */ -$messages['en'] = array( - 'disqustag-desc' = 'Adds codelt;disqusgt;/code tag to insert an inline link that pop up [http://disqus.com Disqus] discussions', -); - -/** Message documentation (Message documentation) - * @author Luis Felipe Schenone - */ -$messages['qqq'] = array( - 'disqustag-desc' = '{{desc|name=DisqusTag|url=https://www.mediawiki.org/wiki/Extension:DisqusTag}}', -); - -/** Asturian (asturianu) - * @author Xuacu - */ -$messages['ast'] = array( - 'disqustag-desc' = Amiesta la etiqueta codelt;disqusgt;/code pa inxertar un enllaz en llinia qu'abre una ventana con alderiques de [http://disqus.com Disqus], -); - -/** German (Deutsch) - * @author Metalhead64 - */ -$messages['de'] = array( - 'disqustag-desc' = 'Ergänzt das codelt;disqusgt;/code-Tag zum Einfügen eines Links in Zeilen, das [http://disqus.com Disqus]-Diskussionen erscheinen lässt', -); - -/** Spanish (español) - * @author Fitoschido - * @author Luis Felipe Schenone - */ -$messages['es'] = array( - 'disqustag-desc' = 'Añade la etiqueta codelt;disqusgt;/code que permite insertar enlaces que abren secciones de comentarios de [http://disqus.com Disqus]', -); - -/** Persian (فارسی) - * @author Dalba - */ -$messages['fa'] = array( - 'disqustag-desc' = 'تگ codelt;disqusgt;/code را برای درج پیوند درونیای که یک گفتگوی [http://disqus.com دیسکاس] را بالا میپرانند میافزاید.', -); - -/** French (français) - * @author Gomoko - */ -$messages['fr'] = array( - 'disqustag-desc' = 'Ajoute la balise codelt;disqusgt;/code pour insérer un lien en ligne qui fait surgir les discussions [http://disqus.com Disqus]', -); - -/** Galician (galego) - * @author Toliño - */ -$messages['gl'] = array( - 'disqustag-desc' = 'Engade a etiqueta codelt;disqusgt;/code para inserir unha ligazón en liña que abre ventás emerxentes con conversas de [http://disqus.com Disqus]', -); - -/** Hebrew (עברית) - * @author Yona b - */ -$messages['he'] = array( - 'disqustag-desc' = 'מוסיף תג codelt;disqusgt;/code כדי להוסיף קישור לחלון קופץ לשיחות [http://disqus.com Disqus]', -); - -/** Upper Sorbian (hornjoserbsce) - * @author Michawiki - */ -$messages['hsb'] = array( - 'disqustag-desc' = 'Přidawa element codelt;disqusgt;/code za zasadźenje wotkaza do linkow, kotryž [http://disqus.com Disqus]-diskusije zwobraznja', -); - -/** Interlingua (interlingua) - * @author