Many updates
This commit is contained in:
@@ -139,4 +139,15 @@ module ApplicationHelper
|
||||
raw: user_agent
|
||||
}
|
||||
end
|
||||
|
||||
# Convert country code to flag emoji
|
||||
def country_flag(country_code)
|
||||
return "" if country_code.blank?
|
||||
|
||||
# Convert ISO 3166-1 alpha-2 country code to flag emoji
|
||||
# Each letter is converted to its regional indicator symbol
|
||||
country_code.upcase.chars.map { |c| (c.ord + 127397).chr(Encoding::UTF_8) }.join
|
||||
rescue
|
||||
""
|
||||
end
|
||||
end
|
||||
|
||||
Reference in New Issue
Block a user