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?

First Post!

wmnnd

wmnnd

To illustrate what I eventually want to achieve, here are two address forms for Germany and Brazil respectively, built based on the data from the PHP addressing library:


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?

Trending 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
senggen
Erlang/OTP 25 [erts-13.2.2] [source] [64-bit] [smp:8:8] [ds:8:8:10] [async-threads:1] 15:22:35.803 [error] gen_event {lager_file_backend...
New
hariharasudhan94
Lets say I have map like this fetching from my database %{"_id" => #BSON.ObjectId<58eb1a7a9ad169198c3dXXXX>, "email" => ...
New
tj0
I’ve been following the steps here for the upgrade from 1.6 to 1.7 and it has gone relatively smoothly all the way till the phoenix_view ...
New
cgraham
Hi! What is currently the best library/method for parsing text and tabular data out of PDF files in Elixir or Erlang?
New
stefanchrobot
Hi, I need a way to handle data migrations in my application. I found an article by @wojtekmach about manual migrations: Automatic and ma...
New
stjefim
Hello! Suppose you are building workflow (order / task / payment) processing system with the following requirements: Each workflow con...
New

Other Trending Topics Top

GenericJam
Edit: 2026 May 15 - This post is archived. Mob is alive!! Main docs: mob v0.7.11 — Documentation A bit of explanation for the slightly c...
New
JesseHerrick
Hey, I’m Jesse and I’m the main contributor behind Dexter, a full-featured, lightning-fast Elixir LSP optimized for large codebases. It s...
New
kip
Localize is the next generation localisation library for Elixir. Think of it as ex_cldr version 3.0. The first version will be released ...
New
webofbits
Squid Mesh is an open source workflow automation runtime for Elixir applications. It is aimed at Phoenix and OTP apps that want to defin...
New
jimsynz
Beam Bots (or just BB for short) is a framework for building fault-tolerant robotics applications in Elixir using familiar OTP patterns. ...
New
kip
In 2021 I started a new library called Tempo with the objective of modelling time as a set of intervals - not as instants. In 2022 I gave...
New

We're in Beta

About us Mission Statement