Ruby: country/language names and 2-letter-code pairs, in 85 languages, for country/language i18n
Through pkg-isocodes:
gem install i18n_data
require 'i18n_data'
...
I18nData.languages # {"DE"=>"German",...}
I18nData.languages('DE') # {"DE"=>"Deutsch",...}
I18nData.languages('FR') # {"DE"=>"Allemand",...}
...
I18nData.countries # {"DE"=>"Germany",...}
I18nData.countries('DE') # {"DE"=>"Deutschland",...}
...
I18nData.language_code('German') # DE
I18nData.language_code('Deutsch') # DE
I18nData.language_code('Allemand') # DE
..
I18nData.country_code('Germany') # DE
I18nData.country_code('Deutschland') # DE
..
rake write_cache_for_file_data_provider
If you would like to have the countries list sorted alphabetically in different languages there is a gem called sort_alphabetical for that.
Michael Grosser
[email protected]
License: MIT