mw.title: Add pageLanguage property

Bug: T161976
Change-Id: Ifc7a462efb11b28f20ebaad5d62cba8f1f1f8e91
This commit is contained in:
Brad Jorsch 2017-04-03 12:52:12 -04:00 committed by jenkins-bot
parent beb0bf8465
commit 602cef87e0
2 changed files with 5 additions and 0 deletions

View file

@ -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()

View file

@ -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