Community Wishlist Survey 2021/Wiktionary/Something like Extension:Variables to simplify template calls

From Meta, a Wikimedia project coordination wiki

Something like Extension:Variables to simplify template calls

  • Who would benefit: The syntax of entries could be cleaner and more similar to the end result.
  • Proposed solution: This could be done with mw:Extension:Variables, but it is unavailable on Wikimedia. So… make it available or maybe develop a better extension of this kind?
  • More comments:
  • Phabricator tickets:
  • Proposer: PiotrekD (talk) 21:02, 17 November 2020 (UTC)[reply]

Discussion

  • Extension:Variables unfortunately will not be deployed to WMF wikis. Do any of the alternatives listed at mw:Extension:Variables#Alternatives work for you? If I understand you correctly, it sounds like you need the variable to persist across multiple template calls, which Extension:Variables can't do anyway. MusikAnimal (WMF) (talk) 23:27, 17 November 2020 (UTC)[reply]
  • Does the solution that the en:Module:Citation/CS1 for automatic date formatting work for you? (Basically, read the page itself to extract a particular bit of wikitext that is structured reasonably.) See particularly reformat_dates in en:Module:Citation/CS1/Date validation. --Izno (talk) 05:41, 18 November 2020 (UTC)[reply]
    • @Izno: technically, yes. To be clear, I assume you are referring to mw.title:getContent(). We already exploit this "feature" as a means to categorize pages according to their part of speech, which is encoded as plain text since we've never fully adopted the automatic categorization via headword templates as enwiktionary does in wikt:en:Template:en-noun, for instance. However, beyond making the transcluding page record itself in WhatLinksHere, this feels like a hack as it depends on successful wikitext-based page parsing. Note this is not a one-pass action: given the specific configuration of plwiktionary's entry layout, we also need to perform this once per language section (take, for example, wikt:pl:Angola: 40 sections means invoking our hackish Lua parser 40 times). I just wouldn't like to keep adding more layers on top of that. Peter Bowman (talk) 11:16, 18 November 2020 (UTC)[reply]
  • Expanding on PiotrekD's problem description, entry-based projects (such as Wiktionaries) may expect significant gains in enabling this feature, especially regarding stuff that can perform semantic categorization of entries - but currently doesn't, or at least not in the way categories are meant to work, rather by periodically inspecting page contents and maintaining large lists such as wikt:pl:Indeks:Francuski - Medycyna. This list collects all French entries related to medicine based on their transclusion of wikt:pl:Template:med, which doesn't accept a language parameter (precisely this would be nice for categorization purposes) and it will probably never do: we have tons of such templates used across the entire site, potentially making it quite tedious to update hundreds of thousands of tranclusions, also accounting for the process of making our veteran editors aware of this change. In contrast, we could easily upgrade {{med}} and similar to fetch the corresponding language code, conveniently exposed in a variable that relates to the language section this template is placed in, and use it to categorize the page - no need to alter the page contents at all. Peter Bowman (talk) 11:16, 18 November 2020 (UTC)[reply]

Voting