Early Bird Registration for DrupalCon Portland 2024 is open! Register by 23:59 PST on 31 March 2024, to get $100 off your ticket.
It'd be nice to have a feature to capitalize the address components. I've attached a patch which gets the job done, although there may be a better way to go about it...
Comment | File | Size | Author |
---|---|---|---|
addressfield-capitalize-796936.patch | 2.1 KB | balatin |
Comments
Comment #1
balatin CreditAttribution: balatin as a volunteer commentedComment #2
bojanz CreditAttribution: bojanz at Centarro commentedThere are several problems to consider here:
1) Capitalization is only done on postal labels (for envelopes, packages, etc). It's not done for web display.
This is because capitalization is only done to faciliate automated label scanning.
2) Each country specifies which fields need to be capitalized, that info is a part of the address format.
3) Subdivisions (administrative areas, localities, dependent localities) need to have both a "name" and a "code", the first shown on the address form, the second shown on display (and the postal label). Right now in 1.x we only have the "name". So even if we solved #1 and #2, we still wouldn't always have the correct data to capitalize.
We've addressed all of this in our commerceguys/addressing library, and in the (still in progress) Address module which will replace addressfield in D8. But in addressfield 1.x for D7 we've done all that we could.