*/
public function getLanguage() {
if ( $this->language === null ) {
- global $wgLang;
- $this->language = $this->request->getVal( 'lang' );
- if ( !$this->language ) {
- $this->language = $wgLang->getCode();
- }
+ // Must be a valid language code after this point (bug 62849)
+ $this->language = RequestContext::sanitizeLangCode( $this->request->getVal( 'lang' ) );
}
return $this->language;
}
if ( $this->direction === null ) {
$this->direction = $this->request->getVal( 'dir' );
if ( !$this->direction ) {
- # directionality based on user language (see bug 6100)
+ // Determine directionality based on user language (bug 6100)
$this->direction = Language::factory( $this->getLanguage() )->getDir();
}
}