As a Spanish user viewing the English version of Wikipedia
I want to switch to the French version in my local language via typing francés which currently matches no results
so that I save time by not being required to remember that I need to search for it as "francais" or "french".
Related: T139799
# More detail
Do this in beta first, ensuring that it's possible to later move this to stable.
Ideally, in addition to searching in your current language (T139799), I should be able to search in any langauge: "Francés" (spanish version), "Französisch" (german version), etc. This is currently possible using the [[ https://www.mediawiki.org/wiki/Extension:UniversalLanguageSelector | Universal language selector ]] and I believe they are simply using the action api: action=languagesearch to do so.
While a search request is pending, do not modify the result list. Only upon response modify the list.
##Technical details
Change [[ https://github.com/wikimedia/mediawiki-extensions-MobileFrontend/blob/master/resources/mobile.languages.structured/LanguageOverlay.js#L131-L149 | client side filtering ]] to:
1. API query example: https://en.wikipedia.org/w/api.php?action=languagesearch&format=json&search=aleman
1. After that, match the language codes with the ones we have on the client to show the relevant results
##AC
[] Searching for "aleman" in an english wiki with english language browser will show "German" in the list of languages.
[] While searching there's an unobtrusive loading indicator as showed in the mocks after 2 seconds of loading time.
[] If the api query fails, there is an error message shown as specified in the mocks ```TBD``` @nirzar.
[] If the api query takes too long (10s for example), it should timeout and there should be an error message shown as specified in the mocks.
[] If there are concurrent searches the results shown will be the ones of the last query issued. Previous old queries will be dismissed if they arrive later.
[] Search API querying (input changes) is debounced to avoid excessive network calls.
[] Unit and browser tests are adapted to the new behavior.
[] Existing event logging behaviour is unchanged
[] Event logging is updated to include `languagesearch` API request errors
==Final mocks
**Initial state**
{F4261680}
**Successful search (results before 2 seconds)** //we don't want to show flickering spinner//
{F4261679}
**If the api takes more than 2 seconds to return, then only we show the spinner**
{F4261684}
//Notice the list is unaffected while the query is taking more than 2 seconds.//
**After 10s waiting (timeout), show error state:**
{F4292645}
**Both:**
* I searched for a language that does not exist at all on wikipedia
* I searched for a language that does exist on wikipedia but this article does not exist in that language
{F4292642}
Suggested testing, RTL+LTR, landscape+portrait:
[] Android 2.3 Browser phone form factor
[] Android 4.x or higher Chrome phone form factor
[] Android 4.x or higher Chrome tablet form factor
[] iOS 9.3 iPhone Safari
[] iOS 9.3 iPad Safari
[] Opera Mini non-compressed (not extreme mode) Android 4.x or higher phone form factor
[] UC browser (not mini with compression) Android 4.x or higher phone form factor
[] Windows 7.5+ Phone IE
[] Desktop Firefox
[] Desktop Chrome
[] Desktop Safari
[] Internet Explorer 11
[] Edge