Commit ace08794 authored by webchick's avatar webchick

Issue #2240007 by sun, YesCT, mr.baileys | Gábor Hojtsy: Regression: early...

Issue #2240007 by sun, YesCT, mr.baileys | Gábor Hojtsy: Regression: early installer is not in RTL after selecting RTL language.
parent 5f0b5075
......@@ -377,8 +377,10 @@ function install_begin_request(&$install_state) {
$container->get('string_translation')
->addTranslator($container->get('string_translator.file_translation'));
// Add in installation language if present.
// Set the default language to the selected language, if any.
if (isset($install_state['parameters']['langcode'])) {
$default_language = new Language(array('id' => $install_state['parameters']['langcode']));
$container->get('language.default')->set($default_language);
\Drupal::translation()->setDefaultLangcode($install_state['parameters']['langcode']);
}
......
<?php
/**
* @file
* Contains \Drupal\system\Tests\Installer\InstallerLanguageDirectionTest.
*/
namespace Drupal\system\Tests\Installer;
use Drupal\simpletest\InstallerTestBase;
/**
* Tests the installer switches to RTL when installing in a RTL language.
*/
class InstallerLanguageDirectionTest extends InstallerTestBase {
/**
* Overrides the language code the installer should use.
*
* @var string
*/
protected $langcode = 'ar';
/**
* {@inheritdoc}
*/
public static function getInfo() {
return array(
'name' => 'Installer language direction test',
'description' => 'Verifies that the early installer uses the correct language direction.',
'group' => 'Installer',
);
}
/**
* {@inheritdoc}
*/
protected function setUpLanguage() {
parent::setUpLanguage();
// After selecting a different language than English, all following screens
// should be translated already.
// @todo Instead of actually downloading random translations that cannot be
// asserted, write and supply a translation file. Until then, take
// over whichever string happens to be there, but ensure that the English
// string no longer appears.
$elements = $this->xpath('//input[@type="submit"]/@value');
$string = (string) current($elements);
$this->assertNotEqual($string, 'Save and continue');
$this->translations['Save and continue'] = $string;
// Verify that language direction is right-to-left.
$direction = (string) current($this->xpath('/html/@dir'));
$this->assertEqual($direction, 'rtl');
}
/**
* Confirms that the installation succeeded.
*/
public function testInstalled() {
$this->assertUrl('user/1');
$this->assertResponse(200);
}
}
......@@ -44,6 +44,10 @@ protected function setUpLanguage() {
$string = (string) current($elements);
$this->assertNotEqual($string, 'Save and continue');
$this->translations['Save and continue'] = $string;
// Check the language direction.
$direction = (string) current($this->xpath('/html/@dir'));
$this->assertEqual($direction, 'ltr');
}
/**
......
Markdown is supported
0%
or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment