Fixed loale links
This commit is contained in:
		
							parent
							
								
									a776870a6f
								
							
						
					
					
						commit
						77ef83508a
					
				| @ -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…
	
	
			
			x
			
			
		
	
		Reference in New Issue
	
	Block a user