[MediaWiki-commits] [Gerrit] Migrate to JSON i18n - change (mediawiki...DownloadCounter)

2014-03-31 Thread Raimond Spekking (Code Review)
Raimond Spekking 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: I02d5f9060d728790cf059094ea18af8907df7e13
---
M DownloadCounter.i18n.php
M DownloadCounter.php
A i18n/ar.json
A i18n/ast.json
A i18n/azb.json
A i18n/be-tarask.json
A i18n/cy.json
A i18n/da.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/fi.json
A i18n/fr.json
A i18n/gl.json
A i18n/he.json
A i18n/hsb.json
A i18n/hu.json
A i18n/ia.json
A i18n/id.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/ms.json
A i18n/nb.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/zh-hans.json
A i18n/zh-hant.json
43 files changed, 356 insertions(+), 293 deletions(-)

Approvals:
  Raimond Spekking: Verified; Looks good to me, approved



diff --git a/DownloadCounter.i18n.php b/DownloadCounter.i18n.php
index 5f87d66..eeb2776 100644
--- a/DownloadCounter.i18n.php
+++ b/DownloadCounter.i18n.php
@@ -1,297 +1,31 @@
 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'] );
+   }
 
-$messages['en'] = array(
-   'downloadcounter-desc' => 'Allows the display of total downloads and 
the time of the last download',
-);
-
-/** Message documentation (Message documentation)
- * @author Shirayuki
- */
-$messages['qqq'] = array(
-   'downloadcounter-desc' => '{{desc|name=Download 
Counter|url=http://www.mediawiki.org/wiki/Extension:DownloadCounter}}',
-);
-
-/** Arabic (العربية)
- * @author Tux-tn
- */
-$messages['ar'] = array(
-   'downloadcounter-desc' => 'يسمح بعرض عدد مرات التحميل ووقت التحميل 
الأخير',
-);
-
-/** Asturian (asturianu)
- * @author Xuacu
- */
-$messages['ast'] = array(
-   'downloadcounter-desc' => 'Permite amosar el númberu de descargues 
totales y la hora de la cabera descarga',
-);
-
-/** South Azerbaijani (تورکجه)
- * @author Mousa
- */
-$messages['azb'] = array(
-   'downloadcounter-desc' => 'بوتون اندیرمه‌لری و سون اندیرمه‌نین واختینی 
گؤسترمگه ایجازه وئرر',
-);
-
-/** Belarusian (Taraškievica orthography) (беларуская (тарашкевіца)‎)
- * @author Wizardist
- */
-$messages['be-tarask'] = array(
-   'downloadcounter-desc' => 'Дазваляе паказваць агульную колькасьць 
загрузак і час апошняй загрузкі',
-);
-
-/** Welsh (Cymraeg)
- * @author Lloffiwr
- */
-$messages['cy'] = array(
-   'downloadcounter-desc' => 'Yn galluogi dangos cyfanswm yr islwythiadau 
ac amser yr islwythiad diwethaf',
-);
-
-/** Danish (dansk)
- * @author Tjernobyl
- */
-$messages['da'] = array(
-   'downloadcounter-desc' => 'Tillader visning af samlede downloads og 
tidspunktet for den sidste download',
-);
-
-/** German (Deutsch)
- * @author Kghbln
- */
-$messages['de'] = array(
-   'downloadcounter-desc' => 'Ermöglicht die Anzeige der Gesamtzahl der 
Downloads sowie des Datums des letzten Herunterladens',
-);
-
-/** Lower Sorbian (dolnoserbski)
- * @author Michawiki
- */
-$messages['dsb'] = array(
-   'downloadcounter-desc' => 'Zmóžnja cełkownu licbu ześěgnjenjow cas 
slědnego ześěgnjenja zwobrazniś',
-);
-
-/** Spanish (español)
- * @author Armando-Martin
- */
-$messages['es'] = array(
-   'downloadcounter-desc' => 'Permite mostrar el número total de descargas 
y la hora de  la última descarga',
-);
-
-/** Basque (euskara)
- * @author Xabier Armendaritz
- */
-$messages['eu'] = array(
-   'downloadcounter-desc' => 

[MediaWiki-commits] [Gerrit] Migrate to JSON i18n - change (mediawiki...DownloadCounter)

2014-03-31 Thread Siebrand (Code Review)
Siebrand has uploaded a new change for review.

  https://gerrit.wikimedia.org/r/122320

Change subject: Migrate to JSON i18n
..

Migrate to JSON i18n

Procedure per https://www.mediawiki.org/wiki/Manual:GenerateJsonI18n.php
with shim.

Change-Id: I02d5f9060d728790cf059094ea18af8907df7e13
---
M DownloadCounter.i18n.php
M DownloadCounter.php
A i18n/ar.json
A i18n/ast.json
A i18n/azb.json
A i18n/be-tarask.json
A i18n/cy.json
A i18n/da.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/fi.json
A i18n/fr.json
A i18n/gl.json
A i18n/he.json
A i18n/hsb.json
A i18n/hu.json
A i18n/ia.json
A i18n/id.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/ms.json
A i18n/nb.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/zh-hans.json
A i18n/zh-hant.json
43 files changed, 356 insertions(+), 293 deletions(-)


  git pull 
ssh://gerrit.wikimedia.org:29418/mediawiki/extensions/DownloadCounter 
refs/changes/20/122320/1

diff --git a/DownloadCounter.i18n.php b/DownloadCounter.i18n.php
index 5f87d66..eeb2776 100644
--- a/DownloadCounter.i18n.php
+++ b/DownloadCounter.i18n.php
@@ -1,297 +1,31 @@
 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'] );
+   }
 
