Module: ActionView::Helpers::DateHelper
- Includes:
- GetText
- Defined in:
- lib/gettext_rails/action_view/date_helper.rb
Overview
:nodoc:
Constant Summary collapse
- MESSAGESS =
This is FAKE constant. The messages are found by rgettext as the msgid.
[N_('less than 5 seconds'), N_('less than 10 seconds'), N_('less than 20 seconds'), N_('half a minute'), N_('less than a minute'), N_('about 1 month'), N_('about 1 year')]
- NMINUTES =
[/^(\d+) minutes?$/, Nn_('1 minute', '%{num} minutes')]
- NHOURS =
[/^about (\d+) hours?$/, Nn_('about 1 hour', 'about %{num} hours')]
- NDAYS =
[/^(\d+) days?$/, Nn_('1 day', '%{num} days')]
- NMONTHS =
[/^(\d+) months?$/, Nn_('1 month', '%{num} months')]
- NYEARS =
[/^over (\d+) years?$/, Nn_('over 1 year', 'over %{num} years')]
Instance Method Summary collapse
- #distance_of_time_in_words(from_time, to_time = 0, include_seconds = false) ⇒ Object
-
#distance_of_time_in_words_without_gettext_rails ⇒ Object
:nodoc:.
Methods included from GetText
#create_mofiles, #create_mofiles_org
Instance Method Details
#distance_of_time_in_words(from_time, to_time = 0, include_seconds = false) ⇒ Object
32 33 34 35 36 37 38 39 40 41 42 43 |
# File 'lib/gettext_rails/action_view/date_helper.rb', line 32 def distance_of_time_in_words(from_time, to_time = 0, include_seconds = false) msg = distance_of_time_in_words_without_gettext_rails(from_time, to_time, include_seconds) match = false [NMINUTES, NHOURS, NDAYS, NMONTHS, NYEARS].each do |regexp, nn| if regexp =~ msg match = true msg = n_(nn, $1.to_i) % {:num => $1} break end end match ? msg : _(msg) end |
#distance_of_time_in_words_without_gettext_rails ⇒ Object
:nodoc:
20 |
# File 'lib/gettext_rails/action_view/date_helper.rb', line 20 alias distance_of_time_in_words_without_gettext_rails distance_of_time_in_words |