Last modified: 2013-03-13 16:07:48 UTC
if "Template:Foo" exists, {{foo}} will transclude it (unlike {{FOO}} ). Note that the user might have tried to create [[Template:foo]] in the first place, and the system did her a favor and created [[Template:Foo]] instead. to compensate for this unsolicited substitution, the system is nice enough to recognize {{foo}}. However, when the user creates [[User:JaneDoe/sandbox/Template:foo]], the system will not replace it with [[User:JaneDoe/sandbox/Template:Foo]], and in the sandbox, {{foo}} will look for [[Template:Foo]] (in template namespace) but will ignore [[User:JaneDoe/sandbox/Template:foo]]. Same exact thing for [[User:JaneDoe/sandbox/Model:bar]] IMO, the sandbox should imitate the behavior of the system as much as possible. In this case, i think that when i use {{foo}} (or {{Foo}} ) in the sandbox, the system should look for any of <sandboxprefix>/template:foo, <sandboxprefix>/template:Foo, <sandboxprefix>/Template:foo or <sandboxprefix>/Template:Foo. no need to look for <sandboxprefix>/tEmplAte:fOo, of course. same exact thing should be for (m|M)odel/(b|B)ar, and any other namespace the Sandbox might substitute. peace.
The hard part being that normalizing {{foo}} to Template:Foo is easy, but denormalizing Template:Foo to every accepted case variation is not. It's not even particularly easy to know whether the character after the colon can be case-changed. And then we'd have to iterate over all of those variations, testing if each one exists. And ignore the question of what to do if more than one does. I think the best thing to do would probably be to just document more explicitly that the canonical title must be used in the sandbox.
If someone comes up with good code to do this, feel free to submit it to Gerrit. Until then, let's just go with the "document that the canonical title must be used in the sandbox" solution.