From cfacbed7dac029ec05f26fdd1e0f7fd98f070a0c Mon Sep 17 00:00:00 2001 From: Lee Rowlands <lee.rowlands@previousnext.com.au> Date: Mon, 19 Feb 2024 07:16:53 +1000 Subject: [PATCH] Issue #2609256 by sleitner, rkoller, smustgrave, vegantriathlete, quietone, benjifisher, AaronMcHale, worldlinemine: Add warning message to import translations after enabling Interface Translation (cherry picked from commit 5a0ad9b6c017d238526c8cd0cac81230bc950e4b) --- core/modules/locale/locale.install | 6 +++ .../src/Functional/LocaleInstallTest.php | 47 +++++++++++++++++++ 2 files changed, 53 insertions(+) create mode 100644 core/modules/locale/tests/src/Functional/LocaleInstallTest.php diff --git a/core/modules/locale/locale.install b/core/modules/locale/locale.install index 97f4327face7..4c995841a644 100644 --- a/core/modules/locale/locale.install +++ b/core/modules/locale/locale.install @@ -21,6 +21,12 @@ function locale_install() { \Drupal::configFactory()->getEditable('locale.settings')->set('translation.path', $directory)->save(); } \Drupal::service('file_system')->prepareDirectory($directory, FileSystemInterface::CREATE_DIRECTORY | FileSystemInterface::MODIFY_PERMISSIONS); + + $t_args = [ + ':translate_status' => base_path() . 'admin/reports/translations/check?destination=' . urlencode(base_path() . 'admin/reports/translations'), + ]; + $message = t('Check <a href=":translate_status">available translations</a> for your language(s).', $t_args); + \Drupal::messenger()->addStatus($message); } /** diff --git a/core/modules/locale/tests/src/Functional/LocaleInstallTest.php b/core/modules/locale/tests/src/Functional/LocaleInstallTest.php new file mode 100644 index 000000000000..776509cbc3a2 --- /dev/null +++ b/core/modules/locale/tests/src/Functional/LocaleInstallTest.php @@ -0,0 +1,47 @@ +<?php + +declare(strict_types=1); +namespace Drupal\Tests\locale\Functional; + +use Drupal\Tests\BrowserTestBase; + +/** + * Test installation of Locale module. + * + * @group locale + */ +class LocaleInstallTest extends BrowserTestBase { + + /** + * {@inheritdoc} + */ + protected static $modules = [ + 'system', + 'file', + 'language', + ]; + + /** + * {@inheritdoc} + */ + protected $defaultTheme = 'stark'; + + /** + * Tests Locale install message. + */ + public function testLocaleInstallMessage(): void { + $admin_user = $this->drupalCreateUser([ + 'access administration pages', + 'administer modules', + ]); + $this->drupalLogin($admin_user); + + $edit = []; + $edit['modules[locale][enable]'] = 'locale'; + $this->drupalGet('admin/modules'); + $this->submitForm($edit, 'Install'); + + $this->assertSession()->statusMessageContains('available translations', 'status'); + } + +} -- GitLab