# Problems switching language after search form resuls

**URL:** <https://www.ruby-forum.com/t/problems-switching-language-after-search-form-resuls/176573>\
**Category:** Rails I18n\
**Created:** [October 2, 2009, 1:02pm UTC](https://www.ruby-forum.com/t/problems-switching-language-after-search-form-resuls/176573 "2009-10-02T13:02:51Z")\
**Posts on this page:** 1\
**Page:** 1

<div class="post-metadata">

**Author:** ![mitch\_newbie](https://www.ruby-forum.com/letter_avatar_proxy/v4/letter/m/ea5d25/32.png) [@mitch\_newbie](https://www.ruby-forum.com/u/mitch_newbie)\
**Post date:** [October 2, 2009, 1:02pm UTC](https://www.ruby-forum.com/t/problems-switching-language-after-search-form-resuls/176573/1 "2009-10-02T13:02:51Z")

</div>

I have a form that allows the user to search for a manufacturer. It  
works fine.

Now I am making the site in two languages French and English. I have the  
basics of I18ln working as suggested in Agile Web D. book.

However for this particular case there is a problem. If the user chooses  
to switch languages after the results come back the information is no  
longer being sent as a request.post. In the controller I test for this  
to make sure the information is coming from the form for security  
reason.

#takes the information entered on the search products box and returns  
a list of possible matches.  
def search  
if request.post?  
@manufacturer\_matches =  
Manufacturer.find\_all(params[:manufacturer])  
unless @manufacturer\_matches[0]  
flash[:search] = t(‘manufacturers.search.flash’, :manufacturer  
=\> params[:manufacturer] )  
end  
end  
end

(find all is a method in the Manufacturers model.)

If i remove the request.post? potential hackers can get in and the  
parameters from the search box are not passed so the search returns  
nothing.

Any ideas on the best practices to be
