Mautic Community Forums

Use a coherent county list, with ISO abbreviations in DB

Hi - just looking at this closed issue: https://github.com/mautic/mautic/issues/2112 which request the enhancement of using ISO country codes to describe countries rather than an arbitrary list of countries that don’t map well to any “authoritative” country list, which uses a hodgepodge of full (English, mostly) names as is currently the case.

I note that this lists is in app/bundles/CoreBundle/Assets/json/countries.json

This makes using the Contact API quite difficult when it comes to managing country assignments… because countries have to be specified using Mautic’s own quirky definitions… requiring complex mapping, across character encoding types, too, if one is unlucky.

I also note that there’re are localised country lists, mapped to ISO 2 letter country codes, in the codebase already, e.g. for the English locale: vendor/symfony/intl/Resources/data/regions/en.json

It’d be a huge help to have these ISO standards references stored in the DB rather than the arbitrary (and unlocaliseable) names as is currently the case (e.g. as stored in leads->country)… seems like it’d make Mautic devs’ lives easier too, by far… although it’ll be a painful transition in the short term.

Need to add additional tags…

This is an urgent need. Mautic needs to use a standard country name list. Most of integrations or implementations break because the country names do not match with the mautic list

to better standard Mautic can use an iso3166 standard like this repo https://github.com/thephpleague/iso3166

or this one https://github.com/commerceguys/addressing

Heh, thanks for adding your voice @bellafronte - yeah, I’ve had to write a country translation layer substantially complicating my API implementation… So it’d be cool if this got fixed!

I understand your headache @lightweight just because Mautic call US United States, and not United States Of America, I need to get a way to translate all countries names. This is painful.

It is sad to know that Mautic advances in so many novelties but with simple questions like this one is given no attention. I meet requests for more than 3 years for this problem and nothing is changed.

Yes, it’s a problem… Mautic is an impressive tool… but it has some very strange blind spots… I wish, for example, that these issues were in a Git project system (like a Gitlab) rather than in a forum…

Given how deeply embedded this country stuff is within their data schema (they store country names in the DB, rather than indices into a country table!) it’d be a total nightmare to fix this architectural problem… So, I feel some sympathy for the Mautic dev team having to wrestle with such an unfortunate early decision, no doubt made out of expedience, to define their own country list… :frowning:

For what it’s worth, I wrote a parser (in PHP) to create the mapping between an ISO country list (using 2 letter country codes mapped to full names) and the Mautic-specific country list… note, it’s not a strict 1-to-1 mapping.

1 Like

@lightweight Mautic uses two JSON files to which provide the country and states names. They are located in /app/bundles/CoreBundle/Assets/json/countries.json and /app/bundles/CoreBundle/Assets/json/regions.json

Maybe this dataset can help you https://datahub.io/core/country-list