Template talk:Namespace name

From WikiProjectMed
Jump to navigation Jump to search

Magic word instead?

JPxG, shouldn't this be converted to use Magic word {{ns:n}} instead of a hard-coded table? E.g., {{ns:119}} ⟶ Draft talk, and so on. One thing to note: {{ns:value}} plays nice with undefined numeric values (e.g., {ns:12345}} ⟶  ) and even with alpha values, as long as they are legit (e.g., {{ns:Draft talk}} ⟶ Draft talk ), but not with invalid alpha values ( {{ns:Draftxyz}} ⟶ Template:Ns:Draftxyz ). Presumably, the magic word will never get out of sync, if there are changes in namespaces or installed extensions, so that's another reason. Adding Pppery. Thanks, Mathglot (talk) 00:19, 1 July 2024 (UTC)[reply]

Yeah, this sounds reasonable. The only real difference I can come up with is that for deprecated namespaces this doesn't work: {{ns:119}} gives "Draft talk" but {{ns:2303}} gives "" (whereas {{namespace name|2303}} gives "Gadget definition talk". This is kind of an edge case. Since this template is mostly for {{database report}}, I can imagine some circumstances (i.e. a DBR about page deletion actions or whatever) where it might return these deprecated namespace names (particularly Book: which was quite heavily used at one point). It might just not matter at all, I don't know actually how those actions are stored in the database, it might be that they don't return a namespace number at all and they turn into mainspace pages. @Izno: probably knows.
At any rate, this could just be a switch I guess (check {{#if:{{ns:{{1}}}}}|a|b}}?) etc jp×g🗯️ 00:39, 1 July 2024 (UTC)[reply]
Yes, I see what you mean, hmm, not sure what to do about those cases. As a side issue (and this is really a separate proposal) it would be nice to be able to use it as an arg validator for alpha values, so that values like "Draft" return themselves, but values like "Draftxyz" return empty. Just fyi, as far as why I'm even here thinking about this, is a recent enhancement I made to {{lnc}}, and a minor tweak I'm thinking of adding to it. Mathglot (talk) 00:59, 1 July 2024 (UTC)[reply]
Well, I had an idea for how to do that, but this seems to do the same thing in a smarter way, so props to @Stjn:. jp×g🗯️ 02:36, 1 July 2024 (UTC)[reply]
Yes, nice. And btw, I need to ask Wikimedia to create a new feedback item link for the History page, to be placed next to the Thank link and to be called "Lol", so I can respond to your edit summary in this edit. The only downside, is that wmf might have to buy more server storage, to handle the rush of new feedback responses to edits by EEng. Mathglot (talk) 03:49, 1 July 2024 (UTC)[reply]