Every entry on Wiktionary is organised with L2 language headings,
e.g. https://en.wiktionary.org/wiki/action contains:
==English== ... ==French== ... ==Middle French== ...
Under each of these headings are numerous templates, almost all of which either contain the L2 language's code as a parameter or as part of the template's name
e.g. Every bolded en
or lang=en
below is redundant, as they could be (theoretically) inferred from the "English" heading above them:
==English== From {{etyl|enm|en}} ... * {{IPA|/ˈæk.ʃən/|lang=en}} * {{audio|en-us-action.ogg|Audio (US)|lang=en}} * {{rhymes|ækʃən|lang=en}} ... {{en-noun}}
And there are many more templates with similar redundant parameters on this page in the English, French, and Middle French sections.
This is a huge amount of unnecessary redundancy, and it creates many opportunities for error.
Surely it would be possible to create some solution in MediaWiki to automatically pass the most recent L2 heading as a parameter to templates, or to somehow make it available as a magic word? This would have an enormous pay off in terms of simplifying Wiktionary editing, especially for new editors.
If you're wondering, there is already lua module code to translate the heading to a code (e.g. "French" to "fr"), so giving the full heading text rather than the code is not an issue.
So how difficult would it be to create an {{{H2}}} magic word for Wiktionary?
I've poked around in MediaWiki's parsing functions before but I really haven't touched PHP in a long time. I'm hoping this would be something fairly easy though and would be worth implementing for its potential to hugely simplify Wiktionary wikitext for its editors.