Jun
12

stephen kung 发来的解决方案:

def index
  @header = request.env[’HTTP_ACCEPT_LANGUAGE’]
  case @header
    when /zh-cn.*/
      @location=’china’
    when /en-us.*/
      @location=’english’
    else
      @location=’english’
  end
  render :text => @location
end

read more:

http://wiki.rubyonrails.org/rails/pages/VariablesInRequestEnv

Share and Enjoy:These icons link to social bookmarking sites where readers can share and discover new web pages.
  • del.icio.us
  • digg

Tags:

No Responses

Leave a Response

XHTML: You can use these tags: <a href="" title=""> <abbr title=""> <acronym title=""> <b> <blockquote cite=""> <code> <em> <i> <strike> <strong>