diff --git a/core/modules/locale/locale.batch.inc b/core/modules/locale/locale.batch.inc index 13f0cce..fade172 100644 --- a/core/modules/locale/locale.batch.inc +++ b/core/modules/locale/locale.batch.inc @@ -302,4 +302,4 @@ function locale_translation_download_source($source_file, $directory = 'temporar } \Drupal::logger('locale')->error('Unable to download translation file @uri.', ['@uri' => $source_file->uri]); return FALSE; -} \ No newline at end of file +} diff --git a/core/modules/locale/tests/src/Functional/Update/OldPluralUpdateTest.php b/core/modules/locale/tests/src/Functional/Update/OldPluralUpdateTest.php new file mode 100644 index 0000000..db8067a --- /dev/null +++ b/core/modules/locale/tests/src/Functional/Update/OldPluralUpdateTest.php @@ -0,0 +1,54 @@ +databaseDumpFiles = [ + __DIR__ . '/../../../../../system/tests/fixtures/update/drupal-8.filled.standard.php.gz', + ]; + } + + /** + * Tests language_post_update_language_select_widget(). + */ + public function testOldPluralUpdatePath() { + ConfigurableLanguage::createFromLangcode('ru')->save(); + $storage = \Drupal::service('locale.storage'); + + $string = $storage->createString([ + 'source' => "1 old plural test" . PluralTranslatableMarkup::DELIMITER . "@count old plural tests" + ])->save(); + + $storage->createTranslation([ + 'lid' => $string->lid, + 'language' => 'ru', + 'translation' => "test 0" . PluralTranslatableMarkup::DELIMITER . "@count test1" . PluralTranslatableMarkup::DELIMITER . "@count[2] test2", + ])->save(); + + // Tests before the update. + $translation = $storage->getTranslations(['language' => 'ru', 'lid' => $string->lid])[0]; + $this->assertContains('@count[2]', $translation->getString()); + + // Run the update. + $this->runUpdates(); + + // Tests after the update. + $translation = $storage->getTranslations(['language' => 'ru', 'lid' => $string->lid])[0]; + $this->assertNotContains('@count[2]', $translation->getString()); + } + +}