Smuggli has uploaded a new change for review.

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

Change subject: Implemented changes for translatewiki
......................................................................

Implemented changes for translatewiki

Moved to Json i18n files

Change-Id: I1071bdba3c802a1c1cf6508017cfa56bcb43c58e
---
M WikiAdmin/WikiAdmin.class.php
M WikiAdmin/WikiAdmin.setup.php
A WikiAdmin/i18n/de-formal.json
A WikiAdmin/i18n/de.json
A WikiAdmin/i18n/en.json
A WikiAdmin/i18n/qqq.json
M WikiAdmin/languages/WikiAdmin.i18n.php
7 files changed, 121 insertions(+), 54 deletions(-)


  git pull 
ssh://gerrit.wikimedia.org:29418/mediawiki/extensions/BlueSpiceExtensions 
refs/changes/62/143262/1

diff --git a/WikiAdmin/WikiAdmin.class.php b/WikiAdmin/WikiAdmin.class.php
index 5f05ef9..2736543 100644
--- a/WikiAdmin/WikiAdmin.class.php
+++ b/WikiAdmin/WikiAdmin.class.php
@@ -24,22 +24,11 @@
   * http://www.gnu.org/copyleft/gpl.html
   *
   * For further information visit http://www.blue-spice.org
-  *
-  * Version information
-  * $LastChangedDate: 2013-06-25 11:17:54 +0200 (Di, 25 Jun 2013) $
-  * $LastChangedBy: rvogel $
-  * $Rev: 9912 $
-
   */
 
 /* Changelog
- * v1.20.0
- * - MediaWiki I18N
- * v0.1.0
- * FIRST CHANGES
+ * v2.23.0
  */
-
- // Last review: (01.07.11 01:58)
 
 class WikiAdmin extends BsExtensionMW {
 
@@ -196,4 +185,49 @@
 
                wfProfileOut( 'BS::'.__METHOD__ );
        }
+
+       /**
+        * Adds WikiAdmin tab to main navigation
+        * @param SkinTemplate $sktemplate
+        * @param BaseTemplate $tpl
+        * @return boolean Always true to keep hook running
+        */
+       public static function onSkinTemplateOutputPageBeforeExec( 
&$sktemplate, &$tpl ) {
+               if( $sktemplate->getUser()->isAllowed('wikiadmin') === false ) {
+                       return true;
+               }
+
+               $oSpecialPage = SpecialPage::getTitleFor('WikiAdmin');
+               $aRegisteredModules = WikiAdmin::getRegisteredModules();
+
+               $aOut = array();
+               $aOut[] = '<ul>';
+
+               foreach ( $aRegisteredModules as $sModuleKey => $aModulParams ) 
{
+                       $skeyLower = mb_strtolower($sModuleKey);
+                       $sModulLabel = wfMessage( 'bs-' . $skeyLower . '-label' 
)->plain();
+                       $sUrl = $oSpecialPage->getLocalURL( array( 'mode' => 
$sModuleKey ) );
+                       //$sUrl = str_replace( '&', '&amp;', $sUrl );
+                       $sLink = Html::element(
+                               'a',
+                               array(
+                                       'id' => 'bs-admin-'.$skeyLower,
+                                       'href' => $sUrl,
+                                       'title' => $sModulLabel
+                               ),
+                               $sModulLabel
+                       );
+                       $aOut[] = '  <li>'.$sLink.'</li>';
+               }
+
+               $aOut[] = '</ul>';
+
+               $tpl->data['bs_navigation_main']['bs-wikiadmin'] = array(
+                       'position' => 100,
+                       'label' => wfMessage('bs-tab_admin')->plain(),
+                       'class' => 'icon-wrench',
+                       'content' => implode( "\n", $aOut )
+               );
+               return true;
+       }
 }
\ No newline at end of file
diff --git a/WikiAdmin/WikiAdmin.setup.php b/WikiAdmin/WikiAdmin.setup.php
index 03396ca..819c864 100644
--- a/WikiAdmin/WikiAdmin.setup.php
+++ b/WikiAdmin/WikiAdmin.setup.php
@@ -7,8 +7,9 @@
 $wgExtensionMessagesFiles['WikiAdmin'] = __DIR__ . 
'/languages/WikiAdmin.i18n.php';
 
 // Specialpage and messages
