Don''t you need a .to_sym on it as i18n expects a symbol only I think.
Sent from my iPhone
On 5 Sep 2011, at 06:54, "B.Tag" <bb.qnyd@gmail.com> wrote:
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 rubyonrails-core@googlegroups.com.
To unsubscribe from this group, send email to
rubyonrails-core+unsubscribe@googlegroups.com.
For more options, visit this group at
http://groups.google.com/group/rubyonrails-core?hl=en.
--
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 rubyonrails-core@googlegroups.com.
To unsubscribe from this group, send email to
rubyonrails-core+unsubscribe@googlegroups.com.
For more options, visit this group at
http://groups.google.com/group/rubyonrails-core?hl=en.