Browse Source

Country names are translated to the browser language

remotes/origin/master
echarp 3 years ago
parent
commit
b617ee1dca
  1. 1
      Gemfile
  2. 4
      Gemfile.lock
  3. 5
      app/views/regions/_filter_region.haml
  4. 5
      app/views/regions/_selector_region.haml

1
Gemfile

@ -53,6 +53,7 @@ gem 'kramdown'
gem 'flag-icons-rails'
gem 'geocoder'
gem 'i18n-country-translations'
# Tiny MCE integration
gem 'tinymce-rails'

4
Gemfile.lock

@ -196,6 +196,9 @@ GEM
concurrent-ruby (~> 1.0)
i18n-active_record (0.2.2)
i18n (>= 0.5.0)
i18n-country-translations (1.3.1)
i18n (>= 0.9.3, < 2)
railties (>= 5.0, < 5.3)
icalendar (2.5.3)
ice_cube (~> 0.16)
inherited_resources (1.10.0)
@ -464,6 +467,7 @@ DEPENDENCIES
high_voltage
http_accept_language
i18n-active_record
i18n-country-translations
icalendar
ice_cube!
jbuilder (~> 2.5)

5
app/views/regions/_filter_region.haml

@ -3,7 +3,7 @@
= link_to filter_region.url do
- if filter_region.code.present?
= flag_icon filter_region.code.downcase
= filter_region.name
= t filter_region.code, scope: :countries, default: filter_region.name
%small
%em.fa.fa-external-link-alt
- else
@ -11,9 +11,10 @@
region: params[:region] == filter_region.id.to_s ? '' : filter_region do
- if filter_region.code.present?
= flag_icon filter_region.code.downcase
= t filter_region.code, scope: :countries, default: filter_region.name
- else
%em.fa.fa-shield-alt
= filter_region.name
= filter_region.name
- if params[:region] == filter_region.id.to_s
%em.fa.fa-times
- elsif !filter_region.region && filter_region.regions.present?

5
app/views/regions/_selector_region.haml

@ -1,12 +1,13 @@
- if selector_region.regions.present? || selector_region.url.blank?
%span.region{ title: selector_region }
%span.region{ title: selector_region.code }
= f.radio_button :region_id, selector_region.id
= f.label "region_id_#{selector_region.id}" do
- if selector_region.code.present?
= flag_icon selector_region.code.downcase
= t selector_region.code, scope: :countries, default: selector_region.name
- else
%em.fa.fa-map
= selector_region
= selector_region
- if selector_region.regions.present?
%small
%em.fa.fa-chevron-right

Loading…
Cancel
Save