jenkins-bot has submitted this change and it was merged. ( 
https://gerrit.wikimedia.org/r/364187 )

Change subject: Use $wgContLang for retrieving list of Magic Words
......................................................................


Use $wgContLang for retrieving list of Magic Words

Bug: T170130
Change-Id: Ib1ace23f3f878d4de1c584e1438f3edbe5eef15a
---
M CodeMirror.hooks.php
1 file changed, 10 insertions(+), 9 deletions(-)

Approvals:
  jenkins-bot: Verified
  Kaldari: Looks good to me, approved



diff --git a/CodeMirror.hooks.php b/CodeMirror.hooks.php
index fd8e3a4..1bd9c40 100644
--- a/CodeMirror.hooks.php
+++ b/CodeMirror.hooks.php
@@ -34,18 +34,19 @@
        /**
         * Returns an array of variables for CodeMirror to work (tags and so on)
         *
-        * @param IContextSource $context The current ContextSource object
         * @global Parser $wgParser
+        * @global Language $wgContLang
         * @staticvar array $config Cached version of configuration
         * @return array
         */
-       public static function getConfiguraton( IContextSource $context ) {
-               global $wgParser;
+       public static function getConfiguraton() {
+               global $wgParser, $wgContLang;
                static $config = [];
 
                // if we already created these variable array, return it
                if ( !$config ) {
-                       $contObj = $context->getLanguage();
+                        // Use the content language, not the user language. 
(See T170130.)
+                       $lang = $wgContLang;
                        $registry = ExtensionRegistry::getInstance();
 
                        if ( !isset( $wgParser->mFunctionSynonyms ) ) {
@@ -61,15 +62,15 @@
                                'doubleUnderscore' => [ [], [] ],
                                'functionSynonyms' => 
$wgParser->mFunctionSynonyms,
                                'urlProtocols' => $wgParser->mUrlProtocols,
-                               'linkTrailCharacters' =>  $contObj->linkTrail(),
+                               'linkTrailCharacters' =>  $lang->linkTrail(),
                        ];
 
-                       $mw = $contObj->getMagicWords();
+                       $mw = $lang->getMagicWords();
                        foreach ( MagicWord::getDoubleUnderscoreArray()->names 
as $name ) {
                                if ( isset( $mw[$name] ) ) {
                                        $caseSensitive = array_shift( 
$mw[$name] ) == 0 ? 0 : 1;
                                        foreach ( $mw[$name] as $n ) {
-                                               $n = $caseSensitive ? $n : 
$contObj->lc( $n );
+                                               $n = $caseSensitive ? $n : 
$lang->lc( $n );
                                                
$config['doubleUnderscore'][$caseSensitive][$n] = $name;
                                        }
                                } else {
@@ -81,7 +82,7 @@
                                if ( isset( $mw[$name] ) ) {
                                        $caseSensitive = array_shift( 
$mw[$name] ) == 0 ? 0 : 1;
                                        foreach ( $mw[$name] as $n ) {
-                                               $n = $caseSensitive ? $n : 
$contObj->lc( $n );
+                                               $n = $caseSensitive ? $n : 
$lang->lc( $n );
                                                
$config['functionSynonyms'][$caseSensitive][$n] = $name;
                                        }
                                }
@@ -104,7 +105,7 @@
                $context = $out->getContext();
                // add CodeMirror vars on edit pages, or if VE is installed
                if ( self::isCodeMirrorEnabled( $context ) || class_exists( 
'VisualEditorHooks' ) ) {
-                       $vars['extCodeMirrorConfig'] = self::getConfiguraton( 
$context );
+                       $vars['extCodeMirrorConfig'] = self::getConfiguraton();
                }
        }
 

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

Gerrit-MessageType: merged
Gerrit-Change-Id: Ib1ace23f3f878d4de1c584e1438f3edbe5eef15a
Gerrit-PatchSet: 5
Gerrit-Project: mediawiki/extensions/CodeMirror
Gerrit-Branch: master
Gerrit-Owner: Pastakhov <pastak...@yandex.ru>
Gerrit-Reviewer: Brian Wolff <bawolff...@gmail.com>
Gerrit-Reviewer: Kaldari <rkald...@wikimedia.org>
Gerrit-Reviewer: jenkins-bot <>

_______________________________________________
MediaWiki-commits mailing list
MediaWiki-commits@lists.wikimedia.org
https://lists.wikimedia.org/mailman/listinfo/mediawiki-commits

Reply via email to