-$messages['en'] = array(
-   'downloadcounter-desc' => 'Allows the display of total downloads and 
the time of the last download',
-);
-
-/** Message documentation (Message documentation)
- * @author Shirayuki
- */
-$messages['qqq'] = array(
-   'downloadcounter-desc' => '{{desc|name=Download 
Counter|url=http://www.mediawiki.org/wiki/Extension:DownloadCounter}}',
-);
-
-/** Arabic (العربية)
- * @author Tux-tn
- */
-$messages['ar'] = array(
-   'downloadcounter-desc' => 'يسمح بعرض عدد مرات التحميل ووقت التحميل 
الأخير',
-);
-
-/** Asturian (asturianu)
- * @author Xuacu
- */
-$messages['ast'] = array(
-   'downloadcounter-desc' => 'Permite amosar el númberu de descargues 
totales y la hora de la cabera descarga',
-);
-
-/** South Azerbaijani (تورکجه)
- * @author Mousa
- */
-$messages['azb'] = array(
-   'downloadcounter-desc' => 'بوتون اندیرمه‌لری و سون اندیرمه‌نین واختینی 
گؤسترمگه ایجازه وئرر',
-);
-
-/** Belarusian (Taraškievica orthography) (беларуская (тарашкевіца)‎)
- * @author Wizardist
- */
-$messages['be-tarask'] = array(
-   'downloadcounter-desc' => 'Дазваляе паказваць агульную колькасьць 
загрузак і час апошняй загрузкі',
-);
-
-/** Welsh (Cymraeg)
- * @author Lloffiwr
- */
-$messages['cy'] = array(
-   'downloadcounter-desc' => 'Yn galluogi dangos cyfanswm yr islwythiadau 
ac amser yr islwythiad diwethaf',
-);
-
-/** Danish (dansk)
- * @author Tjernobyl
- */
-$messages['da'] = array(
-   'downloadcounter-desc' => 'Tillader visning af samlede downloads og 
tidspunktet for den sidste download',
-);
-
-/** German (Deutsch)
- * @author Kghbln
- */
-$messages['de'] = array(
-   'downloadcounter-desc' => 'Ermöglicht die Anzeige der Gesamtzahl der 
Downloads sowie des Datums des letzten Herunterladens',
-);
-
-/** Lower Sorbian (dolnoserbski)
- * @author Michawiki
- */
-$messages['dsb'] = array(
-   'downloadcounter-desc' => 'Zmóžnja cełkownu licbu ześěgnjenjow cas 
slědnego ześěgnjenja zwobrazniś',
-);
-
-/** Spanish (español)
- * @author Armando-Martin
- */
-$messages['es'] = array(
-   'downloadcounter-desc' => 'Permite mostrar el número total de descargas 
y la hora de  la última descarga',
-);
-
-/** Basque (euskara)
- * @author Xabier Armendaritz
-