public function setLanguage( $language ) {
$this->language = $language;
// Invalidate direction since it is based on language
- $this->direction = self::INHERIT_VALUE;
+ $this->direction = null;
$this->hash = null;
}
if ( $this->direction === self::INHERIT_VALUE ) {
return $this->context->getDirection();
}
+ if ( $this->direction === null ) {
+ $this->direction = Language::factory( $this->getLanguage() )->getDir();
+ }
return $this->direction;
}
public function getLanguage() {
if ( $this->language === null ) {
// Must be a valid language code after this point (bug 62849)
- $this->language = RequestContext::sanitizeLangCode( $this->request->getVal( 'lang' ) );
+ $this->language = RequestContext::sanitizeLangCode( $this->getRequest()->getVal( 'lang' ) );
}
return $this->language;
}
*/
public function getDirection() {
if ( $this->direction === null ) {
- $this->direction = $this->request->getVal( 'dir' );
+ $this->direction = $this->getRequest()->getVal( 'dir' );
if ( !$this->direction ) {
// Determine directionality based on user language (bug 6100)
$this->direction = Language::factory( $this->getLanguage() )->getDir();
$derived->setLanguage( 'nl' );
$this->assertEquals( $derived->getLanguage(), 'nl' );
+
+ $derived->setLanguage( 'he' );
+ $this->assertEquals( $derived->getDirection(), 'rtl' );
}
public function testSetModules() {