Browse files

Comments on the exception handling.

  • Loading branch information...
1 parent f3f1093 commit 6fd42e365ed89e9e76eee172ae00e5df6c3aa3f6 Francesc Esplugas committed Feb 13, 2010
Showing with 2 additions and 0 deletions.
  1. +2 −0 app/helpers/admin/form_helper.rb
View
2 app/helpers/admin/form_helper.rb
@@ -364,11 +364,13 @@ def typus_template_field(attribute, template, options = {})
rescue ActionView::TemplateError => error
raise error
rescue Exception => error
+ # This is the user locale, which is missing.
locale = @current_user.preferences[:locale]
message = <<-HTML
Missing translation file <strong>#{locale}.yml</strong>. Download it <a href="http://github.com/svenfuchs/rails-i18n/blob/master/rails/locale/#{locale}.yml">here</a> and place it on `config/locales`.
HTML
flash[:error] = message
+ # We set a locale only for the current template.
I18n.locale = :en
retry
end

0 comments on commit 6fd42e3

Please sign in to comment.