Template talk:USStateNameToAbb

Page contents not supported in other languages.
From Wikipedia, the free encyclopedia
WikiProject iconUnited States: Government Template‑class
WikiProject iconThis template is within the scope of WikiProject United States, a collaborative effort to improve the coverage of topics relating to the United States of America on Wikipedia. If you would like to participate, please visit the project page, where you can join the ongoing discussions.
TemplateThis template does not require a rating on Wikipedia's content assessment scale.
Taskforce icon
This template is supported by WikiProject U.S. Government.
WikiProject iconU.S. Congress Template‑class Mid‑importance
WikiProject iconThis template is within the scope of WikiProject U.S. Congress, a collaborative effort to improve the coverage of the United States Congress on Wikipedia. If you would like to participate, please visit the project page, where you can join the discussion and see a list of open tasks.
TemplateThis template does not require a rating on Wikipedia's content assessment scale.
MidThis template has been rated as Mid-importance on the project's importance scale.
This template has not yet been assigned a subject.
The options are: "Person", "People", "Place", "Thing", or "Events".

Problem[edit]

@Sdkb: I haven't worked out how exactly, but the recent change to {{USStateNameToAbb}} gives "Lua error in Module:Navbar at line 58: Invalid title USCongDistState Error: Unrecognized input" in the first navbox ({{USCongDistStateVI}}) at the bottom of United States Virgin Islands's at-large congressional district. A minor issue is that the template page shows "Error: Unrecognized input" which is a bit ugly. Also, shouldn't that edit use #default in the switch? Anyway, I'm hoping you can figure out what's going on. Johnuniq (talk) 05:56, 31 October 2021 (UTC)[reply]

@Johnuniq, this template was already encountering an error on that page, but it just didn't have a way to show it until I implemented error detection in that edit. The issue was that it was using "United States Virgin Islands" as the input, but this template wasn't set up to recognize that, only things like "U.S. Virgin Islands". I've fixed that now, and I added includeonly tags to prevent the error from displaying on this page. Using #default in the code should work just the same as using {{{1}}}, so it's just a matter of what looks cleanest in the code; feel free to switch it if #default is your preference. And definitely feel free to bring up if there are any other errors this change brings to light.
As a sidenote, Template:US State Abbrev is set up to handle errors by just spitting back out the input. I didn't change that for fear of breaking something that depends on it, but it might be worthwhile to set up a tracking category if anyone is interested. Cheers, {{u|Sdkb}}talk 06:33, 31 October 2021 (UTC)[reply]
Thanks for fixing it. Johnuniq (talk) 08:26, 31 October 2021 (UTC)[reply]