WordPress / wp20.wordpress.net

Celebrating 20 years of WordPress
5 stars 1 forks source link

Add locale search by English name #96

Open iandunn opened 1 year ago

iandunn commented 1 year ago

A search for 日本語 will return the correct result, but a search for Japanese won't.

https://github.com/alphagov/accessible-autocomplete/#templates-default-undefined

https://alphagov.github.io/accessible-autocomplete/examples/

We should be able to get the data from GlotPress' locales.php. It will need to be escaped, see the caution in the autocomplete readme. Maybe using Gutenberg's escape-html package. IIRC there's also wp.utils.sanitize().

An alternative to using templates could be to just put the alternative name in the raw data before passing it to JS. It'd only need to be added if the two aren't identical.

Related: #93