alcohol / iso3166

A PHP library providing ISO 3166-1 data.
https://iso3166.thephpleague.com
MIT License
640 stars 59 forks source link

Use of the definite article (the) in country names #100

Open chris114782 opened 5 months ago

chris114782 commented 5 months ago

Hi,

In ISO 3166-1 many countries in the official standard use the definite article (the) in their name.

An example is Korea (the Republic of) (alpha2 code KR)

The ISO standard list shows it as "Korea (the Republic of)": https://www.iso.org/obp/ui/#iso:code:3166:KR

This package shows it as "Korea (Republic of):" https://github.com/thephpleague/iso3166/blob/main/src/ISO3166.php#L1278

Does the standard allow for the definite article to be optional or is this an error / omssion?

alcohol commented 5 months ago

:shrug:

I am not sure to be honest. The short name (uppercase) often omits "the". But since this package contains the lowercase short name, maybe we should not omit it? But what is the added value of adding it? Is it going to help users identify the correct country? I am usually a fan of "less is more".

chris114782 commented 5 months ago

In our use case we are providing data from our app (which uses the alpha-3 code internally) to a third party which is expecting the name instead. The third party are failing validation because we aren't using the name as it appears in the standard as far as they are concerned.

I personally agree with you on the less is more (and dislike the idea of validating based on the name), but I guess the point of a standard is that everyone implementing that standard should use the same data, and the name as it appears in the library doesn't match any of the fields for the same country in the ISO3166-1 list.

alcohol commented 5 months ago

That seems like a very weird choice, also given the fact that the name of a country can be very different from a language perspective. This library happens to present all data in English (can't even tell if it qualifies as en-US or en-GB though) and does not offer translations, but generally it is much saner to use the code rather than the name.

As a quick "fix", you could instantiate the library with a dataset that satisfies the third party criteria, e.g.:

$data = array_column((new ISO3166())->all(), null, 'alpha2');
$data['KR']['name'] = 'Korea (the Republic of)';

$fixed = new ISO3166(array_values($data));
alcohol commented 5 months ago

As a reference, for the name, I used the table provided at https://en.wikipedia.org/wiki/ISO_3166-1 since this library is focused on ISO3166-1 (though the name is misleading I will admit).

chris114782 commented 4 months ago

Thank you for your time, especially pointing out the distinction of ISO 3166-1 vs 3166-2, that's a point I hadn't considered.