Browse Source

Fixed loale links

development
Godwin 8 years ago
parent
commit
77ef83508a
  1. 6
      app/helpers/i18n_helper.rb

6
app/helpers/i18n_helper.rb

@ -2,18 +2,18 @@
module I18nHelper module I18nHelper
def url_for_locale(locale, url = nil) def url_for_locale(locale, url = nil)
return url unless locale.present? return url unless locale.present?
url ||= current_path url ||= current_path(true)
return url if Rails.env.development? || Rails.env.test? return url if Rails.env.development? || Rails.env.test?
return "https://preview-#{locale.to_s}.bikebike.org#{url}" if Rails.env.preview? return "https://preview-#{locale.to_s}.bikebike.org#{url}" if Rails.env.preview?
"https://#{locale.to_s}.bikebike.org#{url}" "https://#{locale.to_s}.bikebike.org#{url}"
end end
def current_path def current_path(relative = false)
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 relative || Rails.env.development? || Rails.env.test?
return url_for(new_params.merge({lang: locale.to_s})) return url_for(new_params.merge({lang: locale.to_s}))
end end

Loading…
Cancel
Save