Page MenuHomePhabricator

Migrate LanguageSearch API endpoint to MediaWiki core
Open, In Progress, HighPublic8 Estimated Story Points

Description

The LanguageSearch API currently resides inside the ULS extension, along with all the related code base

As part of rewriting ULS, and including it within MediaWiki/Codex (TBD), we want to move this APIs to MediaWiki core.

The following classes have to be moved:

  1. ApiLanguageSearch
  2. LanguageNameSearch
  3. LanguageNameIndexer - Maintenance script to read cldr data and generate the LanguageNameSearchData
  4. LanguageNameSearchData - Data file generated by LanguageNameIndexer

We should ensure that the current consumers are not affected by this migration.

Things to decide:

  • Whether the new LanguageSearch API should be an Action API or a REST API

Decision: We've decided to stick with Action API for backward compatibility and to limit the scope of the work.

  • The LanguageNameIndexer maintenance script relies on CLDR extension's data to generate the LanguageNameSearchData. Moving the script to MediaWiki would cause it to become dependent on the CLDR extension.

Decision: The dependency on CLDR is acceptable for now. It's mostly us devs who will run this script periodically. There isn't really any point running the script without it.

Event Timeline

We can move the following files to a new namespace MediaWiki\Language\Data;

  1. LanguageNameSearch.php
  2. LanguageNameIndexer.php

These files require some modernization to use PSR-4 autoloading which can be done in a subsequent patch.

I'm inclined to move them to the existing namespace MediaWiki\Language;.

The LanguageNameIndexer is a maintenance script so it should be updated accordingly. The file name should follow the conventions from MediaWiki core.

Change #1201598 had a related patch set uploaded (by Wangombe; author: Wangombe):

[mediawiki/core@master] LanguageSearch API: Migrate to MediaWiki core !WIP! * Add LanguageNameSearch to MediaWikiServices * Move ApiLanguageSearch from ULS to Core. This is now accessible as an 'action': api.php?action=help&modules=languagesearch

https://gerrit.wikimedia.org/r/1201598

Change #1201602 had a related patch set uploaded (by Wangombe; author: Wangombe):

[mediawiki/extensions/UniversalLanguageSelector@master] ApiLanguageSearch: Move to MediaWiki Core

https://gerrit.wikimedia.org/r/1201602

Here's a screenshot of the ApiLanguageSearch move

image.png (747×1 px, 110 KB)

image.png (1×1 px, 269 KB)

Nikerabbit raised the priority of this task from Medium to High.
Nikerabbit moved this task from Backlog to In Progress on the LPL Essential (FY2025-26 Q2) board.
Nikerabbit changed the task status from Open to In Progress.Nov 6 2025, 7:41 AM

The LanguageNameIndexer maintenance script relies on CLDR extension's data to generate the LangaugeNameSearchData. Moving the script to MediaWiki would cause it to become dependent on the CLDR extension.

See: T281067: merge CLDR extension to core

Change #1207254 had a related patch set uploaded (by Wangombe; author: Wangombe):

[mediawiki/extensions/UniversalLanguageSelector@master] Move ULS messages to a seperate folder

https://gerrit.wikimedia.org/r/1207254

Change #1201598 abandoned by Wangombe:

[mediawiki/core@master] LanguageSearch API: Migrate to MediaWiki core

Reason:

In favor of Idafbbbf54a1450608d7622aed299cd583c70138d

https://gerrit.wikimedia.org/r/1201598

Change #1201598 restored by Wangombe:

[mediawiki/core@master] LanguageSearch API: Migrate to MediaWiki core

https://gerrit.wikimedia.org/r/1201598

Whether the new LangaugeSearch API should be an Action API or a REST API

If the new API is not compatible with old one then it will break jquery.uls users.

Change #1212142 had a related patch set uploaded (by Wangombe; author: Wangombe):

[mediawiki/core@master] languageNameIndexer script: Refactor to use StaticArrayWriter

https://gerrit.wikimedia.org/r/1212142

We've decided to stick with Action API for backward compatibility and to limit the scope of the work.

Change #1201602 merged by jenkins-bot:

[mediawiki/extensions/UniversalLanguageSelector@master] ApiLanguageSearch: Move to MediaWiki Core

https://gerrit.wikimedia.org/r/1201602

Change #1207254 merged by jenkins-bot:

[mediawiki/extensions/UniversalLanguageSelector@master] Move ULS messages to a separate folder

https://gerrit.wikimedia.org/r/1207254

Change #1201598 merged by jenkins-bot:

[mediawiki/core@master] LanguageSearch API: Migrate to MediaWiki core

https://gerrit.wikimedia.org/r/1201598

The changes are now live on translatewiki.net

Change #1218237 had a related patch set uploaded (by Mvolz; author: Wangombe):

[mediawiki/core@master] LanguageSearchAPI: Add type declarations and strict types

https://gerrit.wikimedia.org/r/1218237