Page MenuHomePhabricator

Implement Lua interface for Language Converter
Open, MediumPublic


An urgent use case is the need to call LanguageConverter::findVariantLink() to do proper title existence check.

Version: unspecified
Severity: normal



Event Timeline

bzimport raised the priority of this task from to Medium.Nov 22 2014, 1:42 AM
bzimport set Reference to bz47725.
bzimport added a subscriber: Unknown Object (MLST).

findVariantLink is also available as Language::findVariantLink(). Maybe it can be easily done with a few lines in mw.language.lua, but I'm not sure about this.

I was trying to introduce Wikidata-based annotated link to zh.wp the other day, and mw.wikibase.getEntityIdForTitle was not working too well for this exact reason. Anyone want to triage this task?

Looks like I need to:

  • find my developer account; relearn git
  • figure out We need to do Title:: anyways so there isn't too much a point
  • Pop a thing on the PHP end: includes/engines/LuaCommon/LanguageLibrary.php
  • Pop a thing on the Lua end: includes/engines/LuaCommon/lualib/mw.language.lua
  • Add tests: tests/phpunit/engines/LuaCommon/LanguageLibraryTests.{php,lua}

There we go, I guess. Simple as mw.language.findVariantLink(link : string) -> string.

…and on LC-enabled sites you are now supposed to replace all references to the title with mw.language.findVariantLink(title). Sounds legit as long as you only do it once and save up the result.