diff --git a/core/modules/locale/src/Form/TranslateFilterForm.php b/core/modules/locale/src/Form/TranslateFilterForm.php index cfa3b696e8e7800db7a8c6aac3d294f695bcf98d..f7a3d20ec1134bb59a18b512b96ac59a723dbcae 100644 --- a/core/modules/locale/src/Form/TranslateFilterForm.php +++ b/core/modules/locale/src/Form/TranslateFilterForm.php @@ -85,7 +85,7 @@ public function submitForm(array &$form, FormStateInterface $form_state) { $filters = $this->translateFilters(); foreach ($filters as $name => $filter) { if ($form_state->hasValue($name)) { - $_SESSION['locale_translate_filter'][$name] = $form_state->getValue($name); + $_SESSION['locale_translate_filter'][$name] = trim($form_state->getValue($name)); } } $form_state->setRedirect('locale.translate_page'); diff --git a/core/modules/locale/tests/src/Functional/LocaleTranslationUiTest.php b/core/modules/locale/tests/src/Functional/LocaleTranslationUiTest.php index db2002db24e70c5606489c72e93319965d8a24e5..5dd2d33a0fba9ac3da05dc8f59c03410a47b6a00 100644 --- a/core/modules/locale/tests/src/Functional/LocaleTranslationUiTest.php +++ b/core/modules/locale/tests/src/Functional/LocaleTranslationUiTest.php @@ -81,10 +81,13 @@ public function testStringTranslation() { $this->assertText($name, 'Test language added.'); $this->drupalLogout(); + // Add a whitespace at the end of string to ensure it is found. + $name_ws = $name . " "; + // Search for the name and translate it. $this->drupalLogin($translate_user); $search = [ - 'string' => $name, + 'string' => $name_ws, 'langcode' => $langcode, 'translation' => 'untranslated', ];