method

distance_of_time_in_words

distance_of_time_in_words(from_time, to_time = 0, include_seconds = false)
public

Reports the approximate distance in time between two Time objects or integers. For example, if the distance is 47 minutes, it’ll return "about 1 hour". See the source for the complete wording list.

Integers are interpreted as seconds. So, distance_of_time_in_words(50) returns "less than a minute".

Set include_seconds to true if you want more detailed approximations if distance < 1 minute

1Note

Nice german translation independet of structure of a sentence

tordans · Sep 27, 2010

Eine pragmatische Lösung für das Übersetzungsproblem der Rails Methode distance_of_time_in_words(). Im Deutschen wird je nach Satzbau eine andere Ausgabe benötigt.

Vor mehr als 5 Monaten"/"Vor etwa einem Jahr" — statt wie im Original "Dauer: mehr als 5 Monate"/"Dauer: etwa 1 Jahr

http://gist.github.com/598965