I like this set of
code:
before_filter :set_language
def set_language
request_language = request.env['HTTP_ACCEPT_LANGUAGE']
request_language = request_language.nil? ? nil :
request_language[/[^,;]+/]
I18n.locale = request_language if request_language &&
File.exist?("#{Rails.root.to_s}/config/locales/#{request_language}.yml")
end
if i setting config/application.rb:
config.i18n.default_locale = :zh
It can work, but not by 'HTTP_ACCEPT_LANGUAGE'..
I did the right thing?
--
-------------------------------------------------------------------------
learn log: http://me.boolsir.com
my life log: http://www.boolsir.com
-------------------------------------------------------------------------
--
You received this message because you are subscribed to the Google Groups "Ruby
on Rails: Core" group.
To post to this group, send email to [email protected].
To unsubscribe from this group, send email to
[email protected].
For more options, visit this group at
http://groups.google.com/group/rubyonrails-core?hl=en.