Smuggli has uploaded a new change for review.

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

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

Implemented changes for translatewiki

Moved to Json i18n files

Change-Id: I92296b94beec4f131b876bcf1b7ac6e950318ef3
---
M Emoticons/Emoticons.class.php
M Emoticons/Emoticons.setup.php
A Emoticons/i18n/de.json
A Emoticons/i18n/en.json
A Emoticons/i18n/qqq.json
M Emoticons/languages/Emoticons.i18n.php
6 files changed, 82 insertions(+), 59 deletions(-)


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

diff --git a/Emoticons/Emoticons.class.php b/Emoticons/Emoticons.class.php
index f46ed9f..df9fa7d 100644
--- a/Emoticons/Emoticons.class.php
+++ b/Emoticons/Emoticons.class.php
@@ -96,8 +96,6 @@
                wfProfileIn( 'BS::'.__METHOD__ );
                $this->setHook( 'OutputPageBeforeHTML' );
                $this->setHook( 'ArticleSave' );
-
-               BsConfig::registerVar( 'MW::Emoticons::PathToEmoticons', 
'/extensions/BlueSpiceExtensions/Emoticons/emoticons', 
BsConfig::LEVEL_PRIVATE|BsConfig::TYPE_STRING, 
'bs-emoticons-pref-PathToEmoticons' );
                wfProfileOut( 'BS::'.__METHOD__ );
        }
 
@@ -122,10 +120,27 @@
                $aMapping = $wgMemc->get( $sKey );
 
                if ( $aMapping == false ) {
-                       $sPathToEmoticons = 
$wgScriptPath.BsConfig::get('MW::Emoticons::PathToEmoticons');
+                       $sPathToEmoticons = $wgScriptPath . 
'/extensions/BlueSpiceExtensions/Emoticons/emoticons';
 
                        // Get the list of emoticons from the message system.
-                       $sMappingContent = 
wfMessage('bs-emoticons-mapping')->plain();
+                       $sMappingContent = "smile.png           :-)     :)
+                                                               sad.png         
    :-(     :(
+                                                               neutral.png     
    :-|     :|
+                                                               angry.png       
    :-@     :@
+                                                               wink.png        
    ;-)     ;)
+                                                               smile-big.png   
    :D     :-D
+                                                               thinking.png    
    :-/     :/
+                                                               shut-mouth.png  
    :-X     :X
+                                                               crying.png      
    :'(
+                                                               shock.png       
    :-O
+                                                               confused.png    
    :-S
+                                                               
glasses-cool.png    8-)
+                                                               laugh.png       
    :lol:
+                                                               yawn.png        
    (:|
+                                                               good.png        
    :good:
+                                                               bad.png         
    :bad:
+                                                               embarrassed.png 
    :-[
+                                                               shame.png       
    [-X     [-x";
                        if( empty( $sMappingContent ) ) return true; // If the 
content successfully loaded, do the replacement
 
                        $aMappingLines = explode( "\n", $sMappingContent );
diff --git a/Emoticons/Emoticons.setup.php b/Emoticons/Emoticons.setup.php
index 0e3f61c..d4adb32 100644
--- a/Emoticons/Emoticons.setup.php
+++ b/Emoticons/Emoticons.setup.php
@@ -1,5 +1,7 @@
 <?php
 
-BsExtensionManager::registerExtension('Emoticons',                       
BsRUNLEVEL::FULL|BsRUNLEVEL::REMOTE);
+BsExtensionManager::registerExtension( 'Emoticons', 
BsRUNLEVEL::FULL|BsRUNLEVEL::REMOTE );
+
+$wgMessagesDirs['Emoticons'] = __DIR__ . '/i18n';
 
 $wgExtensionMessagesFiles['Emoticons'] = __DIR__ . 
'/languages/Emoticons.i18n.php';
diff --git a/Emoticons/i18n/de.json b/Emoticons/i18n/de.json
new file mode 100644
index 0000000..7aaf705
--- /dev/null
+++ b/Emoticons/i18n/de.json
@@ -0,0 +1,11 @@
+{
+       "@metadata": {
+               "authors": [
+                       "Stephan Muggli <[email protected]>"
+               ]
+       },
+       "bs-emoticons-desc": "Erzeugt Smiley-Bilder",
+       "bs-emoticons-error-validation-missing-symbol": "Fehler in Zeile $1: 
Dem Bild \"$2\" ist kein Symbol zugeordnet.",
+       "bs-emoticons-error-validation-imagename": "Fehler in Zeile $1: Der 
Bildname \"$2\" ist nicht zulässig.",
+       "bs-emoticons-error-validation-symbol": "Fehler in Zeile $1: Das Symbol 
\"$2\" ist nicht zulässig. Es muss aus mindestens Zwei und maximal Zehn Zeichen 
bestehen"
+}
diff --git a/Emoticons/i18n/en.json b/Emoticons/i18n/en.json
new file mode 100644
index 0000000..5cfdeb2
--- /dev/null
+++ b/Emoticons/i18n/en.json
@@ -0,0 +1,11 @@
+{
+       "@metadata": {
+               "authors": [
+                       "Stephan Muggli <[email protected]>"
+               ]
+       },
+       "bs-emoticons-desc": "Renders emoticons",
+       "bs-emoticons-error-validation-missing-symbol": "Error in line $1: 
There is no symbol for the image \"$2\".",
+       "bs-emoticons-error-validation-imagename": "Error in line $1: The image 
name \"$2\" is not valid.",
+       "bs-emoticons-error-validation-symbol": "Error in line $1: The symbol 
\"$2\" is not valid. It has to be between two and ten characters."
+}
diff --git a/Emoticons/i18n/qqq.json b/Emoticons/i18n/qqq.json
new file mode 100644
index 0000000..ccffb4b
--- /dev/null
+++ b/Emoticons/i18n/qqq.json
@@ -0,0 +1,11 @@
+{
+       "@metadata": {
+               "authors": [
+                       "Stephan Muggli <[email protected]>"
+               ]
+       },
+       "bs-emoticons-desc": "Used in 
[[Special:Wiki_Admin&mode=ExtensionInfo]], description of emoticons extension",
+       "bs-emoticons-error-validation-missing-symbol": "Error message for 
error in line $1: There is no symbol for the image \"$2\".\n $1 is line number 
where the error occurred, $2 is the name of the image.",
+       "bs-emoticons-error-validation-imagename": "Error message for error in 
line $1: The image name \"$2\" is not valid.\n $1 is line number where the 
error occurred, $2 is the name of the image.",
+       "bs-emoticons-error-validation-symbol": "Error message for error in 
line $1: The symbol \"$2\" is not valid. It has to be between two and ten 
characters.\n $1 is line number where the error occurred, $2 is the name of the 
symbol."
+}
diff --git a/Emoticons/languages/Emoticons.i18n.php 
b/Emoticons/languages/Emoticons.i18n.php
index 9a3cf68..3be4d3d 100644
--- a/Emoticons/languages/Emoticons.i18n.php
+++ b/Emoticons/languages/Emoticons.i18n.php
@@ -1,62 +1,35 @@
 <?php
 /**
- * Internationalisation file for Emoticons
+ * 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 Emoticons
- * @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( 'wfJsonI18nShim1a61b7205cd367b8' ) ) {
+       function wfJsonI18nShim1a61b7205cd367b8( $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-emoticons-extension-description'                          => 
'Renders emoticons in a text as images.',
-       'Emoticons'                                                   => 
'Emoticons',
-       'prefs-Emoticons'                                             => 
'Emoticons', 
-       'bs-emoticons-default-mapping-auto-generated-article-summary' => 
'Automatically created by Emoticons extension.',
-       'bs-emoticons-pref-PathToEmoticons'                           => 'Path 
to Emoticons',
-       'bs-emoticons-pref-MappingSourceArticleName'                  => 
'Wikiarticle with mapping information',
-       'bs-emoticons-error-validation-missing-symbol'                => 'Error 
in line $1: There is no symbol for the image "$2".',
-       'bs-emoticons-error-validation-imagename'                     => 'Error 
in line $1: The image name "$2" is not valid.',
-       'bs-emoticons-error-validation-symbol'                        => 'Error 
in line $1: The symbol "$2" is not valid. It has to be between two and tend 
characters long.',
-       'bs-emoticons-mapping'                                        => 
"smile.png           :-)     :)
-sad.png             :-(     :(
-neutral.png         :-|     :|
-angry.png           :-@     :@
-wink.png            ;-)     ;)
-smile-big.png       :D     :-D
-thinking.png        :-/     :/
-shut-mouth.png      :-X     :X
-crying.png          :'(
-shock.png           :-O
-confused.png        :-S
-glasses-cool.png    8-)
-laugh.png           :lol:
-yawn.png            (:|
-good.png            :good:
-bad.png             :bad:
-embarrassed.png     :-[
-shame.png           [-X     [-x",
-);
+                       $cachedData['deps'][] = new FileDependency( $fileName );
+               }
+               return true;
+       }
 
-$messages['de'] = array(
-       'bs-emoticons-extension-description'                          => 'Die 
entsprechenden ASCII-Zeichen z. B. :-) werden in Smiley-Bilder umgewandelt.',
-       'Emoticons'                                                   => 
'Emoticons',
-       'prefs-Emoticons'                                             => 
'Emoticons',
-       'bs-emoticons-default-mapping-auto-generated-article-summary' => 
'Automatisch von der Emoticons-Erweiterung angelegt.',
-       'bs-emoticons-pref-PathToEmoticons'                           => 'Pfad 
zu den Emoticons (Relativ zum MediaWiki Installationsverzeichnis)',
-       'bs-emoticons-pref-MappingSourceArticleName'                  => 
'Wikiartikel mit Zuordnungsinformationen',
-       'bs-emoticons-error-validation-missing-symbol'                => 
'Fehler in Zeile $1: Dem Bild "$2" ist kein Symbol zugeordnet.',
-       'bs-emoticons-error-validation-imagename'                     => 
'Fehler in Zeile $1: Der Bildname "$2" ist nicht zulässig.',
-       'bs-emoticons-error-validation-symbol'                        => 
'Fehler in Zeile $1: Das Symbol "$2" ist nicht zulässig. Es muss aus mindestens 
Zwei und maximal Zehn Zeichen bestehen'
-);
-
-$messages['de-formal'] = array();
-
-$messages['qqq'] = array();
\ No newline at end of file
+       $GLOBALS['wgHooks']['LocalisationCacheRecache'][] = 
'wfJsonI18nShim1a61b7205cd367b8';
+}

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

Gerrit-MessageType: newchange
Gerrit-Change-Id: I92296b94beec4f131b876bcf1b7ac6e950318ef3
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