项目作者: mamantoha

项目描述 :
Lists of various ISO standards (ISO 3166-1 for countries and ISO 639-2 for languages) with translations for Crystal
高级语言: Crystal
项目地址: git://github.com/mamantoha/iso_codes.git
创建时间: 2021-02-21T12:56:20Z
项目社区:https://github.com/mamantoha/iso_codes

开源协议:MIT License

下载


ISO Codes

Crystal CI
GitHub release
License

This project provides lists of various ISO standards (ISO 3166-1 for countries and ISO 639-2 for languages) with translations for Crystal programming language.

ISO 3166-1

This lists the 2-letter country code and “short” country name. The
official ISO 3166-1 maintenance agency is ISO.

http://www.iso.org/iso/country_codes

ISO 639-2

This lists the 2-letter and 3-letter language codes and language
names. The official ISO 639-2 maintenance agency is the Library of
Congress.

http://www.loc.gov/standards/iso639-2

Translations

  • 249 Country codes (ISO 3166-1 - 2 letter) in 161 Languages
  • 487 Language codes (ISO_639-2 - 2 letter) in 98 Languages

Installation

  1. Add the dependency to your shard.yml:

    1. dependencies:
    2. iso_codes:
    3. github: mamantoha/iso_codes
  2. Run shards install

Usage

  1. require "iso_codes"
  2. country = ISOCodes.countries.find_by_alpha_2("UA")
  3. # => #<ISOCodes::Country:0x7f4bd307e5a0 @alpha_2="UA", @alpha_3="UKR", @name="Ukraine", @numeric="804", @official_name=nil, @flag="🇺🇦", @common_name=nil>
  4. country.translation("pt")
  5. # => Ucrânia
  6. language = ISOCodes.languages.find_by_name("Ukrainian")
  7. # => #<ISOCodes::Language:0x7f7c5b9eae80 @alpha_2="uk", @alpha_3="ukr", @name="Ukrainian", @common_name=nil, @bibliographic=nil>
  8. language.translation("fr")
  9. # => Ukrainien

Development

Update data from https://salsa.debian.org/iso-codes-team/iso-codes.git to make changes available to users:

  1. make update_data

Contributing

  1. Fork it (https://github.com/mamantoha/iso_codes/fork)
  2. Create your feature branch (git checkout -b my-new-feature)
  3. Commit your changes (git commit -am 'Add some feature')
  4. Push to the branch (git push origin my-new-feature)
  5. Create a new Pull Request

Contributors