The language-data library currently provides getLanguagesInTerritory, but the API does not expose a way to retrieve the full list of supported territories. As a result, consumers cannot easily discover all territories and the languages associated with them.
We should add a method that returns territory-based language information, including a way to enumerate all available territories. This should be implemented in both the PHP and JavaScript APIs.
After this change is completed, we should publish a new release of the language-data library.
Relevant existing API: LanguageUtil::getLanguagesInTerritory
Acceptance criteria
- A new API method is added to the library to return the list of supported territories.
- The new functionality is available in both the PHP and JavaScript APIs.
- The public documentation is updated:
- https://language-data.readthedocs.io/en/latest/api/languagedata/languageutil.html#LanguageUtil::getTerritoriesWithLanguages
- Existing API behavior remains unchanged.
- A new library release is created after the change is merged.
QA plan
- Use this code in the new content language selector
- https://gerrit.wikimedia.org/r/c/mediawiki/extensions/UniversalLanguageSelector/+/1271003
- Confirm docs are correct