Unverified Commit 9719c35a authored by larowlan's avatar larowlan Committed by alexpott

Issue #3179258 by julien, paulocs: Spaces before or after a string searched to...

Issue #3179258 by julien, paulocs: Spaces before or after a string searched to be translated returns nothing

(cherry picked from commit d598f541)
parent 090a1cf0
...@@ -85,7 +85,7 @@ public function submitForm(array &$form, FormStateInterface $form_state) { ...@@ -85,7 +85,7 @@ public function submitForm(array &$form, FormStateInterface $form_state) {
$filters = $this->translateFilters(); $filters = $this->translateFilters();
foreach ($filters as $name => $filter) { foreach ($filters as $name => $filter) {
if ($form_state->hasValue($name)) { 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'); $form_state->setRedirect('locale.translate_page');
......
...@@ -81,10 +81,13 @@ public function testStringTranslation() { ...@@ -81,10 +81,13 @@ public function testStringTranslation() {
$this->assertText($name, 'Test language added.'); $this->assertText($name, 'Test language added.');
$this->drupalLogout(); $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. // Search for the name and translate it.
$this->drupalLogin($translate_user); $this->drupalLogin($translate_user);
$search = [ $search = [
'string' => $name, 'string' => $name_ws,
'langcode' => $langcode, 'langcode' => $langcode,
'translation' => 'untranslated', 'translation' => 'untranslated',
]; ];
......
Markdown is supported
0% or .
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment