Context
A localized language name is the name of the language written in a different language. For example if the user language is english, then the localized name for he would be "hebrew". CLDR is the tool extension used in MediaWiki. The language-data library we are now using does not include localized names, but the native https://developer.mozilla.org/en-US/docs/Web/JavaScript/Reference/Global_Objects/Intl/DisplayNames can be useful for us in this case.
Desired outcome
What's desired is for a user to be able to search for languages in the plugin language selector using localized strings (see T287146). That is, if the current user language is english, then typing "hebrew" should render language he; if user langauge is spanish, then "hebreo" should render re
Possible approach
We explored a solution using Intl.DisplayNames here: https://github.com/wikimedia/wikipediapreview-wordpress/tree/intl. However a try/catch especially in a loop is very inefficient, it’s better to detect if the feature exists and pick a code path that doesn’t try to use it when it doesn’t. Also this will likely not work for IE or older browsers