Packages

A lightweight Gleam library for formatting timestamps as human-readable relative time strings (e.g., '5 minutes ago', 'in 2 hours') with support for multiple locales.

Current section

8 Versions

Jump to

Compare versions

5 files changed
+224 additions
-67 deletions
  @@ -1,5 +1,5 @@
1 1 name = "timeago"
2 - version = "2.3.0"
2 + version = "2.4.0"
3 3
4 4 # Fill out these fields if you intend to generate HTML documentation or publish
5 5 # your project to the Hex package manager.
  @@ -1,6 +1,6 @@
1 1 {<<"name">>, <<"timeago">>}.
2 2 {<<"app">>, <<"timeago">>}.
3 - {<<"version">>, <<"2.3.0">>}.
3 + {<<"version">>, <<"2.4.0">>}.
4 4 {<<"description">>, <<"A lightweight Gleam library for formatting timestamps as human-readable relative time strings (e.g., '5 minutes ago', 'in 2 hours') with support for multiple locales."/utf8>>}.
5 5 {<<"licenses">>, [<<"Apache-2.0">>]}.
6 6 {<<"build_tools">>, [<<"gleam">>]}.
  @@ -1,5 +1,5 @@
1 1 {application, timeago, [
2 - {vsn, "2.3.0"},
2 + {vsn, "2.4.0"},
3 3 {applications, [gleam_stdlib,
4 4 gleam_time]},
5 5 {description, "A lightweight Gleam library for formatting timestamps as human-readable relative time strings (e.g., '5 minutes ago', 'in 2 hours') with support for multiple locales."},
  @@ -1,7 +1,7 @@
1 1 -module(timeago).
2 2 -compile([no_auto_import, nowarn_unused_vars, nowarn_unused_function, nowarn_nomatch]).
3 3 -define(FILEPATH, "src/timeago.gleam").
4 - -export([with_now/2, with_locale/2, format/2, en_us/3, new/0, fr/3, pt_br/3, de_de/3]).
4 + -export([with_now/2, with_locale/2, format/2, en_us/3, new/0, fr/3, pt_br/3, de_de/3, it_it/3]).
5 5 -export_type([time_ago/0, tense/0]).
6 6
7 7 -if(?OTP_RELEASE >= 27).
  @@ -14,18 +14,18 @@
14 14
15 15 ?MODULEDOC(
16 16 " A library for formatting timestamps as human-readable relative time strings.\n"
17 - " \n"
17 + "\n"
18 18 " This library provides a simple way to convert timestamps into relative time\n"
19 19 " expressions like \"5 minutes ago\" or \"in 2 hours\". It supports multiple\n"
20 20 " locales and allows customization of the reference time.\n"
21 - " \n"
21 + "\n"
22 22 " ## Basic Usage\n"
23 - " \n"
23 + "\n"
24 24 " ```gleam\n"
25 25 " import gleam/time/duration\n"
26 26 " import gleam/time/timestamp\n"
27 27 " import timeago\n"
28 - " \n"
28 + "\n"
29 29 " // Format a timestamp from 5 minutes ago\n"
30 30 " let past = timestamp.add(timestamp.system_time(), duration.minutes(-5))\n"
31 31 " timeago.new() |> timeago.format(past)\n"
  @@ -42,20 +42,20 @@
42 42 -file("src/timeago.gleam", 77).
43 43 ?DOC(
44 44 " Sets a custom reference time for calculating relative differences.\n"
45 - " \n"
45 + "\n"
46 46 " By default, TimeAgo uses the current system time when created. This allows\n"
47 47 " you to specify a different reference point for testing, calculating from\n"
48 48 " specific moments, or maintaining consistency across operations.\n"
49 - " \n"
49 + "\n"
50 50 " ## Examples\n"
51 - " \n"
51 + "\n"
52 52 " ```gleam\n"
53 53 " import gleam/time/timestamp\n"
54 54 " import timeago\n"
55 - " \n"
55 + "\n"
56 56 " let assert Ok(reference) = timestamp.parse_rfc3339(\"2024-01-01T12:00:00Z\")\n"
57 57 " let assert Ok(past) = timestamp.parse_rfc3339(\"2024-01-01T11:00:00Z\")\n"
58 - " \n"
58 + "\n"
59 59 " timeago.new()\n"
60 60 " |> timeago.with_now(reference)\n"
61 61 " |> timeago.format(past)\n"
  @@ -70,17 +70,17 @@ with_now(Time_ago, Now) ->
70 70 -file("src/timeago.gleam", 99).
71 71 ?DOC(
72 72 " Sets a custom locale function for formatting output strings.\n"
73 - " \n"
73 + "\n"
74 74 " The locale function determines how relative time is expressed in different\n"
75 75 " languages.\n"
76 - " \n"
76 + "\n"
77 77 " ## Examples\n"
78 - " \n"
78 + "\n"
79 79 " ```gleam\n"
80 80 " import gleam/time/duration\n"
81 81 " import gleam/time/timestamp\n"
82 82 " import timeago\n"
83 - " \n"
83 + "\n"
84 84 " // Using the built-in French locale\n"
85 85 " timeago.new()\n"
86 86 " |> timeago.with_locale(timeago.fr)\n"
  @@ -99,41 +99,41 @@ with_locale(Time_ago, Locale) ->
99 99 -file("src/timeago.gleam", 143).
100 100 ?DOC(
101 101 " Formats a timestamp as a human-readable relative time string.\n"
102 - " \n"
102 + "\n"
103 103 " Calculates the difference between the given timestamp and the reference time\n"
104 104 " (set via `with_now()` or defaulting to the current time), then formats it\n"
105 105 " using the configured locale.\n"
106 - " \n"
106 + "\n"
107 107 " The output automatically adjusts for singular/plural forms and selects\n"
108 108 " appropriate time units based on the magnitude of the difference.\n"
109 - " \n"
109 + "\n"
110 110 " ## Examples\n"
111 - " \n"
111 + "\n"
112 112 " ```gleam\n"
113 113 " import gleam/time/duration\n"
114 114 " import gleam/time/timestamp\n"
115 115 " import timeago\n"
116 - " \n"
116 + "\n"
117 117 " let now = timestamp.system_time()\n"
118 - " \n"
118 + "\n"
119 119 " // Past times\n"
120 120 " timeago.new()\n"
121 121 " |> timeago.format(timestamp.add(now, duration.seconds(-5)))\n"
122 122 " // -> \"5 seconds ago\"\n"
123 - " \n"
123 + "\n"
124 124 " timeago.new()\n"
125 125 " |> timeago.format(timestamp.add(now, duration.minutes(-1)))\n"
126 126 " // -> \"1 minute ago\"\n"
127 - " \n"
127 + "\n"
128 128 " // Future times\n"
129 129 " timeago.new()\n"
130 130 " |> timeago.format(timestamp.add(now, duration.hours(2)))\n"
131 131 " // -> \"in 2 hours\"\n"
132 - " \n"
132 + "\n"
133 133 " timeago.new()\n"
134 134 " |> timeago.format(timestamp.add(now, duration.days(1)))\n"
135 135 " // -> \"in 1 day\"\n"
136 - " \n"
136 + "\n"
137 137 " timeago.new()\n"
138 138 " |> timeago.format(timestamp.add(now, duration.milliseconds(-500)))\n"
139 139 " // -> \"just now\"\n"
  @@ -159,7 +159,8 @@ format(Time_ago, Timestamp) ->
159 159 replace_percent_d_with_int(S, I) ->
160 160 gleam@string:replace(S, <<"%d"/utf8>>, erlang:integer_to_binary(I)).
161 161
162 - -file("src/timeago.gleam", 180).
162 + -file("src/timeago.gleam", 182).
163 + ?DOC(" Translations for American English.\n").
163 164 -spec en_us(tense(), gleam@time@duration:unit(), integer()) -> binary().
164 165 en_us(Tense, Unit, Amount) ->
165 166 case {Tense, Unit, Amount} of
  @@ -274,17 +275,17 @@ en_us(Tense, Unit, Amount) ->
274 275 -file("src/timeago.gleam", 53).
275 276 ?DOC(
276 277 " Creates a new TimeAgo formatter with default settings.\n"
277 - " \n"
278 + "\n"
278 279 " Uses the current system time as the reference point and the English (US)\n"
279 280 " locale for formatting.\n"
280 - " \n"
281 + "\n"
281 282 " ## Examples\n"
282 - " \n"
283 + "\n"
283 284 " ```gleam\n"
284 285 " import gleam/time/duration\n"
285 286 " import gleam/time/timestamp\n"
286 287 " import timeago\n"
287 - " \n"
288 + "\n"
288 289 " timeago.new()\n"
289 290 " |> timeago.format(timestamp.add(timestamp.system_time(), duration.minutes(-5)))\n"
290 291 " // -> \"5 minutes ago\"\n"
  @@ -294,7 +295,8 @@ en_us(Tense, Unit, Amount) ->
294 295 new() ->
295 296 {time_ago, gleam@time@timestamp:system_time(), fun en_us/3}.
296 297
297 - -file("src/timeago.gleam", 214).
298 + -file("src/timeago.gleam", 218).
299 + ?DOC(" Translations for French.\n").
298 300 -spec fr(tense(), gleam@time@duration:unit(), integer()) -> binary().
299 301 fr(Tense, Unit, Amount) ->
300 302 case {Tense, Unit, Amount} of
  @@ -406,7 +408,7 @@ fr(Tense, Unit, Amount) ->
406 408 replace_percent_d_with_int(_pipe@13, A@13)
407 409 end.
408 410
409 - -file("src/timeago.gleam", 249).
411 + -file("src/timeago.gleam", 254).
410 412 ?DOC(" Translations for Brazilian Portuguese.\n").
411 413 -spec pt_br(tense(), gleam@time@duration:unit(), integer()) -> binary().
412 414 pt_br(Tense, Unit, Amount) ->
  @@ -519,8 +521,8 @@ pt_br(Tense, Unit, Amount) ->
519 521 replace_percent_d_with_int(_pipe@13, A@13)
520 522 end.
521 523
522 - -file("src/timeago.gleam", 284).
523 - ?DOC(" Translations for German\n").
524 + -file("src/timeago.gleam", 290).
525 + ?DOC(" Translations for German.\n").
524 526 -spec de_de(tense(), gleam@time@duration:unit(), integer()) -> binary().
525 527 de_de(Tense, Unit, Amount) ->
526 528 case {Tense, Unit, Amount} of
  @@ -631,3 +633,116 @@ de_de(Tense, Unit, Amount) ->
631 633 _pipe@13 = <<"in %d Jahren"/utf8>>,
632 634 replace_percent_d_with_int(_pipe@13, A@13)
633 635 end.
636 +
637 + -file("src/timeago.gleam", 326).
638 + ?DOC(" Translations for Italian.\n").
639 + -spec it_it(tense(), gleam@time@duration:unit(), integer()) -> binary().
640 + it_it(Tense, Unit, Amount) ->
641 + case {Tense, Unit, Amount} of
642 + {_, nanosecond, _} ->
643 + <<"proprio adesso"/utf8>>;
644 +
645 + {_, microsecond, _} ->
646 + <<"proprio adesso"/utf8>>;
647 +
648 + {_, millisecond, _} ->
649 + <<"proprio adesso"/utf8>>;
650 +
651 + {past, second, 1} ->
652 + <<"1 secondo fa"/utf8>>;
653 +
654 + {past, second, A} ->
655 + _pipe = <<"%d secondi fa"/utf8>>,
656 + replace_percent_d_with_int(_pipe, A);
657 +
658 + {past, minute, 1} ->
659 + <<"1 minuto fa"/utf8>>;
660 +
661 + {past, minute, A@1} ->
662 + _pipe@1 = <<"%d minuti fa"/utf8>>,
663 + replace_percent_d_with_int(_pipe@1, A@1);
664 +
665 + {past, hour, 1} ->
666 + <<"1 ora fa"/utf8>>;
667 +
668 + {past, hour, A@2} ->
669 + _pipe@2 = <<"%d ore fa"/utf8>>,
670 + replace_percent_d_with_int(_pipe@2, A@2);
671 +
672 + {past, day, 1} ->
673 + <<"1 giorno fa"/utf8>>;
674 +
675 + {past, day, A@3} ->
676 + _pipe@3 = <<"%d giorni fa"/utf8>>,
677 + replace_percent_d_with_int(_pipe@3, A@3);
678 +
679 + {past, week, 1} ->
680 + <<"1 settimana fa"/utf8>>;
681 +
682 + {past, week, A@4} ->
683 + _pipe@4 = <<"%d settimane fa"/utf8>>,
684 + replace_percent_d_with_int(_pipe@4, A@4);
685 +
686 + {past, month, 1} ->
687 + <<"1 mese fa"/utf8>>;
688 +
689 + {past, month, A@5} ->
690 + _pipe@5 = <<"%d mesi fa"/utf8>>,
691 + replace_percent_d_with_int(_pipe@5, A@5);
692 +
693 + {past, year, 1} ->
694 + <<"1 anno fa"/utf8>>;
695 +
696 + {past, year, A@6} ->
697 + _pipe@6 = <<"%d anni fa"/utf8>>,
698 + replace_percent_d_with_int(_pipe@6, A@6);
699 +
700 + {future, second, 1} ->
701 + <<"fra 1 secondo"/utf8>>;
702 +
703 + {future, second, A@7} ->
704 + _pipe@7 = <<"fra %d secondi"/utf8>>,
705 + replace_percent_d_with_int(_pipe@7, A@7);
706 +
707 + {future, minute, 1} ->
708 + <<"fra 1 minuto"/utf8>>;
709 +
710 + {future, minute, A@8} ->
711 + _pipe@8 = <<"fra %d minuti"/utf8>>,
712 + replace_percent_d_with_int(_pipe@8, A@8);
713 +
714 + {future, hour, 1} ->
715 + <<"fra 1 ora"/utf8>>;
716 +
717 + {future, hour, A@9} ->
718 + _pipe@9 = <<"fra %d ore"/utf8>>,
719 + replace_percent_d_with_int(_pipe@9, A@9);
720 +
721 + {future, day, 1} ->
722 + <<"fra 1 giorno"/utf8>>;
723 +
724 + {future, day, A@10} ->
725 + _pipe@10 = <<"fra %d giorni"/utf8>>,
726 + replace_percent_d_with_int(_pipe@10, A@10);
727 +
728 + {future, week, 1} ->
729 + <<"fra 1 settimana"/utf8>>;
730 +
731 + {future, week, A@11} ->
732 + _pipe@11 = <<"fra %d settimane"/utf8>>,
733 + replace_percent_d_with_int(_pipe@11, A@11);
734 +
735 + {future, month, 1} ->
736 + <<"fra 1 mese"/utf8>>;
737 +
738 + {future, month, A@12} ->
739 + _pipe@12 = <<"fra %d mesi"/utf8>>,
740 + replace_percent_d_with_int(_pipe@12, A@12);
741 +
742 + {future, year, 1} ->
743 + <<"fra 1 anno"/utf8>>;
744 +
745 + {future, year, A@13} ->
746 + _pipe@13 = <<"fra %d anni"/utf8>>,
747 + replace_percent_d_with_int(_pipe@13, A@13)
748 + end.
  @@ -1,16 +1,16 @@
1 1 //// A library for formatting timestamps as human-readable relative time strings.
2 - ////
2 + ////
3 3 //// This library provides a simple way to convert timestamps into relative time
4 4 //// expressions like "5 minutes ago" or "in 2 hours". It supports multiple
5 5 //// locales and allows customization of the reference time.
6 - ////
6 + ////
7 7 //// ## Basic Usage
8 - ////
8 + ////
9 9 //// ```gleam
10 10 //// import gleam/time/duration
11 11 //// import gleam/time/timestamp
12 12 //// import timeago
13 - ////
13 + ////
14 14 //// // Format a timestamp from 5 minutes ago
15 15 //// let past = timestamp.add(timestamp.system_time(), duration.minutes(-5))
16 16 //// timeago.new() |> timeago.format(past)
  @@ -26,7 +26,7 @@ import gleam/time/duration.{
26 26 import gleam/time/timestamp.{type Timestamp}
27 27
28 28 /// Configuration for formatting relative time strings.
29 - ///
29 + ///
30 30 /// Encapsulates the reference time and locale settings used when formatting
31 31 /// timestamps. Use the builder pattern with `new()`, `with_now()`, and
32 32 /// `with_locale()` to configure instances.
  @@ -35,17 +35,17 @@ pub opaque type TimeAgo {
35 35 }
36 36
37 37 /// Creates a new TimeAgo formatter with default settings.
38 - ///
38 + ///
39 39 /// Uses the current system time as the reference point and the English (US)
40 40 /// locale for formatting.
41 - ///
41 + ///
42 42 /// ## Examples
43 - ///
43 + ///
44 44 /// ```gleam
45 45 /// import gleam/time/duration
46 46 /// import gleam/time/timestamp
47 47 /// import timeago
48 - ///
48 + ///
49 49 /// timeago.new()
50 50 /// |> timeago.format(timestamp.add(timestamp.system_time(), duration.minutes(-5)))
51 51 /// // -> "5 minutes ago"
  @@ -55,20 +55,20 @@ pub fn new() -> TimeAgo {
55 55 }
56 56
57 57 /// Sets a custom reference time for calculating relative differences.
58 - ///
58 + ///
59 59 /// By default, TimeAgo uses the current system time when created. This allows
60 60 /// you to specify a different reference point for testing, calculating from
61 61 /// specific moments, or maintaining consistency across operations.
62 - ///
62 + ///
63 63 /// ## Examples
64 - ///
64 + ///
65 65 /// ```gleam
66 66 /// import gleam/time/timestamp
67 67 /// import timeago
68 - ///
68 + ///
69 69 /// let assert Ok(reference) = timestamp.parse_rfc3339("2024-01-01T12:00:00Z")
70 70 /// let assert Ok(past) = timestamp.parse_rfc3339("2024-01-01T11:00:00Z")
71 - ///
71 + ///
72 72 /// timeago.new()
73 73 /// |> timeago.with_now(reference)
74 74 /// |> timeago.format(past)
  @@ -79,17 +79,17 @@ pub fn with_now(time_ago: TimeAgo, now: Timestamp) -> TimeAgo {
79 79 }
80 80
81 81 /// Sets a custom locale function for formatting output strings.
82 - ///
82 + ///
83 83 /// The locale function determines how relative time is expressed in different
84 84 /// languages.
85 - ///
85 + ///
86 86 /// ## Examples
87 - ///
87 + ///
88 88 /// ```gleam
89 89 /// import gleam/time/duration
90 90 /// import gleam/time/timestamp
91 91 /// import timeago
92 - ///
92 + ///
93 93 /// // Using the built-in French locale
94 94 /// timeago.new()
95 95 /// |> timeago.with_locale(timeago.fr)
  @@ -101,41 +101,41 @@ pub fn with_locale(time_ago: TimeAgo, locale: Locale) -> TimeAgo {
101 101 }
102 102
103 103 /// Formats a timestamp as a human-readable relative time string.
104 - ///
104 + ///
105 105 /// Calculates the difference between the given timestamp and the reference time
106 106 /// (set via `with_now()` or defaulting to the current time), then formats it
107 107 /// using the configured locale.
108 - ///
108 + ///
109 109 /// The output automatically adjusts for singular/plural forms and selects
110 110 /// appropriate time units based on the magnitude of the difference.
111 - ///
111 + ///
112 112 /// ## Examples
113 - ///
113 + ///
114 114 /// ```gleam
115 115 /// import gleam/time/duration
116 116 /// import gleam/time/timestamp
117 117 /// import timeago
118 - ///
118 + ///
119 119 /// let now = timestamp.system_time()
120 - ///
120 + ///
121 121 /// // Past times
122 122 /// timeago.new()
123 123 /// |> timeago.format(timestamp.add(now, duration.seconds(-5)))
124 124 /// // -> "5 seconds ago"
125 - ///
125 + ///
126 126 /// timeago.new()
127 127 /// |> timeago.format(timestamp.add(now, duration.minutes(-1)))
128 128 /// // -> "1 minute ago"
129 - ///
129 + ///
130 130 /// // Future times
131 131 /// timeago.new()
132 132 /// |> timeago.format(timestamp.add(now, duration.hours(2)))
133 133 /// // -> "in 2 hours"
134 - ///
134 + ///
135 135 /// timeago.new()
136 136 /// |> timeago.format(timestamp.add(now, duration.days(1)))
137 137 /// // -> "in 1 day"
138 - ///
138 + ///
139 139 /// timeago.new()
140 140 /// |> timeago.format(timestamp.add(now, duration.milliseconds(-500)))
141 141 /// // -> "just now"
  @@ -153,7 +153,7 @@ pub fn format(time_ago: TimeAgo, timestamp: Timestamp) -> String {
153 153 }
154 154
155 155 /// Represents the temporal direction of a time difference.
156 - ///
156 + ///
157 157 /// Used to determine whether a timestamp is in the past or future relative
158 158 /// to a reference time.
159 159 pub type Tense {
  @@ -167,7 +167,7 @@ pub type Tense {
167 167 }
168 168
169 169 /// A function that formats relative time strings for a specific language and locale.
170 - ///
170 + ///
171 171 /// Receives tense (past/future), unit (seconds, minutes, etc.), and amount,
172 172 /// then returns a formatted string like "5 minutes ago" or "in 2 hours".
173 173 pub type Locale =
  @@ -177,6 +177,8 @@ fn replace_percent_d_with_int(s: String, i: Int) -> String {
177 177 string.replace(s, "%d", int.to_string(i))
178 178 }
179 179
180 + /// Translations for American English.
181 + ///
180 182 pub fn en_us(tense: Tense, unit: Unit, amount: Int) -> String {
181 183 case tense, unit, amount {
182 184 _, Nanosecond, _ | _, Microsecond, _ | _, Millisecond, _ -> "just now"
  @@ -211,6 +213,8 @@ pub fn en_us(tense: Tense, unit: Unit, amount: Int) -> String {
211 213 }
212 214 }
213 215
216 + /// Translations for French.
217 + ///
214 218 pub fn fr(tense: Tense, unit: Unit, amount: Int) -> String {
215 219 case tense, unit, amount {
216 220 _, Nanosecond, _ | _, Microsecond, _ | _, Millisecond, _ -> "à l'instant"
  @@ -246,6 +250,7 @@ pub fn fr(tense: Tense, unit: Unit, amount: Int) -> String {
246 250 }
247 251
248 252 /// Translations for Brazilian Portuguese.
253 + ///
249 254 pub fn pt_br(tense: Tense, unit: Unit, amount: Int) -> String {
250 255 case tense, unit, amount {
251 256 _, Nanosecond, _ | _, Microsecond, _ | _, Millisecond, _ -> "agora mesmo"
  @@ -280,7 +285,8 @@ pub fn pt_br(tense: Tense, unit: Unit, amount: Int) -> String {
280 285 }
281 286 }
282 287
283 - /// Translations for German
288 + /// Translations for German.
289 + ///
284 290 pub fn de_de(tense: Tense, unit: Unit, amount: Int) -> String {
285 291 case tense, unit, amount {
286 292 _, Nanosecond, _ | _, Microsecond, _ | _, Millisecond, _ -> "jetzt"
  @@ -314,3 +320,39 @@ pub fn de_de(tense: Tense, unit: Unit, amount: Int) -> String {
314 320 Future, Year, a -> "in %d Jahren" |> replace_percent_d_with_int(a)
315 321 }
316 322 }
323 +
324 + /// Translations for Italian.
325 + ///
326 + pub fn it_it(tense: Tense, unit: Unit, amount: Int) -> String {
327 + case tense, unit, amount {
328 + _, Nanosecond, _ | _, Microsecond, _ | _, Millisecond, _ -> "proprio adesso"
329 + Past, Second, 1 -> "1 secondo fa"
330 + Past, Second, a -> "%d secondi fa" |> replace_percent_d_with_int(a)
331 + Past, Minute, 1 -> "1 minuto fa"
332 + Past, Minute, a -> "%d minuti fa" |> replace_percent_d_with_int(a)
333 + Past, Hour, 1 -> "1 ora fa"
334 + Past, Hour, a -> "%d ore fa" |> replace_percent_d_with_int(a)
335 + Past, Day, 1 -> "1 giorno fa"
336 + Past, Day, a -> "%d giorni fa" |> replace_percent_d_with_int(a)
337 + Past, Week, 1 -> "1 settimana fa"
338 + Past, Week, a -> "%d settimane fa" |> replace_percent_d_with_int(a)
339 + Past, Month, 1 -> "1 mese fa"
340 + Past, Month, a -> "%d mesi fa" |> replace_percent_d_with_int(a)
341 + Past, Year, 1 -> "1 anno fa"
342 + Past, Year, a -> "%d anni fa" |> replace_percent_d_with_int(a)
343 + Future, Second, 1 -> "fra 1 secondo"
344 + Future, Second, a -> "fra %d secondi" |> replace_percent_d_with_int(a)
345 + Future, Minute, 1 -> "fra 1 minuto"
346 + Future, Minute, a -> "fra %d minuti" |> replace_percent_d_with_int(a)
347 + Future, Hour, 1 -> "fra 1 ora"
348 + Future, Hour, a -> "fra %d ore" |> replace_percent_d_with_int(a)
349 + Future, Day, 1 -> "fra 1 giorno"
350 + Future, Day, a -> "fra %d giorni" |> replace_percent_d_with_int(a)
351 + Future, Week, 1 -> "fra 1 settimana"
352 + Future, Week, a -> "fra %d settimane" |> replace_percent_d_with_int(a)
353 + Future, Month, 1 -> "fra 1 mese"
354 + Future, Month, a -> "fra %d mesi" |> replace_percent_d_with_int(a)
355 + Future, Year, 1 -> "fra 1 anno"
356 + Future, Year, a -> "fra %d anni" |> replace_percent_d_with_int(a)
357 + }
358 + }