Update to Drupal 8.0.6. For more information, see https://www.drupal.org/drupal-8.0.6-release-notes
This commit is contained in:
parent
4297c64508
commit
b11a755ba8
159 changed files with 2340 additions and 543 deletions
|
@ -472,7 +472,7 @@ class ConfigurableLanguageManager extends LanguageManager implements Configurabl
|
|||
}
|
||||
$predefined[$key] = new TranslatableMarkup($value[0]);
|
||||
}
|
||||
asort($predefined);
|
||||
natcasesort($predefined);
|
||||
return $predefined;
|
||||
}
|
||||
|
||||
|
|
|
@ -24,6 +24,7 @@ use Drupal\language\ContentLanguageSettingsInterface;
|
|||
* entity_keys = {
|
||||
* "id" = "id"
|
||||
* },
|
||||
* list_cache_tags = { "rendered" }
|
||||
* )
|
||||
*/
|
||||
class ContentLanguageSettings extends ConfigEntityBase implements ContentLanguageSettingsInterface {
|
||||
|
|
|
@ -61,7 +61,7 @@ class LanguageListBuilder extends DraggableListBuilder {
|
|||
* @param \Drupal\Core\Entity\EntityTypeInterface $entity_type
|
||||
* The entity type definition.
|
||||
* @param \Drupal\Core\Entity\EntityStorageInterface $storage
|
||||
* The entity storage controller class.
|
||||
* The entity storage handler class.
|
||||
* @param \Drupal\Core\Language\LanguageManagerInterface $language_manager
|
||||
* The language manager.
|
||||
* @param \Drupal\Core\Config\ConfigFactoryInterface $config_factory
|
||||
|
|
79
core/modules/language/src/Tests/LanguageLocaleListTest.php
Normal file
79
core/modules/language/src/Tests/LanguageLocaleListTest.php
Normal file
|
@ -0,0 +1,79 @@
|
|||
<?php
|
||||
|
||||
/**
|
||||
* @file
|
||||
* Contains \Drupal\language\Tests\LanguageListTest.
|
||||
*/
|
||||
|
||||
namespace Drupal\language\Tests;
|
||||
|
||||
use Drupal\simpletest\WebTestBase;
|
||||
use Drupal\Core\Language\Language;
|
||||
use Drupal\Core\Language\LanguageInterface;
|
||||
|
||||
/**
|
||||
* Adds a new language with translations and tests language list order.
|
||||
*
|
||||
* @group language
|
||||
*/
|
||||
class LanguageLocaleListTest extends WebTestBase {
|
||||
|
||||
/**
|
||||
* Modules to enable.
|
||||
*
|
||||
* @var array
|
||||
*/
|
||||
public static $modules = array('language', 'locale');
|
||||
|
||||
/**
|
||||
* {@inheritdoc}
|
||||
*/
|
||||
protected function setUp() {
|
||||
parent::setUp();
|
||||
// Add a default locale storage for all these tests.
|
||||
$this->storage = $this->container->get('locale.storage');
|
||||
}
|
||||
|
||||
/**
|
||||
* Tests adding, editing, and deleting languages.
|
||||
*/
|
||||
function testLanguageLocaleList() {
|
||||
// User to add and remove language.
|
||||
$admin_user = $this->drupalCreateUser(array('administer languages', 'access administration pages'));
|
||||
$this->drupalLogin($admin_user);
|
||||
|
||||
// Add predefined language.
|
||||
$edit = array(
|
||||
'predefined_langcode' => 'fr',
|
||||
);
|
||||
$this->drupalPostForm('admin/config/regional/language/add', $edit, t('Add language'));
|
||||
$this->assertText('The language French has been created and can now be used');
|
||||
$this->assertUrl(\Drupal::url('entity.configurable_language.collection', [], ['absolute' => TRUE]));
|
||||
$this->rebuildContainer();
|
||||
|
||||
// Translate Spanish language to French (Espagnol).
|
||||
$source = $this->storage->createString(array(
|
||||
'source' => 'Spanish',
|
||||
'context' => '',
|
||||
))->save();
|
||||
$this->storage->createTranslation(array(
|
||||
'lid' => $source->lid,
|
||||
'language' => 'fr',
|
||||
'translation' => 'Espagnol',
|
||||
))->save();
|
||||
|
||||
// Get language list displayed in select list.
|
||||
$this->drupalGet('fr/admin/config/regional/language/add');
|
||||
$select = $this->xpath('//select[@id="edit-predefined-langcode"]');
|
||||
$select_element = (array) end($select);
|
||||
$options = $select_element['option'];
|
||||
// Remove the 'Custom language...' option form the end.
|
||||
array_pop($options);
|
||||
// Order language list.
|
||||
$options_ordered = $options;
|
||||
natcasesort($options_ordered);
|
||||
|
||||
// Check the language list displayed is ordered.
|
||||
$this->assertTrue($options === $options_ordered, 'Language list is ordered.');
|
||||
}
|
||||
}
|
Reference in a new issue