Problem/Motivation

Searching for an exact match of a specific text can be a huge pain if that string is part of a huge count of strings.

Translation overview at admin/config/regional/translate/translate searches like "string LIKE %foo%".

Proposed resolution

KISS and change that behavior to search like "string LIKE foo" and let user add "%" if they really want wildcard matching.
Change form text accordingly.

Remaining tasks

None.

User interface changes

Minor string change.
Searching substrings needs explicit wildcards.
Using unescaped wildcards will give no surprise as e.g. "50% Probability" will still match "50% Probability" (amongst others).

API changes

None.

Comments

geek-merlin’s picture

Version: 8.x-dev » 7.x-dev
Status: Active » Needs review

Patch flying in. D7 for now.

geek-merlin’s picture

StatusFileSize
new2.44 KB

Now really.

geek-merlin’s picture

Version: 7.x-dev » 8.x-dev
StatusFileSize
new1.9 KB

Patch flying in: D8

geek-merlin’s picture

Status: Needs review » Needs work

Hups, % is still escaped.
* "Leave blank to show all strings." is a lie now.
* Use % as default search string.

Will work later on this.

The last submitted patch, 2: drupal-7.x-2269503-1.patch, failed testing.

The last submitted patch, 3: drupal-8.x-2269503-3.patch, failed testing.

geek-merlin’s picture

Version: 8.x-dev » 7.x-dev
Issue summary: View changes
Status: Needs work » Needs review
StatusFileSize
new3.43 KB

Again first 7.x

geek-merlin’s picture

StatusFileSize
new3.63 KB

Small improvements and fixed tests.

geek-merlin’s picture

Version: 7.x-dev » 8.x-dev
StatusFileSize
new5.68 KB

Same for 8.x

geek-merlin’s picture

Issue summary: View changes

Simplytested both patches. Translating is now fun again!!

+++ b/core/modules/locale/lib/Drupal/locale/Form/TranslateFormBase.php
@@ -178,9 +178,9 @@ protected function translateFilters() {
+      'description' => $this->t('Use "_" to match any character, "%" to match any number of characters. Use "\_" for"_", "\%" for "%". The search is case sensitive.'),

I'm not too proud of this help string. Improvement appreciated.

Status: Needs review » Needs work

The last submitted patch, 9: drupal-8.x-2269503-9.patch, failed testing.

geek-merlin’s picture

Status: Needs work » Needs review
StatusFileSize
new5.63 KB

Fixed last test. Hopefully.

geek-merlin’s picture

Component: translation.module » locale.module
nicrodgers’s picture

This seems like a step backwards in UX to me, as you're optimising for a use-case that's not very common. The net result is more complexity for the majority of users and searches.

An alternative would be to leave the existing search as-is, and create an Advanced Search page (maybe as part of a new contrib module?) with additional options for searching in a variety of ways.

geek-merlin’s picture

#14: Good point.

Of course it would be even better to have advanced search options in core ;-).

Version: 8.0.x-dev » 8.1.x-dev

Drupal 8.0.6 was released on April 6 and is the final bugfix release for the Drupal 8.0.x series. Drupal 8.0.x will not receive any further development aside from security fixes. Drupal 8.1.0-rc1 is now available and sites should prepare to update to 8.1.0.

Bug reports should be targeted against the 8.1.x-dev branch from now on, and new development or disruptive changes should be targeted against the 8.2.x-dev branch. For more information see the Drupal 8 minor version schedule and the Allowed changes during the Drupal 8 release cycle.

Version: 8.1.x-dev » 8.2.x-dev

Drupal 8.1.9 was released on September 7 and is the final bugfix release for the Drupal 8.1.x series. Drupal 8.1.x will not receive any further development aside from security fixes. Drupal 8.2.0-rc1 is now available and sites should prepare to upgrade to 8.2.0.

Bug reports should be targeted against the 8.2.x-dev branch from now on, and new development or disruptive changes should be targeted against the 8.3.x-dev branch. For more information see the Drupal 8 minor version schedule and the Allowed changes during the Drupal 8 release cycle.

Version: 8.2.x-dev » 8.3.x-dev

Drupal 8.2.6 was released on February 1, 2017 and is the final full bugfix release for the Drupal 8.2.x series. Drupal 8.2.x will not receive any further development aside from critical and security fixes. Sites should prepare to update to 8.3.0 on April 5, 2017. (Drupal 8.3.0-alpha1 is available for testing.)

Bug reports should be targeted against the 8.3.x-dev branch from now on, and new development or disruptive changes should be targeted against the 8.4.x-dev branch. For more information see the Drupal 8 minor version schedule and the Allowed changes during the Drupal 8 release cycle.

Version: 8.3.x-dev » 8.4.x-dev

Drupal 8.3.6 was released on August 2, 2017 and is the final full bugfix release for the Drupal 8.3.x series. Drupal 8.3.x will not receive any further development aside from critical and security fixes. Sites should prepare to update to 8.4.0 on October 4, 2017. (Drupal 8.4.0-alpha1 is available for testing.)

Bug reports should be targeted against the 8.4.x-dev branch from now on, and new development or disruptive changes should be targeted against the 8.5.x-dev branch. For more information see the Drupal 8 minor version schedule and the Allowed changes during the Drupal 8 release cycle.

Version: 8.4.x-dev » 8.5.x-dev

Drupal 8.4.4 was released on January 3, 2018 and is the final full bugfix release for the Drupal 8.4.x series. Drupal 8.4.x will not receive any further development aside from critical and security fixes. Sites should prepare to update to 8.5.0 on March 7, 2018. (Drupal 8.5.0-alpha1 is available for testing.)

Bug reports should be targeted against the 8.5.x-dev branch from now on, and new development or disruptive changes should be targeted against the 8.6.x-dev branch. For more information see the Drupal 8 minor version schedule and the Allowed changes during the Drupal 8 release cycle.

Version: 8.5.x-dev » 8.6.x-dev

Drupal 8.5.6 was released on August 1, 2018 and is the final bugfix release for the Drupal 8.5.x series. Drupal 8.5.x will not receive any further development aside from security fixes. Sites should prepare to update to 8.6.0 on September 5, 2018. (Drupal 8.6.0-rc1 is available for testing.)

Bug reports should be targeted against the 8.6.x-dev branch from now on, and new development or disruptive changes should be targeted against the 8.7.x-dev branch. For more information see the Drupal 8 minor version schedule and the Allowed changes during the Drupal 8 release cycle.

Version: 8.6.x-dev » 8.8.x-dev

Drupal 8.6.x will not receive any further development aside from security fixes. Bug reports should be targeted against the 8.8.x-dev branch from now on, and new development or disruptive changes should be targeted against the 8.9.x-dev branch. For more information see the Drupal 8 and 9 minor version schedule and the Allowed changes during the Drupal 8 and 9 release cycles.

Version: 8.8.x-dev » 8.9.x-dev

Drupal 8.8.7 was released on June 3, 2020 and is the final full bugfix release for the Drupal 8.8.x series. Drupal 8.8.x will not receive any further development aside from security fixes. Sites should prepare to update to Drupal 8.9.0 or Drupal 9.0.0 for ongoing support.

Bug reports should be targeted against the 8.9.x-dev branch from now on, and new development or disruptive changes should be targeted against the 9.1.x-dev branch. For more information see the Drupal 8 and 9 minor version schedule and the Allowed changes during the Drupal 8 and 9 release cycles.

Version: 8.9.x-dev » 9.2.x-dev

Drupal 8 is end-of-life as of November 17, 2021. There will not be further changes made to Drupal 8. Bugfixes are now made to the 9.3.x and higher branches only. For more information see the Drupal core minor version schedule and the Allowed changes during the Drupal core release cycle.

Version: 9.2.x-dev » 9.3.x-dev

Version: 9.3.x-dev » 9.4.x-dev

Drupal 9.3.15 was released on June 1st, 2022 and is the final full bugfix release for the Drupal 9.3.x series. Drupal 9.3.x will not receive any further development aside from security fixes. Drupal 9 bug reports should be targeted for the 9.4.x-dev branch from now on, and new development or disruptive changes should be targeted for the 9.5.x-dev branch. For more information see the Drupal core minor version schedule and the Allowed changes during the Drupal core release cycle.

smustgrave’s picture

Status: Needs review » Postponed
Issue tags: +Needs subsystem maintainer review

Postponing for a subsystem maintainer to take a look and give their thought.

geek-merlin’s picture

Title: Translation overview page: Allow exact match » Translation overview page: Allow exact match (or better, anchoring at start or end)

Looking at it today, i see a different, backward.compatible way to implement this:
"You can use '^' / '$' to anchor the search at the start / end of the string, respectively."

Version: 9.4.x-dev » 9.5.x-dev

Drupal 9.4.9 was released on December 7, 2022 and is the final full bugfix release for the Drupal 9.4.x series. Drupal 9.4.x will not receive any further development aside from security fixes. Drupal 9 bug reports should be targeted for the 9.5.x-dev branch from now on, and new development or disruptive changes should be targeted for the 10.1.x-dev branch. For more information see the Drupal core minor version schedule and the Allowed changes during the Drupal core release cycle.

Version: 9.5.x-dev » 11.x-dev

Drupal core is moving towards using a “main” branch. As an interim step, a new 11.x branch has been opened, as Drupal.org infrastructure cannot currently fully support a branch named main. New developments and disruptive changes should now be targeted for the 11.x branch. For more information, see the Drupal core minor version schedule and the Allowed changes during the Drupal core release cycle.

anybody’s picture

Still valid and has no subsystem maintaner review 3y later ... ;)

Version: 11.x-dev » main

Drupal core is now using the main branch as the primary development branch. New developments and disruptive changes should now be targeted to the main branch.

Read more in the announcement.