[MediaWiki-commits] [Gerrit] Migrate to JSON i18n - change (mediawiki...CopyToClipboard)
Siebrand has uploaded a new change for review. https://gerrit.wikimedia.org/r/122303 Change subject: Migrate to JSON i18n .. Migrate to JSON i18n Procedure per https://www.mediawiki.org/wiki/Manual:GenerateJsonI18n.php with shim. Change-Id: Ia4f26256fda53ad93bcb8f6b6870efdc1a1b0688 --- M CopyToClipboard.i18n.php M CopyToClipboard.php A i18n/ar.json A i18n/ast.json A i18n/be-tarask.json A i18n/cdo.json A i18n/de.json A i18n/dsb.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/ksh.json A i18n/lb.json A i18n/map-bms.json A i18n/mk.json A i18n/ms.json A i18n/nl.json A i18n/oc.json A i18n/pl.json A i18n/pms.json A i18n/pt-br.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/vi.json A i18n/zh-hans.json A i18n/zh-hant.json 38 files changed, 320 insertions(+), 263 deletions(-) git pull ssh://gerrit.wikimedia.org:29418/mediawiki/extensions/CopyToClipboard refs/changes/03/122303/1 diff --git a/CopyToClipboard.i18n.php b/CopyToClipboard.i18n.php index 13ba1f8..eeb2776 100644 --- a/CopyToClipboard.i18n.php +++ b/CopyToClipboard.i18n.php @@ -1,267 +1,31 @@ https://git.wikimedia.org/blob/mediawiki%2Fcore.git/HEAD/maintenance%2FgenerateJsonI18n.php * - * @file - * @ingroup Language - * @ingroup I18n + * 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 Nischay Nahata - */ -$messages['en'] = array( - 'copytoclipboard-desc' => 'Adds a tag to show a "copy to clipboard" button on pages', -); - -/** Message documentation (Message documentation) - * @author Shirayuki - */ -$messages['qqq'] = array( - 'copytoclipboard-desc' => '{{desc|name=Copy To Clipboard|url=http://www.mediawiki.org/wiki/Extension:CopyToClipboard}}', -); - -/** Arabic (العربية) - * @author Mido - */ -$messages['ar'] = array( - 'copytoclipboard-desc' => 'يضيف وسم لعرض زر "انسخ إلى الحافظة" على الصفحات', -); - -/** Asturian (asturianu) - * @author Xuacu - */ -$messages['ast'] = array( - 'copytoclipboard-desc' => "Amiesta una etiqueta p'amosar un botón «copiar nel cartafueyu» nes páxines", -); - -/** Belarusian (Taraškievica orthography) (беларуская (тарашкевіца)) - * @author Wizardist - */ -$messages['be-tarask'] = array( - 'copytoclipboard-desc' => 'Дадае тэг для адлюстраваньня на старонках кнопкі «скапіяваць у буфэр абмену»', -); - -/** Min Dong Chinese (Mìng-dĕ̤ng-ngṳ̄) - * @author Yejianfei - */ -$messages['cdo'] = array( - 'copytoclipboard-desc' => '添加蜀萆標籤讓伊敆頁面𡅏顯示「複製遘剪貼版」其按鈕', -); - -/** German (Deutsch) - * @author Metalhead64 - */ -$messages['de'] = array( - 'copytoclipboard-desc' => 'Ergänzt ein Tag zur Anzeige einer Schaltfläche „In die Zwischenablage kopieren“ auf Seiten', -); - -/** Lower Sorbian (dolnoserbski) - * @author Michawiki - */ -$messages['dsb'] = array( - 'copytoclipboard-desc' => 'Pśidawa marku, aby tłocašk "do mjazyskłada kopěrowaś" na bokach pokazał', -); - -/** Spanish (español) - * @author Fitoschido - * @author Vivaelcelta - */ -$messages['es'] = array( - 'copytoclipboard-desc' => 'Añade una etiqueta para mostrar el botón «copiar al portapapeles» en las páginas', -); - -/** Persian (فارسی) - * @author Reza1615 - */ -$messages['fa'] = array( - 'copytoclipboard-desc' => 'افزودن یک برچسب برای نمایش دکمهٔ "کپی در حافظهٔ موقت" در صفحهها', -); - -/** French (français) - * @author Seb35 - */ -$messages['fr'] = array( - 'copytoclipboard-desc' => 'Ajoute un tag pour montrer un bouton "copier vers le presse-papier" sur les pages', -); - -/** Galician (galego) - * @author Toliño - */ -$messages['gl'] = array( - 'copyto
[MediaWiki-commits] [Gerrit] Migrate to JSON i18n - change (mediawiki...CopyToClipboard)
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: Ia4f26256fda53ad93bcb8f6b6870efdc1a1b0688 --- M CopyToClipboard.i18n.php M CopyToClipboard.php A i18n/ar.json A i18n/ast.json A i18n/be-tarask.json A i18n/cdo.json A i18n/de.json A i18n/dsb.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/ksh.json A i18n/lb.json A i18n/map-bms.json A i18n/mk.json A i18n/ms.json A i18n/nl.json A i18n/oc.json A i18n/pl.json A i18n/pms.json A i18n/pt-br.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/vi.json A i18n/zh-hans.json A i18n/zh-hant.json 38 files changed, 320 insertions(+), 263 deletions(-) Approvals: Siebrand: Verified Raimond Spekking: Looks good to me, approved diff --git a/CopyToClipboard.i18n.php b/CopyToClipboard.i18n.php index 13ba1f8..eeb2776 100644 --- a/CopyToClipboard.i18n.php +++ b/CopyToClipboard.i18n.php @@ -1,267 +1,31 @@ https://git.wikimedia.org/blob/mediawiki%2Fcore.git/HEAD/maintenance%2FgenerateJsonI18n.php * - * @file - * @ingroup Language - * @ingroup I18n + * 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 Nischay Nahata - */ -$messages['en'] = array( - 'copytoclipboard-desc' => 'Adds a tag to show a "copy to clipboard" button on pages', -); - -/** Message documentation (Message documentation) - * @author Shirayuki - */ -$messages['qqq'] = array( - 'copytoclipboard-desc' => '{{desc|name=Copy To Clipboard|url=http://www.mediawiki.org/wiki/Extension:CopyToClipboard}}', -); - -/** Arabic (العربية) - * @author Mido - */ -$messages['ar'] = array( - 'copytoclipboard-desc' => 'يضيف وسم لعرض زر "انسخ إلى الحافظة" على الصفحات', -); - -/** Asturian (asturianu) - * @author Xuacu - */ -$messages['ast'] = array( - 'copytoclipboard-desc' => "Amiesta una etiqueta p'amosar un botón «copiar nel cartafueyu» nes páxines", -); - -/** Belarusian (Taraškievica orthography) (беларуская (тарашкевіца)) - * @author Wizardist - */ -$messages['be-tarask'] = array( - 'copytoclipboard-desc' => 'Дадае тэг для адлюстраваньня на старонках кнопкі «скапіяваць у буфэр абмену»', -); - -/** Min Dong Chinese (Mìng-dĕ̤ng-ngṳ̄) - * @author Yejianfei - */ -$messages['cdo'] = array( - 'copytoclipboard-desc' => '添加蜀萆標籤讓伊敆頁面𡅏顯示「複製遘剪貼版」其按鈕', -); - -/** German (Deutsch) - * @author Metalhead64 - */ -$messages['de'] = array( - 'copytoclipboard-desc' => 'Ergänzt ein Tag zur Anzeige einer Schaltfläche „In die Zwischenablage kopieren“ auf Seiten', -); - -/** Lower Sorbian (dolnoserbski) - * @author Michawiki - */ -$messages['dsb'] = array( - 'copytoclipboard-desc' => 'Pśidawa marku, aby tłocašk "do mjazyskłada kopěrowaś" na bokach pokazał', -); - -/** Spanish (español) - * @author Fitoschido - * @author Vivaelcelta - */ -$messages['es'] = array( - 'copytoclipboard-desc' => 'Añade una etiqueta para mostrar el botón «copiar al portapapeles» en las páginas', -); - -/** Persian (فارسی) - * @author Reza1615 - */ -$messages['fa'] = array( - 'copytoclipboard-desc' => 'افزودن یک برچسب برای نمایش دکمهٔ "کپی در حافظهٔ موقت" در صفحهها', -); - -/** French (français) - * @author Seb35 - */ -$messages['fr'] = array( - 'copytoclipboard-desc' => 'Ajoute un tag pour montrer un bouton "copier vers le presse-papier" sur les pages', -); - -/** Galician (galego) - * @author Toliño - */ -$messages['gl'] = array( - 'copytoclipboard-desc' => 'Engade unha etiqueta para mostrar o botón