-$wgAutoloadClasses['SpecialWikiAdmin'] = __DIR__ . 
'/includes/specials/SpecialWikiAdmin.class.php'; # Location of the 
SpecialMyExtension class (Tell MediaWiki to load this file)
+$wgAutoloadClasses['SpecialWikiAdmin'] = __DIR__ . 
'/includes/specials/SpecialWikiAdmin.class.php';
 $wgSpecialPageGroups['SpecialWikiAdmin'] = 'bluespice';
-$wgExtensionMessagesFiles['WikiAdminAlias'] = __DIR__ . 
'/includes/specials/SpecialWikiAdmin.alias.php'; # Location of an aliases file 
(Tell MediaWiki to load this file)
-$wgSpecialPages['SpecialWikiAdmin'] = 'SpecialWikiAdmin'; # Tell MediaWiki 
about the new special page and its class name
+$wgExtensionMessagesFiles['WikiAdminAlias'] = __DIR__ . 
'/includes/specials/SpecialWikiAdmin.alias.php';
+$wgSpecialPages['SpecialWikiAdmin'] = 'SpecialWikiAdmin';
 
+$wgHooks['SkinTemplateOutputPageBeforeExec'][] = 
'WikiAdmin::onSkinTemplateOutputPageBeforeExec';
\ No newline at end of file
diff --git a/WikiAdmin/i18n/de-formal.json b/WikiAdmin/i18n/de-formal.json
new file mode 100644
index 0000000..20ecc84
--- /dev/null
+++ b/WikiAdmin/i18n/de-formal.json
@@ -0,0 +1,8 @@
+{
+       "@metadata": {
+               "authors": [
+                       "Stephan Muggli <[email protected]>"
+               ]
+       },
+       "bs-wikiadmin-notallowed": "Sie sind leider nicht berechtigt, diese 
Seite zu benutzen."
+}
diff --git a/WikiAdmin/i18n/de.json b/WikiAdmin/i18n/de.json
new file mode 100644
index 0000000..715c9d7
--- /dev/null
+++ b/WikiAdmin/i18n/de.json
@@ -0,0 +1,12 @@
+{
+       "@metadata": {
+               "authors": [
+                       "Stephan Muggli <[email protected]>"
+               ]
+       },
+       "bs-wikiadmin-desc": "Administration",
+       "bs-wikiadmin-notallowed": "Du bist leider nicht berechtigt, diese 
Seite zu benutzen.",
+       "specialwikiadmin": "Wiki-Administration",
+       "action-wikiadmin": "Seiten zu sehen, die mit dem \"wikiadmin\"-Recht 
geschützt sind.",
+       "right-wikiadmin": "Benutzen der Wiki-Admin Erweiterung"
+}
diff --git a/WikiAdmin/i18n/en.json b/WikiAdmin/i18n/en.json
new file mode 100644
index 0000000..9f4ec11
--- /dev/null
+++ b/WikiAdmin/i18n/en.json
@@ -0,0 +1,12 @@
+{
+       "@metadata": {
+               "authors": [
+                       "Stephan Muggli <[email protected]>"
+               ]
+       },
+       "bs-wikiadmin-desc": "Administration",
+       "bs-wikiadmin-notallowed": "You are not allowed to use this page.",
+       "specialwikiadmin": "Wiki administration",
+       "action-wikiadmin": "view pages which are protected with the 
\"wikiadmin\" right",
+       "right-wikiadmin": "Use Wiki admin extension"
+}
diff --git a/WikiAdmin/i18n/qqq.json b/WikiAdmin/i18n/qqq.json
new file mode 100644
index 0000000..99b4d66
--- /dev/null
+++ b/WikiAdmin/i18n/qqq.json
@@ -0,0 +1,12 @@
+{
+       "@metadata": {
+               "authors": [
+                       "Stephan Muggli <[email protected]>"
+               ]
+       },
+       "bs-wikiadmin-desc": "Used in 
[[Special:Wiki_Admin&mode=ExtensionInfo]], description of wiki admin 
extension.",
+       "bs-wikiadmin-notallowed": "Text for you are not allowed to use this 
page.",
+       "specialwikiadmin": "Special page title for wiki 
administration\n{{Identical|Wiki administration}}",
+       "action-wikiadmin": "{{doc-action|wikiadmin}}",
+       "right-wikiadmin": "{{doc-right|wikiadmin}}"
+}
diff --git a/WikiAdmin/languages/WikiAdmin.i18n.php 
b/WikiAdmin/languages/WikiAdmin.i18n.php
index 9d61361..65d3722 100644
--- a/WikiAdmin/languages/WikiAdmin.i18n.php
+++ b/WikiAdmin/languages/WikiAdmin.i18n.php
@@ -1,47 +1,35 @@
 <?php
 /**
- * Internationalisation file for WikiAdmin
+ * This is a backwards-compatibility shim, generated by:
+ * 
https://git.wikimedia.org/blob/mediawiki%2Fcore.git/HEAD/maintenance%2FgenerateJsonI18n.php
  *
- * Part of BlueSpice for MediaWiki
+ * 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
  *
- * @author     Stephan Muggli <[email protected]>
-
- * @package    BlueSpice_Extensions
- * @subpackage UserManager
- * @copyright  Copyright (C) 2012 Hallo Welt! - Medienwerkstatt GmbH, All 
rights reserved.
- * @license    http://www.gnu.org/copyleft/gpl.html GNU Public License v2 or 
later
- * @filesource
+ * This shim maintains compatibility back to MediaWiki 1.17.
  */
