Re:Government report proves that we need to liberate the Pos...
by darrenf on Friday August 23, 2024 @04:20AM
(#41327140)
https://www.mjt.me.uk/posts/falsehoods-programmers-believe-a...
[ Parent
| on HN ]
Re:Government report proves that we need to liberate the Pos...
by mrweasel on Friday August 23, 2024 @04:31AM
(#41327209)
Amazing. For a e-commerce site I argued that we would save ourself a lot of trouble by simply making the address field one large text field, rather than attempt to making a form that would work for every country and city (looking at you Mannheim).
But apparently that would make data analysis to complicated.
Re:Government report proves that we need to liberate the Pos...
by bojanz on Friday August 23, 2024 @05:10AM
(#41327393)
There is a middle ground and some common patterns that can help.
The address field names are fairly standardized[0] and Google has an open dataset (used by Chrome and Android) describing which countries need which fields[1].
I have an older PHP library[2] and a newer Go library[3] that build upon this, while crowdsourcing fixes (since Google hasn't updated their dataset in a while). The Go library allows me to serve all address formats and state lists in a single HTTP request, which can then power a very fast JS widget.
[0] Initially by the OASIS eXtensible Address Language (xAL) which trickled down into everything from maps to HTML5 autocomplete.
[1] https://chromium-i18n.appspot.com/ssl-address