No release in over 3 years
Low commit activity in last 3 years
Generates unicode country flags from country code
2005
2006
2007
2008
2009
2010
2011
2012
2013
2014
2015
2016
2017
2018
2019
2020
2021
2022
2023
2024
 Dependencies

Development

~> 1.12
~> 5.0
~> 10.0
 Project Readme

Unicode Country Flags

No image, no CSS, you can show country flags on your web pages with unicode only. See Regional Indicator Symbol for details. And find valid country codes here, ISO 3166-1 alpha-2.

Installation

Add this line to your application's Gemfile:

gem 'unicode_country_flags'

And then execute:

$ bundle

Or install it yourself as:

$ gem install unicode_country_flags

Usage

Get the raw code:

UnicodeCountryFlags::CountryFlags.flag_of('cn')  #=> "🇨🇳"

Or use the helper, unicode_country_flag_of, in view code:

<% %w{ US GB AU CN JP }.each do |code| -%>
  <span><%= unicode_country_flag_of(code) %> <%= code %></span>
<% end %>

πŸ‡ΊπŸ‡Έ US πŸ‡¬πŸ‡§ GB πŸ‡¦πŸ‡Ί AU πŸ‡¨πŸ‡³ CN πŸ‡―πŸ‡΅ JP

Contributing

Bug reports and pull requests are welcome on GitHub at https://github.com/YanhaoYang/unicode_country_flags.