From 9b5ddbb646da8e9c394140450e139c7ac1a69357 Mon Sep 17 00:00:00 2001 From: Rob Church Date: Thu, 8 Jun 2006 13:30:35 +0000 Subject: [PATCH] (bug 5945) Introduce {{CONTENTLANGUAGE}} magic word --- RELEASE-NOTES | 1 + includes/MagicWord.php | 2 ++ includes/Parser.php | 3 +++ languages/Language.php | 1 + 4 files changed, 7 insertions(+) diff --git a/RELEASE-NOTES b/RELEASE-NOTES index 093af87692..f1b26e3388 100644 --- a/RELEASE-NOTES +++ b/RELEASE-NOTES @@ -459,6 +459,7 @@ it from source control: http://www.mediawiki.org/wiki/Download_from_SVN * (bug 6230) Regression fix: in [URL link text] * Added AutoLoader.php, which loads classes without need of require_once() * (bug 5981) Add plural function Slovenian (sl) +* (bug 5945) Introduce {{CONTENTLANGUAGE}} magic word == Compatibility == diff --git a/includes/MagicWord.php b/includes/MagicWord.php index e015bb7759..e72e5bfff5 100644 --- a/includes/MagicWord.php +++ b/includes/MagicWord.php @@ -92,6 +92,7 @@ $magicWords = array( 'MAG_CURRENTTIMESTAMP', 'MAG_DIRECTIONMARK', 'MAG_LANGUAGE', + 'MAG_CONTENTLANGUAGE', ); if ( ! defined( 'MEDIAWIKI_INSTALL' ) ) wfRunHooks( 'MagicWordMagicWords', array( &$magicWords ) ); @@ -146,6 +147,7 @@ $wgVariableIDs = array( MAG_CURRENTTIMESTAMP, MAG_DIRECTIONMARK, MAG_LANGUAGE, + MAG_CONTENTLANGUAGE, ); if ( ! defined( 'MEDIAWIKI_INSTALL' ) ) wfRunHooks( 'MagicWordwgVariableIDs', array( &$wgVariableIDs ) ); diff --git a/includes/Parser.php b/includes/Parser.php index fdaeebd901..274142826e 100644 --- a/includes/Parser.php +++ b/includes/Parser.php @@ -2249,6 +2249,9 @@ class Parser return $wgScriptPath; case MAG_DIRECTIONMARK: return $wgContLang->getDirMark(); + case MAG_CONTENTLANGUAGE: + global $wgContLanguageCode; + return $wgContLanguageCode; default: $ret = null; if ( wfRunHooks( 'ParserGetVariableValueSwitch', array( &$this, &$varCache, &$index, &$ret ) ) ) diff --git a/languages/Language.php b/languages/Language.php index b77344abe1..841fa55823 100644 --- a/languages/Language.php +++ b/languages/Language.php @@ -290,6 +290,7 @@ $wgLanguageNamesEn =& $wgLanguageNames; MAG_CURRENTTIMESTAMP => array( 1, 'CURRENTTIMESTAMP' ), MAG_DIRECTIONMARK => array( 1, 'DIRECTIONMARK', 'DIRMARK' ), MAG_LANGUAGE => array( 0, '#LANGUAGE:' ), + MAG_CONTENTLANGUAGE => array( 1, 'CONTENTLANGUAGE', 'CONTENTLANG' ), ); if (!$wgCachedMessageArrays) { -- 2.20.1