jenkins-bot 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: If38820ec8c005965575a58aa81740a7b1298ee0b --- M p2wiki/P2wiki.i18n.php A p2wiki/i18n/en.json M p2wiki/p2wiki.php 3 files changed, 38 insertions(+), 16 deletions(-) Approvals: Nikerabbit: Looks good to me, approved jenkins-bot: Verified diff --git a/p2wiki/P2wiki.i18n.php b/p2wiki/P2wiki.i18n.php index 1d07d2d..eeb2776 100644 --- a/p2wiki/P2wiki.i18n.php +++ b/p2wiki/P2wiki.i18n.php @@ -1,17 +1,31 @@ <?php /** - * Internationalisation file for the p2wiki skin + * This is a backwards-compatibility shim, generated by: + * https://git.wikimedia.org/blob/mediawiki%2Fcore.git/HEAD/maintenance%2FgenerateJsonI18n.php * - * @file - * @ingroup Extensions - * @author Daniel Friesen + * 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 Daniel Friesen - */ -$messages['en'] = array( - 'skinname-p2wiki' => "P2 wiki", -); + $cachedData['deps'][] = new FileDependency( $fileName ); + } + return true; +}; diff --git a/p2wiki/i18n/en.json b/p2wiki/i18n/en.json new file mode 100644 index 0000000..79a71a2 --- /dev/null +++ b/p2wiki/i18n/en.json @@ -0,0 +1,8 @@ +{ + "@metadata": { + "authors": [ + "Daniel Friesen" + ] + }, + "skinname-p2wiki": "P2 wiki" +} diff --git a/p2wiki/p2wiki.php b/p2wiki/p2wiki.php index bd5fdef..e8ebdf3 100644 --- a/p2wiki/p2wiki.php +++ b/p2wiki/p2wiki.php @@ -3,21 +3,21 @@ * @author automattic http://wordpress.org/extend/themes/profile/automattic * @author Daniel Friesen (http://mediawiki.org/wiki/User:Dantman) <[email protected]> * @license http://www.gnu.org/copyleft/gpl.html GNU General Public License 2.0 or later - * + * * This program is free software; you can redistribute it and/or * modify it under the terms of the GNU General Public License * as published by the Free Software Foundation; either version 2 * of the License, or (at your option) any later version. - * + * * This program is distributed in the hope that it will be useful, * but WITHOUT ANY WARRANTY; without even the implied warranty of * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the * GNU General Public License for more details. - * + * * You should have received a copy of the GNU General Public License * along with this program; if not, write to the Free Software * Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301, USA. - * + * * To install place the p2wiki folder into skins/ and add this line to your LocalSettings.php * require_once("$IP/skins/p2wiki/p2wiki.php"); */ @@ -34,8 +34,8 @@ $skinID = basename(dirname(__FILE__)); $wgValidSkinNames[$skinID] = 'P2wiki'; $wgAutoloadClasses['SkinP2wiki'] = dirname(__FILE__).'/P2wiki.skin.php'; +$wgMessagesDirs['SkinP2wiki'] = __DIR__ . '/i18n'; $wgExtensionMessagesFiles['SkinP2wiki'] = dirname(__FILE__).'/P2wiki.i18n.php'; $wgResourceModules["skins.$skinID"] = array( 'styles' => array( "skins/$skinID/style/screen.css" => array( 'media' => 'screen' ) ) ); - -- To view, visit https://gerrit.wikimedia.org/r/123584 To unsubscribe, visit https://gerrit.wikimedia.org/r/settings Gerrit-MessageType: merged Gerrit-Change-Id: If38820ec8c005965575a58aa81740a7b1298ee0b Gerrit-PatchSet: 1 Gerrit-Project: mediawiki/extensions/skins Gerrit-Branch: master Gerrit-Owner: Siebrand <[email protected]> Gerrit-Reviewer: Daniel Friesen <[email protected]> Gerrit-Reviewer: Nikerabbit <[email protected]> Gerrit-Reviewer: Waldir <[email protected]> Gerrit-Reviewer: jenkins-bot <> _______________________________________________ MediaWiki-commits mailing list [email protected] https://lists.wikimedia.org/mailman/listinfo/mediawiki-commits
