diff --git a/core/modules/locale/locale.translation.js b/core/modules/locale/locale.translation.js deleted file mode 100644 index 6d611a0..0000000 --- a/core/modules/locale/locale.translation.js +++ /dev/null @@ -1 +0,0 @@ -// This file is a placeholder and dynamically replaced in locale_js_alter(). diff --git a/core/modules/locale/src/Tests/LocaleJavascriptTranslationTest.php b/core/modules/locale/src/Tests/LocaleJavascriptTranslationTest.php index 3f2852d..e8b9412 100644 --- a/core/modules/locale/src/Tests/LocaleJavascriptTranslationTest.php +++ b/core/modules/locale/src/Tests/LocaleJavascriptTranslationTest.php @@ -96,7 +96,7 @@ public function testFileParsing() { } /** - * Ensure that the translations js is added after its dependencies. + * Assert translations JS is added before drupal.js, because it depends on it. */ public function testLocaleTranslationJsDependencies() { // User to add and remove language. @@ -126,7 +126,7 @@ public function testLocaleTranslationJsDependencies() { // the next translation. $this->drupalGet($prefix . '/admin/config/regional/translate'); - // Translate a string in locale.admin.js to langcode. + // Translate a string in locale.admin.js to our new language. $strings = \Drupal::service('locale.storage') ->getStrings(array( 'source' => 'Show description', @@ -135,20 +135,15 @@ public function testLocaleTranslationJsDependencies() { )); $string = $strings[0]; - // Translate a string. $this->drupalPostForm(NULL, ['string' => 'Show description'], t('Filter')); $edit = ['strings[' . $string->lid . '][translations][0]' => $this->randomString(16)]; $this->drupalPostForm(NULL, $edit, t('Save translations')); - // Loading the Translate page should refresh the translations js and import - // the sources. - $this->drupalGet($prefix . '/admin/config/regional/translate'); - - // We need the generated hash in the js filename. + // Calculate the filename of the JS including the translations. $js_translation_files = \Drupal::state()->get('locale.translation.javascript'); $js_filename = $prefix . '_' . $js_translation_files[$prefix] . '.js'; - // Assert translations js is included before drupal.js. + // Assert translations JS is included before drupal.js. $this->assertTrue(strpos($this->content, $js_filename) < strpos($this->content, 'core/misc/drupal.js'), 'Translations are included before Drupal.t.'); }