|
@ -217,15 +217,18 @@ module ApplicationHelper |
|
|
end |
|
|
end |
|
|
|
|
|
|
|
|
def url_for_locale(locale, url = nil) |
|
|
def url_for_locale(locale, url = nil) |
|
|
|
|
|
return url unless locale.present? |
|
|
|
|
|
|
|
|
unless url.present? |
|
|
unless url.present? |
|
|
new_params = params.merge({action: (params[:_original_action] || params[:action])}) |
|
|
new_params = params.merge({action: (params[:_original_action] || params[:action])}) |
|
|
new_params.delete(:_original_action) |
|
|
new_params.delete(:_original_action) |
|
|
|
|
|
|
|
|
if Rails.env.development? || Rails.env.test? |
|
|
if Rails.env.development? || Rails.env.test? |
|
|
url = url_for(new_params.merge({lang: locale.to_s})) |
|
|
return url_for(new_params.merge({lang: locale.to_s})) |
|
|
else |
|
|
|
|
|
url = url_for(new_params) |
|
|
|
|
|
end |
|
|
end |
|
|
|
|
|
|
|
|
|
|
|
subdomain = Rails.env.preview? ? "preview-#{locale.to_s}" : locale.to_s |
|
|
|
|
|
return url_for(new_params.merge(host: "#{subdomain}.bikebike.org")) |
|
|
end |
|
|
end |
|
|
|
|
|
|
|
|
return url if Rails.env.development? || Rails.env.test? |
|
|
return url if Rails.env.development? || Rails.env.test? |
|
|