lib/restfulness/resource.rb in restfulness-0.2.3 vs lib/restfulness/resource.rb in restfulness-0.2.4
- old
+ new
@@ -49,10 +49,13 @@
def etag
nil
end
def check_callbacks
+ # Locale Handling
+ set_locale
+
# Access control
method_not_allowed! unless method_allowed?
unauthorized! unless authorized?
forbidden! unless allowed?
@@ -67,9 +70,17 @@
end
end
end
protected
+
+ def locale
+ request.http_accept_language.compatible_language_from(I18n.available_locales)
+ end
+
+ def set_locale
+ I18n.locale = locale
+ end
def logger
Restfulness.logger
end