diff --git a/core/modules/locale/locale.install b/core/modules/locale/locale.install index 11d1873..acf3a80 100644 --- a/core/modules/locale/locale.install +++ b/core/modules/locale/locale.install @@ -386,6 +386,7 @@ function locale_update_8005() { } $plural_lids = array_unique($plural_lids); + if (!empty($plural_lids)) { // Look up all translations for these source strings. Ordering by language // will group the strings by language, the 'plid' order will get the // strings in singular/plural order and 'plural' will get them in precise @@ -468,6 +469,7 @@ function locale_update_8005() { db_delete('locales_target') ->condition('lid', $remove_lids, 'IN') ->execute(); + } // Drop the primary key because it contains 'plural'. db_drop_primary_key('locales_target'); diff --git a/core/modules/simpletest/tests/upgrade/upgrade.language.test b/core/modules/simpletest/tests/upgrade/upgrade.language.test index ecbbd12..ae7dd8f 100644 --- a/core/modules/simpletest/tests/upgrade/upgrade.language.test +++ b/core/modules/simpletest/tests/upgrade/upgrade.language.test @@ -136,4 +136,18 @@ class LanguageUpgradePathTestCase extends UpgradePathTestCase { $domains = locale_language_negotiation_url_domains(); $this->assertTrue($domains['ca'] == $language_domain, t('Language domain for Catalan properly upgraded.')); } + + /** + * Tests upgrading translations without plurals. + */ + public function testLanguageNoPluralsUpgrade() { + // Remove all plural translations from the database. + db_delete('locales_target')->condition('plural', 0, '<>')->execute(); + + $this->assertTrue($this->performUpgrade(), t('The upgrade was completed successfully.')); + + // Check if locale_update_8005 is succesfully completed by checking whether + // index 'plural' has been removed. + $this->assertFalse(db_index_exists('locales_target', 'plural'), t('Translations without plurals upgraded.')); + } }