Page MenuHomePhabricator

wgPageContentLanguage broken on Incubator, returns "en" always
Closed, DeclinedPublic

Description

On Incubator, wgPageContentLanguage is no longer returning the language of the test project being viewed. Instead, it is always returning "en".


Version: unspecified
Severity: normal

Details

Reference
bz56920

Event Timeline

bzimport raised the priority of this task from to Medium.Nov 22 2014, 2:30 AM
bzimport set Reference to bz56920.
bzimport added a subscriber: Unknown Object (MLST).

I'm not sure whether this was the case before, but right now it seems that it's only broken for languages not localized in Mediawiki. Other languages have wgPageContentLanguage set correctly.

It seems to me that it is an intended behavior. If the language isn't localized in MediaWiki, MediaWiki doesn't know what the language is, it wouldn't be able to display wgPageContentLanguage correctly. Do correct me if I am wrong.

aravikn wrote:

function testOnPageContentLanguage() {

		$title = Title::newFromText( 'Wp/nl/Test' );
		$this->assertEquals( $title->getPageLanguage()->getCode(), 'nl');
		$title = Title::newFromText( 'Template:Wp/be-tarask/Test' );
	  $this->assertEquals($title->getPageLanguage()->getCode()'betarask' );
		$title = Title::newFromText( 'Project:Wp/nl/Test' );
		$this->assertEquals( $title->getPageLanguage()->getCode(), 'en');

}

Is it the last line which is creating the problem? This is on WikimediaIncubator/IncubatorUnitTests.php

(In reply to Aravind K N from comment #3)

Is it the last line which is creating the problem? This is on
WikimediaIncubator/IncubatorUnitTests.php

Those are unit tests, i.e. meant to test the actual code but is not part of the actual code so cannot create any problems.

(In reply to Hydriz Scholz from comment #2)

It seems to me that it is an intended behavior. If the language isn't
localized in MediaWiki, MediaWiki doesn't know what the language is, it
wouldn't be able to display wgPageContentLanguage correctly. Do correct me
if I am wrong.

Indeed, the code tries to make a language object for xyz in Wx/xyz/Title, but MediaWiki only does that if it recognizes the language. There is some inconsistency however, because the lang attribute in the mw-content-text div tag is always set to the language code. E.g. on Wp/grc the page content language is always "grc", but on e.g. Wp/lkt it's "en" except for the mentioned attribute (maybe more). Since we expect active languages to be localized, there "shouldn't" be any issue.

Closing as WORKSFORME, feel free to reopen if needed.