wmnnd

wmnnd

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?

Showing Posts 1 to 6

wmnnd

wmnnd OP

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:


LostKobrakai

LostKobrakai

Sounds like they source their data from cdlr based on their last commit. ex_cldr | Hex exists to pull the database, so we might just lack a companion library exposing the relevant data in a useful way.

wmnnd

wmnnd OP

I don’t think the postal address format is part of CLDR. That seems to come from some sort of Google API.
Edit: This is where the address format data is coming from: Address Data Query

Cochonours

Cochonours

Even within a country, the way fields are presented will vary.

Given name and family name are not enough. In some cases people will want to select a title, and depending on their culture should you use the title with only the family name or the full name? Should the family name be printed before or after the given name? Some people don’t have last names, etc.
For these reasons it is sometimes more practical to have a full name field, though it has its downsides.

wmnnd

wmnnd OP

Good point. The data from Google doesn’t account for titles (and I don’t care for them either, tbh) but they do change the order of family name and given name, e.g. for Vietnam or China, family name comes first. Generally, mononyms seem to be very unommon, so I’m also not particularly concerned about that either.

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.

— All posts loaded —

Where Next? Top

Trending in Questions Top

Blokh
Hey guys, I’ve got a huge CSV ( around 10 GB ) that needs to be processed hourly Do you guys have any suggestions what is the best prac...
New
kszambelanczyk
Hello! Could someone please give me a help/sample code, how to delete a file from s3 using waffle/waffle_ecto from Phoenix app. I creat...
New
RemyXRenard
I’m seeing that a list inside a Kino.DataTable will be interpreted as a charlist, even if the Kino.configure() is set to charlists: :as_l...
New
velrest
So my question is quite simple and i have found no conclusive answer on forum, google or AI. Should we use :erlang.float for Integer to ...
New
samoloth
Hi, I’ve just set up an application with ash_authentication. There is only magic link strategy for now, so there is no confirmation add o...
New
FlyingNoodle
If a change or preparation module uses Ash.Changeset.get_argument/2 or Ash.Query.get_argument/2 (or any of the other get_argument functio...
New
psy-q
I’m trying to set up Emacs with elixir-ls via lsp-mode and credo via Flycheck. This should mostly be preconfigured as Flycheck picks up c...
New

Other Trending Topics Top

mudasobwa
I am happy to introduce the very α version of the new programming language compiled to BEAM. Welcome Cure. It has literally three kille...
New
garrison
Hobbes is a low-level distributed database for the Elixir programming language. Hobbes provides a simple, safe, and scalable storage lay...
New
marciok
Hi there! We created Gust: A task orchestrator inspired by Airflow. For those who have never heard about Aiflow, it’s a Python-based wor...
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
mcass19
ExRatatui lets you cook up rich terminal UIs in Elixir, powered by Rust’s ratatui via Rustler NIFs. Build interactive terminal applicatio...
New
Damirados
Hello everyone. After busy few months I am happy to announce v0.1.0 of Emerge & Solve. They are GUI (Emerge) and State management (S...
New

We're in Beta

About us Mission Statement

Options

Thread Display Mode




Thread Preview

Skip Thread Previews