Template talk:USStateNameToAbb

Latest comment: 3 years ago by Johnuniq in topic Problem

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