Countries

Country common names and official names for RosaeNLG, currently available for English and French.

In English, manages essentially articles and article capitalization: the Comoros, Barbados, The Bahamas, etc.

In French, manages:

  • articles, gender, number and contractions: l’Ouganda, Israël, la France

  • "in": en Israël, aux Pays-Bas.

  • "from": d’Israël, des Pays-Bas.

Usage

Include :

  • js resource file: countries_en_US.js for English, countries_fr_FR.js for French (each is around 20 kb)

  • countries.pug systematically

One single mixin country:

  • first parameter: to find the country using cca2 ccn3 or cca3

    • code ISO 3166-1 alpha-2: cca2

    • code ISO 3166-1 numeric: ccn3

    • code ISO 3166-1 alpha-3: cca3

  • second parameter:

    • DEFINITE to definite article: la France, The Bahamas

    • IN for en France, in France

    • FROM for de France, from France

    • COUNTRY_NAME or nothing for just the country name: Pays-Bas, Netherlands

    • OFFICIAL_COUNTRY_NAME for just the country official name: French Republic (France is the common name)

English examples

  • #[+country({cca2: 'GB', 'DEFINITE'})]the United Kingdom

  • #[+country({cca2: 'GM', 'DEFINITE'})]The Gambia

  • #[+country({cca2: 'BB', 'DEFINITE'})]Barbados

  • #[+country({cca2: 'NL'}, 'COUNTRY_NAME')]Netherlands

  • #[+country({cca2: 'FR'}, 'OFFICIAL_COUNTRY_NAME')]French Republic

French examples

  • #[+country({cca2: 'FR'}, 'DEFINITE')]la France

  • #[+country({cca2: 'MU'}, 'DEFINITE')]l’Île Maurice

  • #[+country({cca2: 'FR'}, 'IN')]en France

  • #[+country({cca2: 'NL'}, 'IN')]aux Pays-Bas

  • #[+country({cca2: 'MU'}, 'IN')]à l’Île Maurice

  • #[+country({cca2: 'MU'}, 'FROM')]de l’Île Maurice

To get gender and other information, typically when agreeing, use getCountry_fr_FR js function:

- const france = getCountry_fr_FR({cca2: 'FR'})
| #{france.gender}

Completing the list

There are missing combinations as well as, probably, mistakes. You can constribute: send me an email or a PR.

You can also locally hack/complete your list:

-
  const wf = getCountry_fr_FR({cca2: 'WF'})
  wf.de = 'de'
l #[+country({cca2: 'WF'}, 'FROM')]

will output de Wallis-et-Futuna (instead of throwing an exception).

Dependencies and licences

Countries library is based on World countries under ODC Open Database License (ODbL).