sample/app/controllers/application_controller.rb in gettext_rails-2.0.0 vs sample/app/controllers/application_controller.rb in gettext_rails-2.0.1

- old
+ new

@@ -16,19 +16,21 @@ # The textdomains are applied to each controllers/views. init_gettext "blog" # textdomain, options(:charset, :content_type) I18n.supported_locales = Dir[ File.join(RAILS_ROOT, 'locale/*') ].collect{|v| File.basename(v)} -=begin # You can set callback methods. These methods are called on the each WWW request. - def before_init_gettext(cgi) +=begin + def sample_before_init_gettext p "before_init_gettext" + set_locale "zh" # Set locale forcely. end - def after_init_gettext(cgi) + before_init_gettext :sample_before_init_gettext + def sample_after_init_gettext p "after_init_gettext" end + after_init_gettext :sample_after_init_gettext =end - =begin # you can redefined the title/explanation of the top of the error message. ActionView::Helpers::ActiveRecordHelper::L10n.set_error_message_title(N_("An error is occured on %{record}"), N_("%{num} errors are occured on %{record}")) ActionView::Helpers::ActiveRecordHelper::L10n.set_error_message_explanation(N_("The error is:"), N_("The errors are:")) =end