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

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

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

Change subject: Migrate to JSON i18n
..

Migrate to JSON i18n

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

Change-Id: I3fac715049c9fd1c5da09040a786b51082abaf4f
---
M CryoKey.i18n.php
M cryokey.php
A i18n/ast.json
A i18n/br.json
A i18n/ce.json
A i18n/de.json
A i18n/dsb.json
A i18n/en-gb.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/lt.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/qqq.json
A i18n/roa-tara.json
A i18n/ru.json
A i18n/sv.json
A i18n/tl.json
A i18n/uk.json
A i18n/zh-hans.json
A i18n/zh-hant.json
36 files changed, 425 insertions(+), 372 deletions(-)


  git pull ssh://gerrit.wikimedia.org:29418/mediawiki/extensions/CryoKey 
refs/changes/08/122308/1

diff --git a/CryoKey.i18n.php b/CryoKey.i18n.php
index ef80a39..eeb2776 100644
--- a/CryoKey.i18n.php
+++ b/CryoKey.i18n.php
@@ -1,377 +1,31 @@
 https://git.wikimedia.org/blob/mediawiki%2Fcore.git/HEAD/maintenance%2FgenerateJsonI18n.php
  *
- * @file
- * @ingroup Extensions
- * @author Authenticade LLC
- * @licence MIT License
+ * 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 (
-   'cryokey-desc' => 'Adds support for CryoKey credentials',
-   'cryokey-label' => 'Log in with CryoKey',
-   'cryokey-start' => 'Checking credentials, please wait...',
-   'cryokey-abort' => 'Login aborted',
-   'cryokey-fail' => 'Not authorized',
-);
-
-/** Message documentation (Message documentation)
- * @author Raymond
- * @author Shirayuki
- */
-$messages['qqq'] = array(
-   'cryokey-desc' => '{{desc|name=Cryo 
Key|url=http://www.mediawiki.org/wiki/Extension:CryoKey}}',
-   'cryokey-label' => 'Used as link text (next to the icon) in the Login 
page.
-
-It gets replaced by status messages.',
-   'cryokey-start' => 'When authentication begins, this message appears in 
the label.',
-   'cryokey-abort' => 'If the user aborts authentication (by stopping the 
HTTP request), he gets this message.',
-   'cryokey-fail' => "Either the credentials are not valid (expired, 
corrupt, or nonexistent) or the user doesn't have an account on the wiki.
-
-Used as error message, if the user attempts to login and fails, three times 
(CK_ATTEMPTS).
-{{Identical|Not authorized}}",
-);
-
-/** Asturian (asturianu)
- * @author Xuacu
- */
-$messages['ast'] = array(
-   'cryokey-desc' => 'Amiesta sofitu pa les credenciales CryoKey',
-   'cryokey-label' => 'Aniciar sesión con CryoKey',
-   'cryokey-start' => 'Comprobando les credenciales; espere, por favor...',
-   'cryokey-abort' => "Encaboxáu l'aniciu de sesión",
-   'cryokey-fail' => 'Non autorizáu',
-);
-
-/** Breton (brezhoneg)
- * @author Fulup
- * @author Y-M D
- */
-$messages['br'] = array(
-   'cryokey-desc' => 'Ouzhpennañ a ra ar skor evit testenioù CryoKey',
-   'cryokey-label' => 'Kevreañ gant CryoKey',
-   'cryokey-start' => 'O gwiriañ testenioù, gortozit mar plij...',
-   'cryokey-abort' => 'Kevreadur ehanet',
-   'cryokey-fail' => "N'eo ket aotreet",
-);
-
-/** Chechen (нохчийн)
- * @author Умар
- */
-$messages['ce'] = array(
-   'cryokey-label' => 'ЧугӀо CryoKey гӀоьнца',
-);
-
-/** German (Deutsch)
- * @author Metalhead64
- * @author Purodha
- */
-$messages['de'] = array(
-   'cryokey-desc' => 'Ergänzt das Wiki um die Unterstützung für 
CryoKey-Anmeldeinformationen',
-   'cryokey-label' => 'Mit CryoKey anmelden',
-   'cryokey-start' => 'Anmeldeinfor

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

2014-03-31 Thread Siebrand (Code Review)
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: I3fac715049c9fd1c5da09040a786b51082abaf4f
---
M CryoKey.i18n.php
M cryokey.php
A i18n/ast.json
A i18n/br.json
A i18n/ce.json
A i18n/de.json
A i18n/dsb.json
A i18n/en-gb.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/lt.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/qqq.json
A i18n/roa-tara.json
A i18n/ru.json
A i18n/sv.json
A i18n/tl.json
A i18n/uk.json
A i18n/zh-hans.json
A i18n/zh-hant.json
36 files changed, 425 insertions(+), 372 deletions(-)

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



diff --git a/CryoKey.i18n.php b/CryoKey.i18n.php
index ef80a39..eeb2776 100644
--- a/CryoKey.i18n.php
+++ b/CryoKey.i18n.php
@@ -1,377 +1,31 @@
 https://git.wikimedia.org/blob/mediawiki%2Fcore.git/HEAD/maintenance%2FgenerateJsonI18n.php
  *
- * @file
- * @ingroup Extensions
- * @author Authenticade LLC
- * @licence MIT License
+ * 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 (
-   'cryokey-desc' => 'Adds support for CryoKey credentials',
-   'cryokey-label' => 'Log in with CryoKey',
-   'cryokey-start' => 'Checking credentials, please wait...',
-   'cryokey-abort' => 'Login aborted',
-   'cryokey-fail' => 'Not authorized',
-);
-
-/** Message documentation (Message documentation)
- * @author Raymond
- * @author Shirayuki
- */
-$messages['qqq'] = array(
-   'cryokey-desc' => '{{desc|name=Cryo 
Key|url=http://www.mediawiki.org/wiki/Extension:CryoKey}}',
-   'cryokey-label' => 'Used as link text (next to the icon) in the Login 
page.
-
-It gets replaced by status messages.',
-   'cryokey-start' => 'When authentication begins, this message appears in 
the label.',
-   'cryokey-abort' => 'If the user aborts authentication (by stopping the 
HTTP request), he gets this message.',
-   'cryokey-fail' => "Either the credentials are not valid (expired, 
corrupt, or nonexistent) or the user doesn't have an account on the wiki.
-
-Used as error message, if the user attempts to login and fails, three times 
(CK_ATTEMPTS).
-{{Identical|Not authorized}}",
-);
-
-/** Asturian (asturianu)
- * @author Xuacu
- */
-$messages['ast'] = array(
-   'cryokey-desc' => 'Amiesta sofitu pa les credenciales CryoKey',
-   'cryokey-label' => 'Aniciar sesión con CryoKey',
-   'cryokey-start' => 'Comprobando les credenciales; espere, por favor...',
-   'cryokey-abort' => "Encaboxáu l'aniciu de sesión",
-   'cryokey-fail' => 'Non autorizáu',
-);
-
-/** Breton (brezhoneg)
- * @author Fulup
- * @author Y-M D
- */
-$messages['br'] = array(
-   'cryokey-desc' => 'Ouzhpennañ a ra ar skor evit testenioù CryoKey',
-   'cryokey-label' => 'Kevreañ gant CryoKey',
-   'cryokey-start' => 'O gwiriañ testenioù, gortozit mar plij...',
-   'cryokey-abort' => 'Kevreadur ehanet',
-   'cryokey-fail' => "N'eo ket aotreet",
-);
-
-/** Chechen (нохчийн)
- * @author Умар
- */
-$messages['ce'] = array(
-   'cryokey-label' => 'ЧугӀо CryoKey гӀоьнца',
-);
-
-/** German (Deutsch)
- * @author Metalhead64
- * @author Purodha
- */
-$messages['de'] = array(
-   'cryokey-desc' => 'Ergänzt das Wiki um die Unterstützung für 
CryoKey-Anmeldeinformationen',
-   'cryokey-label' => 'Mit CryoKey anmelden',
-   'cryokey-start' => 'Anmeldeinformationen werden überprüft. Bitte warten 
…',
-