|
Ok, this is the kind of thing that the lexicon stuff does. If we end up doing this alot (ourselves), we'll basically be re-inventing it Found the article about the lexicon stuff, it's http://search.cpan.org/~jhi/perl-5.8.1/lib/Locale/Maketext/TPJ13.pod We could use Time::Duration's 'ago': https://metacpan.org/module/Time::Duration#ago-seconds- {x} year/day/hour/minute/second(s) ago Which is five strings. This isn't Locale::Maketext's use case; if we were using Time::Duration's default of two unit-types precision we'd run into the complicated multiple-pluralizations-in-the-same-string problem, which is where Maketext starts making more sense (FSVO "more sense" – Maketext is needlessly complicated IMO, and I really doubt we need it). Feel free to investigate whatever line seems most appropriate - you folks are doing a better job at understanding i18n than I |
||||||||||||||||||||||||||||||||||
Essentially, I guess we need to have some logic like:
sub x_units_ago { my ($x, $units) = @_; given($units) { when ('hours') { ln('{x} hours ago', ...) } when ('days') { ln('{x} days ago', ...) } when ('months') { ln('{x} months ago', ...) } } }Right?