Fixed location formatting when region is not available
This commit is contained in:
parent
8f45b419f9
commit
68146a446b
@ -610,9 +610,11 @@ module ApplicationHelper
|
|||||||
return nil unless city.present?
|
return nil unless city.present?
|
||||||
|
|
||||||
hash = Hash.new
|
hash = Hash.new
|
||||||
hash[:city] = _!(city) unless city.blank?
|
region_translation = region.present? && country.present? ? _("geography.subregions.#{country}.#{region}", locale: locale) : ''
|
||||||
hash[:region] = _("geography.subregions.#{country}.#{region}", locale: locale) unless region.blank? || country.blank?
|
country_translation = country.present? ? _("geography.countries.#{country}", locale: locale) : ''
|
||||||
hash[:country] = _("geography.countries.#{country}", locale: locale) unless country.blank?
|
hash[:city] = _!(city) if city.present?
|
||||||
|
hash[:region] = region_translation if region_translation.present?
|
||||||
|
hash[:country] = country_translation if country_translation.present?
|
||||||
|
|
||||||
# return the formatted location or the first value if we only have one value
|
# return the formatted location or the first value if we only have one value
|
||||||
return hash.length > 1 ? _("geography.formats.#{hash.keys.join('_')}", locale: locale, vars: hash) : hash.values.first
|
return hash.length > 1 ? _("geography.formats.#{hash.keys.join('_')}", locale: locale, vars: hash) : hash.values.first
|
||||||
|
Loading…
x
Reference in New Issue
Block a user