Ecosyste.ms: Awesome
An open API service indexing awesome lists of open source software.
https://github.com/leodutra/country-emoji
Converts between country names, ISO 3166-1 codes and flag emojis.
https://github.com/leodutra/country-emoji
country-codes country-flags emoji i18n internationalization localization
Last synced: about 2 months ago
JSON representation
Converts between country names, ISO 3166-1 codes and flag emojis.
- Host: GitHub
- URL: https://github.com/leodutra/country-emoji
- Owner: leodutra
- License: mit
- Created: 2020-10-24T06:27:40.000Z (about 4 years ago)
- Default Branch: main
- Last Pushed: 2021-11-27T22:49:08.000Z (about 3 years ago)
- Last Synced: 2024-08-08T19:14:50.703Z (5 months ago)
- Topics: country-codes, country-flags, emoji, i18n, internationalization, localization
- Language: Rust
- Homepage:
- Size: 30.3 KB
- Stars: 5
- Watchers: 3
- Forks: 1
- Open Issues: 0
-
Metadata Files:
- Readme: README.md
- License: LICENSE
Awesome Lists containing this project
README
# country-emoji
[![crate.io](https://img.shields.io/crates/v/country-emoji)](https://crates.io/crates/country-emoji)
Converts between country names, ISO 3166-1 codes and flag emojis.
## Usage
```rust
use country_emoji::{flag, code, name, countries};flag("CL")
// ~> π¨π±code("π¨π¦")
// ~> CAname("πΆπ¦")
// ~> Qatar// can extract name from stringβ¦
flag("Taiwan number one!")
// ~> πΉπΌ// β¦but only if there"s no ambiguity
flag("Congo and Burma")
// ~> undefinedflag("Republic of Tanzania")
// ~> πΉπΏflag("Tanzania, United Republic of")
// ~> πΉπΏcode("Australia")
// ~> AUcode("UAE")
// ~> AEname("AE")
// ~> United Arab Emiratescode("UK")
// ~> GB
```### Don't want Rust?
Check out the following:
* **JavaScript:** [country-emoji](https://github.com/meeDamian/country-emoji)
* **Swift:** [SwiftFlags](https://github.com/BubiDevs/SwiftFlags) (ref: [#16](https://github.com/meeDamian/country-emoji/issues/16))## Bugs and feedback
If you discover a bug please report it [here](https://github.com/leodutra/country-emoji/issues/new). Express gratitude [here](https://patreon.com/leodutra).
Mail me at [email protected], or on twitter [@leodutra](http://twitter.com/leodutra).
## Credits
This library is based on the work of two existing library:
* [country-emoji](https://github.com/meeDamian/country-emoji/blob/master/src/lib.js), available for JavaScript
* [flag-emoji-from-country-code](https://github.com/bendodson/flag-emoji-from-country-code), a great snippet to get the emoji flag from an ISO 3166-1 region codeThanks guys for your work!
## License
MIT @ [Leo Dutra](https://github.com/leodutra)