Customisation of language settings

0 views
Skip to first unread message

Maciej Piechotka

unread,
Jun 23, 2008, 5:18:47 PM6/23/08
to Merb Global Mailing List
During the discussion with Pavel Kunc it was discovered that the manual
setting of language does not work (ticket #20
[http://trac.ikonoklastik.com/merb_global/ticket/20]). There are several
solution to this problem:

1. Try to fix the current code somehow. If it is not possible add the
language :method call

class Application
language :user_language

def user_language
self.lang = current_user.language
end
end

2. Leave it to the user. Possibly adding the helper methods like
language_from_http_accept_language(env, auto_choose = true) and/or
leaving the auto detection as default option [somehow].

class Application < Merb::Controller
before :set_language

def set_language
self.lang ||= params[:language]
self.lang ||= current_user.language if current_user
self.lang ||= language_from_http_accept_language env
self.lang ||= 'en'
end
end

Personally I prefer the first option which IMHO have bigger usability.

signature.asc
Reply all
Reply to author
Forward
0 new messages