Page MenuHomePhabricator

Implement Lua interface / Scribunto Lua library 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 added a project: Scribunto.
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.

Pppery subscribed.

Removing Patch-For-Review as the patch isn't properly posted to Gerrit, which needs to be done for it to get reviewed.

We should no longer use mw.language (PHP class Language) for LanguageConverter.

This should be implemented as a separated library.

Proposed names:

  • mw.langconv
  • mw.languageconverter
  • (other proposals)
Winston_Sung renamed this task from Implement Lua interface for Language Converter to Implement Lua interface / Scribunto Lua library for Language Converter.Apr 12 2023, 4:01 PM
Winston_Sung added a subscriber: SunAfterRain.