Skip to content
Browse files

switch to using I18n.load_translations instead of requiring plain rub…

…y files
  • Loading branch information...
1 parent bfa143f commit f26380b7757666fa793c150538e8444a640d29aa @svenfuchs svenfuchs committed Aug 13, 2008
View
2 actionpack/lib/action_view.rb
@@ -35,7 +35,7 @@
require 'action_view/template_error'
I18n.backend.populate do
- require 'action_view/locale/en-US.rb'
+ I18n.load_translations File.dirname(__FILE__) + '/action_view/locale/en-US.rb'
end
ActionView::Base.class_eval do
View
155 actionpack/lib/action_view/locale/en-US.rb
@@ -1,86 +1,87 @@
-I18n.backend.store_translations :'en-US', {
- :datetime => {
- :distance_in_words => {
- :half_a_minute => 'half a minute',
- :less_than_x_seconds => {
- :one => 'less than 1 second',
- :many => 'less than {{count}} seconds'
- },
- :x_seconds => {
- :one => '1 second',
- :many => '{{count}} seconds'
- },
- :less_than_x_minutes => {
- :one => 'less than a minute',
- :many => 'less than {{count}} minutes'
- },
- :x_minutes => {
- :one => '1 minute',
- :many => '{{count}} minutes'
- },
- :about_x_hours => {
- :one => 'about 1 hour',
- :many => 'about {{count}} hours'
- },
- :x_days => {
- :one => '1 day',
- :many => '{{count}} days'
+{ :'en-US' => {
+ :datetime => {
+ :distance_in_words => {
+ :half_a_minute => 'half a minute',
+ :less_than_x_seconds => {
+ :one => 'less than 1 second',
+ :many => 'less than {{count}} seconds'
+ },
+ :x_seconds => {
+ :one => '1 second',
+ :many => '{{count}} seconds'
+ },
+ :less_than_x_minutes => {
+ :one => 'less than a minute',
+ :many => 'less than {{count}} minutes'
+ },
+ :x_minutes => {
+ :one => '1 minute',
+ :many => '{{count}} minutes'
+ },
+ :about_x_hours => {
+ :one => 'about 1 hour',
+ :many => 'about {{count}} hours'
+ },
+ :x_days => {
+ :one => '1 day',
+ :many => '{{count}} days'
+ },
+ :about_x_months => {
+ :one => 'about 1 month',
+ :many => 'about {{count}} months'
+ },
+ :x_months => {
+ :one => '1 month',
+ :many => '{{count}} months'
+ },
+ :about_x_years => {
+ :one => 'about 1 year',
+ :many => 'about {{count}} years'
+ },
+ :over_x_years => {
+ :one => 'over 1 year',
+ :many => 'over {{count}} years'
+ }
+ }
+ },
+ :number => {
+ :format => {
+ :precision => 3,
+ :separator => '.',
+ :delimiter => ','
},
- :about_x_months => {
- :one => 'about 1 month',
- :many => 'about {{count}} months'
+ :currency => {
+ :format => {
+ :unit => '$',
+ :precision => 2,
+ :format => '%u%n'
+ }
},
- :x_months => {
- :one => '1 month',
- :many => '{{count}} months'
+ :human => {
+ :format => {
+ :precision => 1,
+ :delimiter => ''
+ }
},
- :about_x_years => {
- :one => 'about 1 year',
- :many => 'about {{count}} years'
+ :percentage => {
+ :format => {
+ :delimiter => ''
+ }
},
- :over_x_years => {
- :one => 'over 1 year',
- :many => 'over {{count}} years'
+ :precision => {
+ :format => {
+ :delimiter => ''
+ }
}
- }
- },
- :number => {
- :format => {
- :precision => 3,
- :separator => '.',
- :delimiter => ','
},
- :currency => {
- :format => {
- :unit => '$',
- :precision => 2,
- :format => '%u%n'
+ :active_record => {
+ :error => {
+ :header_message => {
+ :one => "1 error prohibited this {{object_name}} from being saved",
+ :many => "{{count}} errors prohibited this {{object_name}} from being saved"
+ },
+ :message => "There were problems with the following fields:"
}
- },
- :human => {
- :format => {
- :precision => 1,
- :delimiter => ''
- }
- },
- :percentage => {
- :format => {
- :delimiter => ''
- }
- },
- :precision => {
- :format => {
- :delimiter => ''
- }
- }
- },
- :active_record => {
- :error => {
- :header_message => {
- :one => "1 error prohibited this {{object_name}} from being saved",
- :many => "{{count}} errors prohibited this {{object_name}} from being saved"
- },
- :message => "There were problems with the following fields:"
}
}
-}
+}
View
2 activerecord/lib/active_record.rb
@@ -82,6 +82,6 @@
require 'active_record/schema_dumper'
I18n.backend.populate do
- require 'active_record/locale/en-US.rb'
+ I18n.load_translations File.dirname(__FILE__) + '/active_record/locale/en-US.rb'
end
View
47 activerecord/lib/active_record/locale/en-US.rb
@@ -1,25 +1,26 @@
-I18n.backend.store_translations :'en-US', {
- :active_record => {
- :error_messages => {
- :inclusion => "is not included in the list",
- :exclusion => "is reserved",
- :invalid => "is invalid",
- :confirmation => "doesn't match confirmation",
- :accepted => "must be accepted",
- :empty => "can't be empty",
- :blank => "can't be blank",
- :too_long => "is too long (maximum is {{count}} characters)",
- :too_short => "is too short (minimum is {{count}} characters)",
- :wrong_length => "is the wrong length (should be {{count}} characters)",
- :taken => "has already been taken",
- :not_a_number => "is not a number",
- :greater_than => "must be greater than {{count}}",
- :greater_than_or_equal_to => "must be greater than or equal to {{count}}",
- :equal_to => "must be equal to {{count}}",
- :less_than => "must be less than {{count}}",
- :less_than_or_equal_to => "must be less than or equal to {{count}}",
- :odd => "must be odd",
- :even => "must be even"
- }
+{ :'en-US' => {
+ :active_record => {
+ :error_messages => {
+ :inclusion => "is not included in the list",
+ :exclusion => "is reserved",
+ :invalid => "is invalid",
+ :confirmation => "doesn't match confirmation",
+ :accepted => "must be accepted",
+ :empty => "can't be empty",
+ :blank => "can't be blank",
+ :too_long => "is too long (maximum is {{count}} characters)",
+ :too_short => "is too short (minimum is {{count}} characters)",
+ :wrong_length => "is the wrong length (should be {{count}} characters)",
+ :taken => "has already been taken",
+ :not_a_number => "is not a number",
+ :greater_than => "must be greater than {{count}}",
+ :greater_than_or_equal_to => "must be greater than or equal to {{count}}",
+ :equal_to => "must be equal to {{count}}",
+ :less_than => "must be less than {{count}}",
+ :less_than_or_equal_to => "must be less than or equal to {{count}}",
+ :odd => "must be odd",
+ :even => "must be even"
+ }
+ }
}
}
View
4 activesupport/lib/active_support.rb
@@ -58,8 +58,8 @@
require 'active_support/time_with_zone'
-I18n.backend.populate do
- require 'active_support/locale/en-US.rb'
+I18n.populate do
+ I18n.load_translations File.dirname(__FILE__) + '/active_support/locale/en-US.rb'
end
Inflector = ActiveSupport::Deprecation::DeprecatedConstantProxy.new('Inflector', 'ActiveSupport::Inflector')
View
49 activesupport/lib/active_support/locale/en-US.rb
@@ -1,28 +1,29 @@
-I18n.backend.store_translations :'en-US', {
- :support => {
- :array => {
- :sentence_connector => 'and'
- }
- },
- :date => {
- :formats => {
- :default => "%Y-%m-%d",
- :short => "%b %d",
- :long => "%B %d, %Y",
+{ :'en-US' => {
+ :support => {
+ :array => {
+ :sentence_connector => 'and'
+ }
},
- :day_names => Date::DAYNAMES,
- :abbr_day_names => Date::ABBR_DAYNAMES,
- :month_names => Date::MONTHNAMES,
- :abbr_month_names => Date::ABBR_MONTHNAMES,
- :order => [:year, :month, :day]
- },
- :time => {
- :formats => {
- :default => "%a, %d %b %Y %H:%M:%S %z",
- :short => "%d %b %H:%M",
- :long => "%B %d, %Y %H:%M",
+ :date => {
+ :formats => {
+ :default => "%Y-%m-%d",
+ :short => "%b %d",
+ :long => "%B %d, %Y",
+ },
+ :day_names => Date::DAYNAMES,
+ :abbr_day_names => Date::ABBR_DAYNAMES,
+ :month_names => Date::MONTHNAMES,
+ :abbr_month_names => Date::ABBR_MONTHNAMES,
+ :order => [:year, :month, :day]
},
- :am => 'am',
- :pm => 'pm'
+ :time => {
+ :formats => {
+ :default => "%a, %d %b %Y %H:%M:%S %z",
+ :short => "%d %b %H:%M",
+ :long => "%B %d, %Y %H:%M",
+ },
+ :am => 'am',
+ :pm => 'pm'
+ }
}
}

0 comments on commit f26380b

Please sign in to comment.
Something went wrong with that request. Please try again.