diff options
author | Sven Fuchs <svenfuchs@artweb-design.de> | 2008-08-13 09:53:25 +0200 |
---|---|---|
committer | Sven Fuchs <svenfuchs@artweb-design.de> | 2008-08-13 09:53:25 +0200 |
commit | f26380b7757666fa793c150538e8444a640d29aa (patch) | |
tree | b5a57505bd458d762751f57422852f5bff8f83ab | |
parent | bfa143fd4d15544e788d25ec163f9cc57a1e2a03 (diff) | |
download | rails-f26380b7757666fa793c150538e8444a640d29aa.tar.gz rails-f26380b7757666fa793c150538e8444a640d29aa.tar.bz2 rails-f26380b7757666fa793c150538e8444a640d29aa.zip |
switch to using I18n.load_translations instead of requiring plain ruby files
-rw-r--r-- | actionpack/lib/action_view.rb | 2 | ||||
-rw-r--r-- | actionpack/lib/action_view/locale/en-US.rb | 155 | ||||
-rw-r--r-- | activerecord/lib/active_record.rb | 2 | ||||
-rw-r--r-- | activerecord/lib/active_record/locale/en-US.rb | 47 | ||||
-rw-r--r-- | activesupport/lib/active_support.rb | 4 | ||||
-rw-r--r-- | activesupport/lib/active_support/locale/en-US.rb | 49 |
6 files changed, 131 insertions, 128 deletions
diff --git a/actionpack/lib/action_view.rb b/actionpack/lib/action_view.rb index dd555b3792..7e9ae9432d 100644 --- a/actionpack/lib/action_view.rb +++ b/actionpack/lib/action_view.rb @@ -35,7 +35,7 @@ require 'action_view/partials' 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 diff --git a/actionpack/lib/action_view/locale/en-US.rb b/actionpack/lib/action_view/locale/en-US.rb index 0119b3d9c1..8cce874700 100644 --- a/actionpack/lib/action_view/locale/en-US.rb +++ b/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:" } } -} +}
\ No newline at end of file diff --git a/activerecord/lib/active_record.rb b/activerecord/lib/active_record.rb index 17a7949959..08b6b19f7f 100644 --- a/activerecord/lib/active_record.rb +++ b/activerecord/lib/active_record.rb @@ -82,6 +82,6 @@ require 'active_record/connection_adapters/abstract_adapter' 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 diff --git a/activerecord/lib/active_record/locale/en-US.rb b/activerecord/lib/active_record/locale/en-US.rb index b31e13ed3a..4057a467e3 100644 --- a/activerecord/lib/active_record/locale/en-US.rb +++ b/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" + } + } } }
\ No newline at end of file diff --git a/activesupport/lib/active_support.rb b/activesupport/lib/active_support.rb index 51067e910e..6056067efd 100644 --- a/activesupport/lib/active_support.rb +++ b/activesupport/lib/active_support.rb @@ -58,8 +58,8 @@ require 'active_support/base64' 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') diff --git a/activesupport/lib/active_support/locale/en-US.rb b/activesupport/lib/active_support/locale/en-US.rb index 51324a90bf..ed457d6f4f 100644 --- a/activesupport/lib/active_support/locale/en-US.rb +++ b/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' + } } }
\ No newline at end of file |