An urgent use case is the need to call LanguageConverter::findVariantLink() to do proper title existence check.
Version: unspecified
Severity: normal
liangent | |
Apr 26 2013, 11:44 AM |
F28662700: 0001-Add-handler-for-Language-findVariantLink.patch | |
Apr 15 2019, 2:14 PM |
F28662696: 0001-Add-handler-for-Language-findVariantLink.patch | |
Apr 15 2019, 2:12 PM |
An urgent use case is the need to call LanguageConverter::findVariantLink() to do proper title existence check.
Version: unspecified
Severity: normal
Subject | Repo | Branch | Lines +/- | |
---|---|---|---|---|
Introduce mw.langconv to Scribunto | mediawiki/extensions/Scribunto | master | +450 -2 |
Status | Subtype | Assigned | Task | ||
---|---|---|---|---|---|
Open | Feature | None | T50176 Requested Scribunto/Lua built-in methods/functions (tracking) | ||
Open | Feature | None | T302718 Support language conversion in Scribunto | ||
Open | None | T49725 Implement Lua interface / Scribunto Lua library for Language Converter | |||
Open | None | T243326 Rename ILanguageInterface::convert function to eliminate ambiguity |
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:
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.
Removing Patch-For-Review as the patch isn't properly posted to Gerrit, which needs to be done for it to get reviewed.
Change #1104273 had a related patch set uploaded (by Gerrit Patch Uploader; author: SunAfterRain):
[mediawiki/extensions/Scribunto@master] [WIP] Introduce mw.langconv to Scribunto Added mw.langconv interface to expose some methods of LanguageConverter and LanguageConverterFactory to Scribunto