wmnnd

wmnnd

International Address Formats + Forms in Elixir

Hey folks,

I’m currently working on adding an address form to Keila. Unfortunately, address forms can be wildly different from country to country. Do they require a postal code? Does the postal code go before or after the locality/city name? On top of that, certain labels for common address fields need to be different between countries (e.g. the relevant administrative region in address is called a state in Mexico but a province in Canada. Postal codes are called Postcode in the UK but ZIP Code in the US.)

Is there an actively maintained Elixir library that offers data on international address formats and these localizations? Here are the libraries I have found so far:

  • countries: Not updated since 2019, doesn’t seem to have any data on address formats
  • countriex: Not updated since 2017, has no documentation
  • ex_countries: Actively maintained, doesn’t have data on address formats.
  • ex_cldr + ex_cldr_territories (friendly ping @kip & @schultzer): Actively maintained, provides all the necessary data to offer dropdowns for the country, including translations of country subdivisions. None of the cldr libraries seem to have any data on address formatting, however. There also doesn’t seem to be data on what the country subdivisions are called (province, state, etc).

Outside the BEAM universe, there is the PHP addressing library which includes most of the data I’m looking for, including address formats (there’s also a Ruby port). The one thing that’s also missing here is country-specific i18n for the various address fields.

What do you all usually do when you need to build an international address form? Did I miss any Elixir resources?

Most Liked

Schultzer

Schultzer

We definitely could use a library built on top, but you would have to make some decisions on which standard to use. From a cursory search it seams like Oasis is not the only one out there.

The times when I have had to capture this kind of information has always been for identification purposes and not shipping which is an entirely more complex problem. For identification you can usually get away with a minimal setup: country, subdivision, postal code, city, address_2, address_1, name.

Looking forward to see where this is going! And let me know if you have any questions around the CLDR dataset.

Where Next?

Popular in Questions Top

lanycrost
Hi everyone! I need implement if…else if…else condition from my elixir code, and anymore of this control flow structures not work proper...
New
logicmason
Hi there, I'm working through my first release with elixir/phoenix. I've built a release with distillery and found that it crashes when I...
New
pmjoe
I have a relationship of love and hate with Elixir. Lots of things are just absolutely right, but there are some things that are kind of ...
New
myronmarston
The Elixir Typespec docs show the following syntax for keyword lists in typespecs: # ... | [key: type] # keyword lis...
New
electic
Hi, I am new to Elixir. I am trying to use the DateTime component to insert a date into MySQL however the there seems to be no way to fo...
New
kostonstyle
Hi all I want to have a unix time, from the current time plus 1 hour. DateTime.now + 1 hour How to get it in elixir? Thanks
New
chewm
Hi guys, nice to meet you to the whole forum, I’m new here, I’m trying to configure visual studio code for elixir, right now the intellis...
New
WestKeys
Currently suffering from paralysis by [HTTP client] analysis. This is rather unusual in Elixirland as there tends to be consensus on the ...
New
Fl4m3Ph03n1x
About me? ( if you have nothing better to do than reading about some random guy in the internet :stuck_out_tongue: ) Hello all, this is ...
New
siddhant3030
Hi, I have to write a raw query for one of my project. But till now I have used ecto queries and don’t have much experience writing raw ...
New

Other popular topics Top

minhajuddin
I have seen a lot of code which picks the first element from a list using Enum.at(0) instead of List.first. Is there a reason why people ...
New
chrisalley
ExUnit now has describe blocks which is a welcome addition coming from RSpec. In the docs, it states that nested hierarchies of describe ...
New
lessless
I believe there are people here who are dealing with CSV files import on the daily basis, and since Excel is a really popular tool there ...
New
joaquinalcerro
Hi there, I am working with Ecto-Postgresql and I need to call all of the records from a specific table but the table has 40,000 record...
New
New
qwerescape
Is there a way to get the call stack or stack trace at any point in the code? Not from exceptions, but an expression that returns how the...
New
vonH
When I run the Plug and I recompile I wind up having to use Ctrl C to quit iex and start again. Witht the help of rlwrap I can use the cu...
New
electic
Hi, I am new to Elixir. I am trying to use the DateTime component to insert a date into MySQL however the there seems to be no way to fo...
New
Nvim
Elixir appears to be a superior language to Python. I don’t see any advantage of Python over Elixir. Are there any?
New
siddhant3030
Hi, I have to write a raw query for one of my project. But till now I have used ecto queries and don’t have much experience writing raw ...
New

We're in Beta

About us Mission Statement