Module: ActionView::Helpers::DateHelper

Includes:
GetText
Defined in:
lib/gettext/rails.rb

Overview

:nodoc: all

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'), N_('over 2 years')]
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')]

Constants included from GetText

GetText::VERSION

Instance Method Summary collapse

Methods included from GetText

N_, #Nn_, _, #add_default_locale_path, bindtextdomain, #bindtextdomain_to, bound_target, bound_targets, cached=, cached?, cgi, cgi=, clear_cache, create_mofiles, current_textdomain_info, each_textdomain, find_targets, gettext, included, locale, locale=, msgmerge, msgmerge_all, n_, ngettext, ns_, nsgettext, output_charset, output_charset=, rgettext, rmsgfmt, rmsgmerge, s_, set_cgi, set_locale, set_locale_all, set_output_charset, setlocale, sgettext, textdomain, #textdomain_to, update_pofiles

Instance Method Details

#distance_of_time_in_words(from_time, to_time = 0, include_seconds = false) ⇒ Object



411
412
413
414
415
416
417
418
419
420
421
422
423
424
# File 'lib/gettext/rails.rb', line 411

def distance_of_time_in_words(from_time, to_time = 0, include_seconds = false)
	textdomain("rails")

	msg = distance_of_time_in_words_without_locale(from_time, to_time, include_seconds)
	match = false
	[NMINUTES, NHOURS, NDAYS, NMONTHS].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_localeObject

:nodoc:



400
# File 'lib/gettext/rails.rb', line 400

alias distance_of_time_in_words_without_locale distance_of_time_in_words