JSPM

localized-countries

2.0.0
  • ESM via JSPM
  • ES Module Entrypoint
  • Export Map
  • Keywords
  • License
  • Repository URL
  • TypeScript Types
  • README
  • Created
  • Published
  • Downloads 11051
  • Score
    100M100P100Q140128F
  • License ISC

Country code to name mappings for several languages

Package Exports

  • localized-countries

This package does not declare an exports field, so the exports above have been automatically detected and optimized by JSPM instead. If any package subpath is missing, it is recommended to post an issue to the original package (localized-countries) to support the "exports" field. If that is not possible, create a JSPM override to customize the exports field for this package.

Readme

localized-countries

FOSSA Status

Get a language by code

var german = require('localized-countries')('de')
german.get('CH') // returns 'Schweiz'

var english = require('localized-countries')('en')
english.get('CH') // returns 'Switzerland'

var japanese = require('localized-countries')('ja')
japanese.get('CH') // returns '\u30b9\u30a4\u30b9'

Get a countries array

var english = require('localized-countries')('en')
english.array()
// returns all countries as array [{code: "US", label: "United States"}, ....]

Get a countries map

var english = require('localized-countries')('en')
english.object()
// returns all countries as object {"US": "United States", "CH": "Switzerland"}

In the browser

You probably don't want to load all languages. So I suggest you to load specific files.

var englishCountries = require('localized-countries')(require('localized-countries/data/en'))
englishCountries.get('US') // returns 'United States'

License

FOSSA Status