I couldn't find any existing libraries to help format international
mailing addresses. Turns out it's rather tedious. Not only do
different countries have different names for the components of an
address, but many countries have different formats for the city line.
And then there's Great Britain, er England, er ... yeah.
So I've started work on a plugin called Snail. My dream is that it
will grow to encapsulate the rules of international address formatting
and basic validation. It's just quite a lot for any one person.
The first release is up on GitHub at http://github.com/cainlevy/snail.
If your application has anything to do with addresses, and you think
it may need to go international, I hope you'll check it out!
I commend you on taking this on. This has been a huge pet peeve of
mine over the years, and only very expensive commercial solutions were
available to even do a fraction of the things necessary to manage
mailing addresses.
Have you thought about also creating parsers to help identify what the
address is, and which formatter to use? (like, identify which state/
province and country, then determine the rules around parsing and
formatting)
Also, I find that I often work with addresses that were inputted in
odd ways, and requires me to "scrub" them a lot. There are very
expensive commercial solutions for this, but no good open source
solutions, and especially no Ruby ones. Thought about putting in some
basic scrubbing rules as well (and possibly address verification
services)?
I haven’t thought about scrubbers and parsers. Sounds like a good fit, but I’m not in a position to really know the best approach, nor do I have an application requiring them that I could use for real-world test data.
My first priority with Snail is to make it easy for people to improve the areas that are most important to them. Right now I have a fixed origination country (USA) and no validation rules. I think the next step is to sketch out the validation system and make the origination country configurable, even if it still only supports USA. From there I hope that people will find it easy to add rules for the countries they know best.