OpenBookPrices / country-data

Country related data such as ISO codes, currencies etc
MIT License
512 stars 166 forks source link

Alternative names #26

Open gajus opened 9 years ago

gajus commented 9 years ago

The lookup using remote sources will often fail because rarely does anyone use the official name (e.g. Russian Federation vs Russian and People's Republic of China vs China).

CountryData.lookup.countries({name: 'Russia'}); // Russian Federation
CountryData.lookup.countries({name: 'China'}); // People's Republic of China
CountryData.lookup.countries({name: 'USA'}); // The United States of America, United States, America
CountryData.lookup.countries({name: 'Iran'}); // Persia, Islamic Republic of Iran
CountryData.lookup.countries({name: 'Vietnam'}); // Socialist Republic of Vietnam

It would make sense to have "name_aka" field in JSON that would describe common variations.

evdb commented 9 years ago

The need for a name_aka field of some sort is clear. However I wonder if what you're suggesting could also be used to provide the country name in other languages?

Any thoughts on that?

gajus commented 9 years ago

From data normalisation perspective, I would like it to be something along the lines of:

names: [
    {
        name: 'Lithuania',
        language: 'en', /* ISO 639-1 */
        attributes: [
            'aka'
        ]
    },
    {
        name: 'Republic of Lithuania',
        language: 'en',
        attributes: [
            'official-name'
        ]
    },
    {
        name: 'Lietuva',
        language: 'lt',
        attributes: [
            'aka'
        ]
    },
    {
        name: 'Lietuvos Respublika',
        language: 'lt',
        attributes: [
            'official-name'
        ]
    }
]

See https://github.com/OpenBookPrices/country-data/issues/28

ziggamon commented 9 years ago

Geonames has been handling this for a long time (and also has relevant data). Look at for example: http://www.geonames.org/countries/US/united-states.html (it allows multiple names per language. So it would hit for both USA U.S.A. U.S. and United Stated)