https://github.com/marcbachmann/localized-countries
:globe_with_meridians: Country code to name mappings for several languages
https://github.com/marcbachmann/localized-countries
country-codes internationalization language localization
Last synced: 2 months ago
JSON representation
:globe_with_meridians: Country code to name mappings for several languages
- Host: GitHub
- URL: https://github.com/marcbachmann/localized-countries
- Owner: marcbachmann
- Created: 2016-06-26T14:29:46.000Z (over 9 years ago)
- Default Branch: master
- Last Pushed: 2025-12-14T02:42:50.000Z (3 months ago)
- Last Synced: 2025-12-16T02:18:25.709Z (3 months ago)
- Topics: country-codes, internationalization, language, localization
- Language: JavaScript
- Homepage:
- Size: 634 KB
- Stars: 26
- Watchers: 1
- Forks: 13
- Open Issues: 1
-
Metadata Files:
- Readme: README.md
Awesome Lists containing this project
README
# localized-countries
[](https://app.fossa.io/projects/git%2Bgithub.com%2Fmarcbachmann%2Flocalized-countries?ref=badge_shield)
#### Get a language by code
```js
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
```js
var english = require('localized-countries')('en')
english.array()
// returns all countries as array [{code: "US", label: "United States"}, ....]
```
#### Get a countries map
```js
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.
```js
var englishCountries = require('localized-countries')(require('localized-countries/data/en.json'))
englishCountries.get('US') // returns 'United States'
```
## License
[](https://app.fossa.io/projects/git%2Bgithub.com%2Fmarcbachmann%2Flocalized-countries?ref=badge_large)