From 70456aed31ae64b36563fc5d32ac114e0a095231 Mon Sep 17 00:00:00 2001 From: Sam Oliver Date: Mon, 22 Dec 2008 11:41:47 +0000 Subject: Use I18n for date/time select helpers prompt text [#561 state:resolved] Signed-off-by: Pratik Naik --- actionpack/lib/action_view/helpers/date_helper.rb | 8 ++------ actionpack/lib/action_view/locale/en.yml | 7 +++++++ 2 files changed, 9 insertions(+), 6 deletions(-) (limited to 'actionpack/lib/action_view') diff --git a/actionpack/lib/action_view/helpers/date_helper.rb b/actionpack/lib/action_view/helpers/date_helper.rb index 84ba5f0a8c..4305617ac8 100644 --- a/actionpack/lib/action_view/helpers/date_helper.rb +++ b/actionpack/lib/action_view/helpers/date_helper.rb @@ -572,10 +572,6 @@ module ActionView :year => 1, :month => 2, :day => 3, :hour => 4, :minute => 5, :second => 6 }.freeze unless const_defined?('POSITION') - DEFAULT_PROMPTS = { - :year => 'Year', :month => 'Month', :day => 'Day', :hour => 'Hour', :minute => 'Minute', :second => 'Seconds' - }.freeze unless const_defined?('DEFAULT_PROMPTS') - def initialize(datetime, options = {}, html_options = {}) @options = options.dup @html_options = html_options.dup @@ -842,10 +838,10 @@ module ActionView when String prompt = options else - prompt = ActionView::Helpers::DateTimeSelector::DEFAULT_PROMPTS[type.to_sym] + prompt = I18n.translate(('datetime.prompts.' + type.to_s).to_sym, :locale => @options[:locale]) end - prompt ? content_tag(:option, prompt, :value => '') : '' + prompt ? content_tag(:option, prompt, :value => '') : '' end # Builds hidden input tag for date part and value diff --git a/actionpack/lib/action_view/locale/en.yml b/actionpack/lib/action_view/locale/en.yml index 9542b035aa..a880fd83ef 100644 --- a/actionpack/lib/action_view/locale/en.yml +++ b/actionpack/lib/action_view/locale/en.yml @@ -80,6 +80,13 @@ over_x_years: one: "over 1 year" other: "over {{count}} years" + prompts: + year: "Year" + month: "Month" + day: "Day" + hour: "Hour" + minute: "Minute" + second: "Seconds" activerecord: errors: -- cgit v1.2.3