Ecosyste.ms: Awesome
An open API service indexing awesome lists of open source software.
https://github.com/rl-king/elm-iso3166-country-codes
Convert to and from alpha2, alpha3, id and country names in 23 languages
https://github.com/rl-king/elm-iso3166-country-codes
elm iso3166 translations
Last synced: 27 days ago
JSON representation
Convert to and from alpha2, alpha3, id and country names in 23 languages
- Host: GitHub
- URL: https://github.com/rl-king/elm-iso3166-country-codes
- Owner: rl-king
- License: bsd-3-clause
- Created: 2020-05-18T19:17:22.000Z (over 4 years ago)
- Default Branch: master
- Last Pushed: 2023-06-18T16:07:30.000Z (over 1 year ago)
- Last Synced: 2023-08-08T20:39:57.718Z (over 1 year ago)
- Topics: elm, iso3166, translations
- Language: Elm
- Homepage: https://package.elm-lang.org/packages/rl-king/elm-iso3166-country-codes/latest/
- Size: 137 KB
- Stars: 2
- Watchers: 2
- Forks: 2
- Open Issues: 1
-
Metadata Files:
- Readme: README.md
- License: LICENSE
Awesome Lists containing this project
README
# elm-iso3166-country-codes
Convert to and from alpha2, alpha3, numeric codes and translate into 23 languages.
``` elm
import Iso3166
import Iso3166.DutchtwoLetterCode : String
twoLetterCode =
Iso3166.toAlpha2 Iso3166.NL
--> "nl"threeLetterCode : String
threeLetterCode =
Iso3166.toAlpha3 Iso3166.NL
--> "nld"numericCode : String
numericCode =
Iso3166.toNumeric Iso3166.NL
--> 528translated : String
translated =
Iso3166.Dutch.toName Iso3166.NL
--> "Nederland"
```## Asset size
Note that using this package might increase asset size a quite a bit.
Using `toAlpha2` and one `toName` adds about 2kB to a uglified + gzipped js file.It's just data and this might not be required to be bundled and could easily be fetched over http.
## Generate
Clone [stefangabos/world_countries](https://github.com/stefangabos/world_countries) into this repo, run `cabal run elm-iso3166` to generate Elm files.
## Credits
All modules are generated with data provided by [stefangabos/world_countries](https://github.com/stefangabos/world_countries)
a repository sourcing the codes and translations from [Wikipedia](https://en.wikipedia.org/wiki/ISO_3166-1).