Commit 035393d8 authored by webchick's avatar webchick

Issue #2336743 by webflo, penyaskito, YesCT, Gábor Hojtsy: Fixed When more...

Issue #2336743 by webflo, penyaskito, YesCT, Gábor Hojtsy: Fixed When more than one language is added in the profile, the installer ignores those.
parent 10341f43
This diff is collapsed.
......@@ -542,6 +542,7 @@ function locale_config_batch_build(array $names, array $langcodes, $options = ar
$options += array('finish_feedback' => TRUE);
$i = 0;
$batch_names = array();
$operations = array();
foreach ($names as $name) {
$batch_names[] = $name;
$i++;
......
<?php
/**
* @file
* Contains \Drupal\system\Tests\Installer\InstallerTranslationMultipleLanguageForeignTest.
*/
namespace Drupal\system\Tests\Installer;
/**
* Tests translation files for multiple languages get imported during install.
*
* @group Installer
*/
class InstallerTranslationMultipleLanguageForeignTest extends InstallerTranslationMultipleLanguageTest {
/**
* Overrides the language code in which to install Drupal.
*
* @var string
*/
protected $langcode = 'de';
/**
* {@inheritdoc}
*/
protected function setUpLanguage() {
parent::setUpLanguage();
$this->translations['Save and continue'] = 'Save and continue German';
}
}
<?php
/**
* @file
* Contains \Drupal\system\Tests\Installer\InstallerTranslationMultipleLanguageTest.
*/
namespace Drupal\system\Tests\Installer;
use Drupal\simpletest\InstallerTestBase;
/**
* Tests translation files for multiple languages get imported during install.
*
* @group Installer
*/
class InstallerTranslationMultipleLanguageTest extends InstallerTestBase {
/**
* Switch to the multilingual testing profile
*
* @var string
*/
protected $profile = 'testing_multilingual';
/**
* {@inheritdoc}
*/
protected function setUpLanguage() {
// Place custom local translations in the translations directory.
mkdir(DRUPAL_ROOT . '/' . $this->siteDirectory . '/files/translations', 0777, TRUE);
file_put_contents(DRUPAL_ROOT . '/' . $this->siteDirectory . '/files/translations/drupal-8.0.0.de.po', "msgid \"\"\nmsgstr \"\"\nmsgid \"Save and continue\"\nmsgstr \"Save and continue German\"");
file_put_contents(DRUPAL_ROOT . '/' . $this->siteDirectory . '/files/translations/drupal-8.0.0.es.po', "msgid \"\"\nmsgstr \"\"\nmsgid \"Save and continue\"\nmsgstr \"Save and continue Spanish\"");
parent::setUpLanguage();
}
/**
* Tests that translations for each language were loaded.
*/
public function testTranslationsLoaded() {
// Verify German and Spanish were configured.
$this->drupalGet('admin/config/regional/language');
$this->assertText('German');
$this->assertText('Spanish');
// If the installer was English, we expect that configured also.
if ($this->langcode == 'en') {
$this->assertText('English');
}
// Verify the strings from the translation files were imported.
$edit = array();
$edit['langcode'] = 'de';
$edit['translation'] = 'translated';
$edit['string'] = 'Save and continue';
$this->drupalPostForm('admin/config/regional/translate', $edit, t('Filter'));
$this->assertText('Save and continue German');
$edit = array();
$edit['langcode'] = 'es';
$edit['translation'] = 'translated';
$edit['string'] = 'Save and continue';
$this->drupalPostForm('admin/config/regional/translate', $edit, t('Filter'));
$this->assertText('Save and continue Spanish');
}
}
id: de
label: German
direction: 0
weight: 0
locked: false
status: true
langcode: en
id: es
label: Spanish
direction: 0
weight: 0
locked: false
status: true
langcode: en
name: Testing multilingual
type: profile
description: 'Minimal profile for running tests with a multilingual installer.'
version: VERSION
core: 8.x
hidden: true
dependencies:
- locale
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