Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Add lodash deburr to autocomplete so that is works with diacritics #10770

Conversation

brentswisher
Copy link
Contributor

Description

Added lodash's deburr function to the autocomplete so that when searching in a language that has diacritics it will find them both with and without the diacrytic. For example now both "/U" and "/Ü" will find the "Überschrift" block in the German language.

How has this been tested?

Type /U and /Ü and verify that they both return the expected result block in the German Language. FIxes #10489

Screenshots

beitrag_bearbeiten_ gutenberg_dev _wordpress

Types of changes

Bug fix (non-breaking change which fixes an issue)

Checklist:

  • My code is tested.
  • My code follows the WordPress code style.
  • My code follows the accessibility standards.
  • My code has proper inline documentation.

@brentswisher
Copy link
Contributor Author

Updated to also deburr the keywords when comparing them, closes #10771 which was really the same issue all along. Thanks to @Soean for pointing it out.

@chrisvanpatten
Copy link
Member

Do we have any e2e tests that could cover this change, either in this PR or a follow-up PR?

@chrisvanpatten chrisvanpatten added [Type] Enhancement A suggestion for improvement. [Feature] Inserter The main way to insert blocks using the + button in the editing interface labels Oct 19, 2018
@brentswisher
Copy link
Contributor Author

I'm pretty new to working on Gutenberg so I'm not too familiar with the e2e tests, but I will try to look into it and add one this week if I can.

@mcsf mcsf added the Internationalization (i18n) Issues or PRs related to internationalization efforts label Oct 22, 2018
@mcsf mcsf added this to the 4.2 milestone Oct 22, 2018
@youknowriad
Copy link
Contributor

This could also be just a unit test, I think.

@brentswisher
Copy link
Contributor Author

Hmm, so I had hoped there would be some existing unit tests for the autocomplete component that I could work off of, but I'm not seeing any. I spent some time on this, but I'm afraid that creating these tests might be a bit beyond me at this point.

I could get the autocomplete component loaded in with a completer and verify the options were set in the AutoCompleter component, but I couldn't figure out interacting with it to generate a list of the options bosed on input, unless someone could point me in the right direction?

@youknowriad
Copy link
Contributor

@brentswisher It's fine we can get it in without tests or someone else could chime in.

Copy link
Contributor

@youknowriad youknowriad left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Too bad it works only for latin languages though.

I can't search for صُورَ to get the image block for instance in arabic.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
[Feature] Inserter The main way to insert blocks using the + button in the editing interface Internationalization (i18n) Issues or PRs related to internationalization efforts [Type] Enhancement A suggestion for improvement.
Projects
None yet
Development

Successfully merging this pull request may close these issues.

Slash inserter: Block names with Umlaut (Ü, Ä, Ö, ...)
4 participants