-
 $messages = array();
+if ( !function_exists( 'wfJsonI18nShimdeab3e52e44de4fc' ) ) {
+       function wfJsonI18nShimdeab3e52e44de4fc( $cache, $code, &$cachedData ) {
+               $codeSequence = array_merge( array( $code ), 
$cachedData['fallbackSequence'] );
+               foreach ( $codeSequence as $csCode ) {
+                       $fileName = dirname( __FILE__ ) . 
"/../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(
-       'bs-wikiadmin-desc' => 'Central point of administration for Bluespice',
-       'bs-wikiadmin-notallowed' => 'You are not allowed to use this page.',
-       'specialwikiadmin' => 'Wiki admin',
-       'specialwikiadmin-desc' => '',
-       'specialpages-group-bluespice' => 'BlueSpice',
-       'action-wikiadmin' => 'view pages which are protected with the 
"wikiadmin" right',
-);
+                       $cachedData['deps'][] = new FileDependency( $fileName );
+               }
+               return true;
+       }
 
-$messages['de'] = array(
-       'bs-wikiadmin-desc' => 'Zentraler Administrationspunkt für Bluespice',
-       'bs-wikiadmin-notallowed' => 'Du bist leider nicht berechtigt, diese 
Seite zu benutzen.',
-       'specialwikiadmin' => 'Wiki admin',
-       'specialwikiadmin-desc' => '',
-       'specialpages-group-bluespice' => 'BlueSpice',
-       'action-wikiadmin' => 'Seiten zu sehen, die mit dem "wikiadmin"-Recht 
geschützt sind.',
-);
-
-$messages['de-formal'] = array(
-       'bs-wikiadmin-notallowed' => 'Sie sind leider nicht berechtigt, diese 
Seite zu benutzen.',
-);
-
-$messages['qqq'] = array(
-       'bs-wikiadmin-desc' => 'Used in 
[[Special:Wiki_Admin&mode=ExtensionInfo]], description of wiki admin 
extension.',
-       'bs-wikiadmin-notallowed' => 'YText for you are not allowed to use this 
page.',
-       'specialwikiadmin' => 'Wiki admin',
-       'specialwikiadmin-desc' => '',
-       'specialpages-group-bluespice' => 'BlueSpice',
-       'action-wikiadmin' => 'Permission errer message for view pages which 
are protected with the "wikiadmin" right',
-);
\ No newline at end of file
+       $GLOBALS['wgHooks']['LocalisationCacheRecache'][] = 
'wfJsonI18nShimdeab3e52e44de4fc';
+}

-- 
To view, visit https://gerrit.wikimedia.org/r/143262
To unsubscribe, visit https://gerrit.wikimedia.org/r/settings

Gerrit-MessageType: newchange
Gerrit-Change-Id: I1071bdba3c802a1c1cf6508017cfa56bcb43c58e
Gerrit-PatchSet: 1
Gerrit-Project: mediawiki/extensions/BlueSpiceExtensions
Gerrit-Branch: master
Gerrit-Owner: Smuggli <[email protected]>

_______________________________________________
MediaWiki-commits mailing list
[email protected]
https://lists.wikimedia.org/mailman/listinfo/mediawiki-commits

Reply via email to