[Ovirt-devel] [PATCH server] Fix our i18n.
Jason Guiditta
jason.guiditta at gmail.com
Fri Jul 31 05:03:52 UTC 2009
I18n is not required in rails, so get our app to work right
with it (keeping gettext, so it will be largely free). Note
that at some point we do still need to internationalize the
text in the views.
Signed-off-by: Jason Guiditta <jason.guiditta at gmail.com>
---
src/app/controllers/application_controller.rb | 6 +++++-
src/config/environment.rb | 1 +
2 files changed, 6 insertions(+), 1 deletions(-)
diff --git a/src/app/controllers/application_controller.rb b/src/app/controllers/application_controller.rb
index 5ce625a..7e2041f 100644
--- a/src/app/controllers/application_controller.rb
+++ b/src/app/controllers/application_controller.rb
@@ -185,12 +185,16 @@ class ApplicationController < ActionController::Base
def instance_errors
hash = {}
+ arr = Array.new
instance_variables.each do |ivar|
val = instance_variable_get(ivar)
if val && val.respond_to?(:errors) && val.errors.size > 0
hash[:object] = ivar[1, ivar.size]
hash[:errors] ||= []
- hash[:errors] += val.errors.localize_error_messages.to_a
+ val.errors.each {|key,msg|
+ arr.push([key, val.errors.on_with_gettext_activerecord(key).to_a].to_a)
+ }
+ hash[:errors] += arr
end
end
return hash
diff --git a/src/config/environment.rb b/src/config/environment.rb
index 9d9a66d..913b9f9 100644
--- a/src/config/environment.rb
+++ b/src/config/environment.rb
@@ -42,6 +42,7 @@ Rails::Initializer.run do |config|
# config.gem "aws-s3", :lib => "aws/s3"
config.gem "cobbler"
config.gem "gettext", :lib => "gettext_rails"
+ config.gem "gettext", :lib => "gettext_activerecord"
# Only load the plugins named here, in the order given. By default, all plugins
# in vendor/plugins are loaded in alphabetical order.
--
1.6.2.5
More information about the ovirt-devel
mailing list