From 602cef87e06d0d3222c6f37c01ee594ba933685e Mon Sep 17 00:00:00 2001 From: Brad Jorsch Date: Mon, 3 Apr 2017 12:52:12 -0400 Subject: [PATCH] mw.title: Add pageLanguage property Bug: T161976 Change-Id: Ifc7a462efb11b28f20ebaad5d62cba8f1f1f8e91 --- includes/engines/LuaCommon/TitleLibrary.php | 1 + includes/engines/LuaCommon/lualib/mw.title.lua | 4 ++++ 2 files changed, 5 insertions(+) diff --git a/includes/engines/LuaCommon/TitleLibrary.php b/includes/engines/LuaCommon/TitleLibrary.php index b520a76b..cd94fd94 100644 --- a/includes/engines/LuaCommon/TitleLibrary.php +++ b/includes/engines/LuaCommon/TitleLibrary.php @@ -139,6 +139,7 @@ class Scribunto_LuaTitleLibrary extends Scribunto_LuaLibraryBase { 'isRedirect' => (bool)$title->isRedirect(), 'id' => $title->getArticleID(), 'contentModel' => $title->getContentModel(), + 'pageLanguage' => $title->getPageLanguage()->getCode(), ]; if ( $title->getNamespace() === NS_SPECIAL ) { $ret['exists'] = MediaWikiServices::getInstance() diff --git a/includes/engines/LuaCommon/lualib/mw.title.lua b/includes/engines/LuaCommon/lualib/mw.title.lua index b36022f5..2b35232d 100644 --- a/includes/engines/LuaCommon/lualib/mw.title.lua +++ b/includes/engines/LuaCommon/lualib/mw.title.lua @@ -175,6 +175,7 @@ local function makeTitleObject( data ) exists = 'e', isRedirect = 'e', contentModel = 'e', + pageLanguage = 'e', id = 'e', redirectTarget = true, } @@ -207,6 +208,9 @@ local function makeTitleObject( data ) if readOnlyFields[k] == 'e' and data[k] == nil then for k,v in pairs( php.getExpensiveData( t.fullText ) ) do + if k == 'pageLanguage' and mw.language then + v = mw.language.new( v ) + end data[k] = v end end