Template talk:sort

From Wiktionary, the free dictionary
Latest comment: 5 years ago by Erutuon in topic Doesn't work
Jump to navigation Jump to search

Doesn't work

[edit]

It doesn't seem to work when I subst it, I get the error: Lua error in Module:languages at line 405: The function getByCode expects a string as its first argument, but received nil.. On the other hand, it works fine when not substed. It should be the other way around of course, non-substed should give an error telling you to subst it. —Rua (mew) 19:59, 1 April 2019 (UTC)Reply

Whoops, it needed safesubst:. Now it works. — Eru·tuon 20:06, 1 April 2019 (UTC)Reply
Maybe, but {{x2i}}, {{x2ipa}}, {{x2rhymes}} don't throw an error and out of all of them there were just two examples of {{x2i}} in mainspace. (Though pretty old: I guess nobody has been checking.) — Eru·tuon 20:10, 1 April 2019 (UTC)Reply
It's not strictly necessary, but it's better to give an error whenever it's used wrong. That includes bad parameters, but also using a template without substing it if that is the intention. —Rua (mew) 20:11, 1 April 2019 (UTC)Reply
Makes sense. Done. I restricted the error to the main and Reconstruction namespaces, though. I figure it doesn't matter if it isn't substed in a userpage, for instance. Maybe Appendix should be included though? — Eru·tuon 21:19, 1 April 2019 (UTC)Reply
Preventing non-substitution has the advantage that you can change what it substitutes into at any time, without breaking existing uses. I don't see a particular need to restrict the check to particular namespaces, why would someone want to not substitute this anywhere? —Rua (mew) 21:34, 1 April 2019 (UTC)Reply
I guess you're right. It wouldn't be very useful not substituted, though {{x2i}} and the rest might. — Eru·tuon 21:45, 1 April 2019 (UTC)Reply