Pastakhov has uploaded a new change for review. (
https://gerrit.wikimedia.org/r/364187 )
Change subject: Use $wgLanguageCode for retrieving list of Magic Words
......................................................................
Use $wgLanguageCode for retrieving list of Magic Words
Bug: T170130
Change-Id: Ib1ace23f3f878d4de1c584e1438f3edbe5eef15a
---
M CodeMirror.hooks.php
1 file changed, 9 insertions(+), 9 deletions(-)
git pull ssh://gerrit.wikimedia.org:29418/mediawiki/extensions/CodeMirror
refs/changes/87/364187/1
diff --git a/CodeMirror.hooks.php b/CodeMirror.hooks.php
index fd8e3a4..0731dad 100644
--- a/CodeMirror.hooks.php
+++ b/CodeMirror.hooks.php
@@ -34,18 +34,18 @@
/**
* Returns an array of variables for CodeMirror to work (tags and so on)
*
- * @param IContextSource $context The current ContextSource object
* @global Parser $wgParser
+ * @global string $wgLanguageCode
* @staticvar array $config Cached version of configuration
* @return array
*/
- public static function getConfiguraton( IContextSource $context ) {
- global $wgParser;
+ public static function getConfiguraton() {
+ global $wgParser, $wgLanguageCode;
static $config = [];
// if we already created these variable array, return it
if ( !$config ) {
- $contObj = $context->getLanguage();
+ $lang = Language::factory( $wgLanguageCode );
$registry = ExtensionRegistry::getInstance();
if ( !isset( $wgParser->mFunctionSynonyms ) ) {
@@ -61,15 +61,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 +81,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 +104,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: newchange
Gerrit-Change-Id: Ib1ace23f3f878d4de1c584e1438f3edbe5eef15a
Gerrit-PatchSet: 1
Gerrit-Project: mediawiki/extensions/CodeMirror
Gerrit-Branch: master
Gerrit-Owner: Pastakhov <[email protected]>
_______________________________________________
MediaWiki-commits mailing list
[email protected]
https://lists.wikimedia.org/mailman/listinfo/mediawiki-commits