diff --git a/lib/Drupal/config_translation/Access/ConfigNameCheck.php b/lib/Drupal/config_translation/Access/ConfigNameCheck.php index 0ac08a9..b2d5138 100644 --- a/lib/Drupal/config_translation/Access/ConfigNameCheck.php +++ b/lib/Drupal/config_translation/Access/ConfigNameCheck.php @@ -31,7 +31,7 @@ class ConfigNameCheck implements AccessCheckInterface { $entity = $request->attributes->get($mapper->getType()); // Get configuration group for this mapper. $group = $mapper->getConfigGroup($entity); - $group_language = language_load($group->getLangcode()); + $group_language = $group->getLanguageWithFallback(); $langcode = $request->attributes->get('langcode'); $language = empty($langcode) ? NULL : language_load($langcode); @@ -39,8 +39,9 @@ class ConfigNameCheck implements AccessCheckInterface { // Only allow access to translate configuration, if proper permissions are // granted, the configuration has translatable pieces, the source language // and target language are not locked, and the target language is not the - // original submission language. Although technically config can be overlayed - // with translations in the same language, that is logically not a good idea. + // original submission language. Although technically config can be + // overlayed with translations in the same language, that is logically not + // a good idea. return ( user_access('translate configuration') && $group->hasSchema() && diff --git a/lib/Drupal/config_translation/Tests/ConfigTranslationUITest.php b/lib/Drupal/config_translation/Tests/ConfigTranslationUITest.php index 7e60fa3..8c36869 100644 --- a/lib/Drupal/config_translation/Tests/ConfigTranslationUITest.php +++ b/lib/Drupal/config_translation/Tests/ConfigTranslationUITest.php @@ -382,6 +382,31 @@ class ConfigTranslationUITest extends WebTestBase { } /** + * Test case for single language existing. + */ + function testSingleLanguageUI() { + // Delete French language + $this->drupalPost('admin/config/regional/language/delete/fr', array(), t('Delete')); + $this->assertRaw(t('The %language (%langcode) language has been removed.', array('%language' => 'French', '%langcode' => 'fr'))); + + // Change default language to Tamil. + $edit = array( + 'site_default_language' => 'ta', + ); + $this->drupalPost('admin/config/regional/settings', $edit, t('Save configuration')); + $this->assertRaw(t('The configuration options have been saved.')); + + // Delete English language + $this->drupalPost('admin/config/regional/language/delete/en', array(), t('Delete')); + $this->assertRaw(t('The %language (%langcode) language has been removed.', array('%language' => 'English', '%langcode' => 'en'))); + + // Visit account setting translation page, this should not + // throw any notices. + $this->drupalGet('admin/config/people/accounts/translate'); + $this->assertResponse(200); + } + + /** * Gets translation from locale storage. * * @param $config_name