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
+703 additions
-9 deletions
  @@ -1,5 +1,5 @@
1 1 name = "timeago"
2 - version = "2.4.0"
2 + version = "2.5.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.4.0">>}.
3 + {<<"version">>, <<"2.5.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">>]}.
  @@ -8,15 +8,15 @@
8 8 {<<"Repository">>, <<"https://github.com/ayoung19/timeago">>}
9 9 ]}.
10 10 {<<"requirements">>, [
11 - {<<"gleam_time">>, [
12 - {<<"app">>, <<"gleam_time">>},
13 - {<<"optional">>, false},
14 - {<<"requirement">>, <<">= 1.3.0 and < 2.0.0">>}
15 - ]},
16 11 {<<"gleam_stdlib">>, [
17 12 {<<"app">>, <<"gleam_stdlib">>},
18 13 {<<"optional">>, false},
19 14 {<<"requirement">>, <<">= 0.44.0 and < 2.0.0">>}
15 + ]},
16 + {<<"gleam_time">>, [
17 + {<<"app">>, <<"gleam_time">>},
18 + {<<"optional">>, false},
19 + {<<"requirement">>, <<">= 1.3.0 and < 2.0.0">>}
20 20 ]}
21 21 ]}.
22 22 {<<"files">>, [
  @@ -1,5 +1,5 @@
1 1 {application, timeago, [
2 - {vsn, "2.4.0"},
2 + {vsn, "2.5.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, it_it/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, es_es/3, pl_pl/3]).
5 5 -export_type([time_ago/0, tense/0]).
6 6
7 7 -if(?OTP_RELEASE >= 27).
  @@ -746,3 +746,517 @@ it_it(Tense, Unit, Amount) ->
746 746 _pipe@13 = <<"fra %d anni"/utf8>>,
747 747 replace_percent_d_with_int(_pipe@13, A@13)
748 748 end.
749 +
750 + -file("src/timeago.gleam", 362).
751 + ?DOC(" Translations for Spanish.\n").
752 + -spec es_es(tense(), gleam@time@duration:unit(), integer()) -> binary().
753 + es_es(Tense, Unit, Amount) ->
754 + case {Tense, Unit, Amount} of
755 + {_, nanosecond, _} ->
756 + <<"ahora mismo"/utf8>>;
757 +
758 + {_, microsecond, _} ->
759 + <<"ahora mismo"/utf8>>;
760 +
761 + {_, millisecond, _} ->
762 + <<"ahora mismo"/utf8>>;
763 +
764 + {past, second, 1} ->
765 + <<"hace 1 segundo"/utf8>>;
766 +
767 + {past, second, A} ->
768 + _pipe = <<"hace %d segundos"/utf8>>,
769 + replace_percent_d_with_int(_pipe, A);
770 +
771 + {past, minute, 1} ->
772 + <<"hace 1 minuto"/utf8>>;
773 +
774 + {past, minute, A@1} ->
775 + _pipe@1 = <<"hace %d minutos"/utf8>>,
776 + replace_percent_d_with_int(_pipe@1, A@1);
777 +
778 + {past, hour, 1} ->
779 + <<"hace 1 hora"/utf8>>;
780 +
781 + {past, hour, A@2} ->
782 + _pipe@2 = <<"hace %d horas"/utf8>>,
783 + replace_percent_d_with_int(_pipe@2, A@2);
784 +
785 + {past, day, 1} ->
786 + <<"hace 1 día"/utf8>>;
787 +
788 + {past, day, A@3} ->
789 + _pipe@3 = <<"hace %d días"/utf8>>,
790 + replace_percent_d_with_int(_pipe@3, A@3);
791 +
792 + {past, week, 1} ->
793 + <<"hace 1 semana"/utf8>>;
794 +
795 + {past, week, A@4} ->
796 + _pipe@4 = <<"hace %d semanas"/utf8>>,
797 + replace_percent_d_with_int(_pipe@4, A@4);
798 +
799 + {past, month, 1} ->
800 + <<"hace 1 mes"/utf8>>;
801 +
802 + {past, month, A@5} ->
803 + _pipe@5 = <<"hace %d meses"/utf8>>,
804 + replace_percent_d_with_int(_pipe@5, A@5);
805 +
806 + {past, year, 1} ->
807 + <<"hace 1 año"/utf8>>;
808 +
809 + {past, year, A@6} ->
810 + _pipe@6 = <<"hace %d años"/utf8>>,
811 + replace_percent_d_with_int(_pipe@6, A@6);
812 +
813 + {future, second, 1} ->
814 + <<"en 1 segundo"/utf8>>;
815 +
816 + {future, second, A@7} ->
817 + _pipe@7 = <<"en %d segundos"/utf8>>,
818 + replace_percent_d_with_int(_pipe@7, A@7);
819 +
820 + {future, minute, 1} ->
821 + <<"en 1 minuto"/utf8>>;
822 +
823 + {future, minute, A@8} ->
824 + _pipe@8 = <<"en %d minutos"/utf8>>,
825 + replace_percent_d_with_int(_pipe@8, A@8);
826 +
827 + {future, hour, 1} ->
828 + <<"en 1 hora"/utf8>>;
829 +
830 + {future, hour, A@9} ->
831 + _pipe@9 = <<"en %d horas"/utf8>>,
832 + replace_percent_d_with_int(_pipe@9, A@9);
833 +
834 + {future, day, 1} ->
835 + <<"en 1 día"/utf8>>;
836 +
837 + {future, day, A@10} ->
838 + _pipe@10 = <<"en %d días"/utf8>>,
839 + replace_percent_d_with_int(_pipe@10, A@10);
840 +
841 + {future, week, 1} ->
842 + <<"en 1 semana"/utf8>>;
843 +
844 + {future, week, A@11} ->
845 + _pipe@11 = <<"en %d semanas"/utf8>>,
846 + replace_percent_d_with_int(_pipe@11, A@11);
847 +
848 + {future, month, 1} ->
849 + <<"en 1 mes"/utf8>>;
850 +
851 + {future, month, A@12} ->
852 + _pipe@12 = <<"en %d meses"/utf8>>,
853 + replace_percent_d_with_int(_pipe@12, A@12);
854 +
855 + {future, year, 1} ->
856 + <<"en 1 año"/utf8>>;
857 +
858 + {future, year, A@13} ->
859 + _pipe@13 = <<"en %d años"/utf8>>,
860 + replace_percent_d_with_int(_pipe@13, A@13)
861 + end.
862 +
863 + -file("src/timeago.gleam", 398).
864 + ?DOC(" Translations for Polish.\n").
865 + -spec pl_pl(tense(), gleam@time@duration:unit(), integer()) -> binary().
866 + pl_pl(Tense, Unit, Amount) ->
867 + case {Tense, Unit, Amount} of
868 + {_, nanosecond, _} ->
869 + <<"przed chwilą"/utf8>>;
870 +
871 + {_, microsecond, _} ->
872 + <<"przed chwilą"/utf8>>;
873 +
874 + {_, millisecond, _} ->
875 + <<"przed chwilą"/utf8>>;
876 +
877 + {past, second, 1} ->
878 + <<"1 sekundę temu"/utf8>>;
879 +
880 + {past, second, A} ->
881 + _pipe = case A rem 100 of
882 + 12 ->
883 + <<"%d sekund temu"/utf8>>;
884 +
885 + 13 ->
886 + <<"%d sekund temu"/utf8>>;
887 +
888 + 14 ->
889 + <<"%d sekund temu"/utf8>>;
890 +
891 + _ ->
892 + case A rem 10 of
893 + 2 ->
894 + <<"%d sekundy temu"/utf8>>;
895 +
896 + 3 ->
897 + <<"%d sekundy temu"/utf8>>;
898 +
899 + 4 ->
900 + <<"%d sekundy temu"/utf8>>;
901 +
902 + _ ->
903 + <<"%d sekund temu"/utf8>>
904 + end
905 + end,
906 + replace_percent_d_with_int(_pipe, A);
907 +
908 + {past, minute, 1} ->
909 + <<"1 minutę temu"/utf8>>;
910 +
911 + {past, minute, A@1} ->
912 + _pipe@1 = case A@1 rem 100 of
913 + 12 ->
914 + <<"%d minut temu"/utf8>>;
915 +
916 + 13 ->
917 + <<"%d minut temu"/utf8>>;
918 +
919 + 14 ->
920 + <<"%d minut temu"/utf8>>;
921 +
922 + _ ->
923 + case A@1 rem 10 of
924 + 2 ->
925 + <<"%d minuty temu"/utf8>>;
926 +
927 + 3 ->
928 + <<"%d minuty temu"/utf8>>;
929 +
930 + 4 ->
931 + <<"%d minuty temu"/utf8>>;
932 +
933 + _ ->
934 + <<"%d minut temu"/utf8>>
935 + end
936 + end,
937 + replace_percent_d_with_int(_pipe@1, A@1);
938 +
939 + {past, hour, 1} ->
940 + <<"1 godzinę temu"/utf8>>;
941 +
942 + {past, hour, A@2} ->
943 + _pipe@2 = case A@2 rem 100 of
944 + 12 ->
945 + <<"%d godzin temu"/utf8>>;
946 +
947 + 13 ->
948 + <<"%d godzin temu"/utf8>>;
949 +
950 + 14 ->
951 + <<"%d godzin temu"/utf8>>;
952 +
953 + _ ->
954 + case A@2 rem 10 of
955 + 2 ->
956 + <<"%d godziny temu"/utf8>>;
957 +
958 + 3 ->
959 + <<"%d godziny temu"/utf8>>;
960 +
961 + 4 ->
962 + <<"%d godziny temu"/utf8>>;
963 +
964 + _ ->
965 + <<"%d godzin temu"/utf8>>
966 + end
967 + end,
968 + replace_percent_d_with_int(_pipe@2, A@2);
969 +
970 + {past, day, 1} ->
971 + <<"1 dzień temu"/utf8>>;
972 +
973 + {past, day, A@3} ->
974 + _pipe@3 = <<"%d dni temu"/utf8>>,
975 + replace_percent_d_with_int(_pipe@3, A@3);
976 +
977 + {past, week, 1} ->
978 + <<"1 tydzień temu"/utf8>>;
979 +
980 + {past, week, A@4} ->
981 + _pipe@4 = case A@4 rem 100 of
982 + 12 ->
983 + <<"%d tygodni temu"/utf8>>;
984 +
985 + 13 ->
986 + <<"%d tygodni temu"/utf8>>;
987 +
988 + 14 ->
989 + <<"%d tygodni temu"/utf8>>;
990 +
991 + _ ->
992 + case A@4 rem 10 of
993 + 2 ->
994 + <<"%d tygodnie temu"/utf8>>;
995 +
996 + 3 ->
997 + <<"%d tygodnie temu"/utf8>>;
998 +
999 + 4 ->
1000 + <<"%d tygodnie temu"/utf8>>;
1001 +
1002 + _ ->
1003 + <<"%d tygodni temu"/utf8>>
1004 + end
1005 + end,
1006 + replace_percent_d_with_int(_pipe@4, A@4);
1007 +
1008 + {past, month, 1} ->
1009 + <<"1 miesiąc temu"/utf8>>;
1010 +
1011 + {past, month, A@5} ->
1012 + _pipe@5 = case A@5 rem 100 of
1013 + 12 ->
1014 + <<"%d miesięcy temu"/utf8>>;
1015 +
1016 + 13 ->
1017 + <<"%d miesięcy temu"/utf8>>;
1018 +
1019 + 14 ->
1020 + <<"%d miesięcy temu"/utf8>>;
1021 +
1022 + _ ->
1023 + case A@5 rem 10 of
1024 + 2 ->
1025 + <<"%d miesiące temu"/utf8>>;
1026 +
1027 + 3 ->
1028 + <<"%d miesiące temu"/utf8>>;
1029 +
1030 + 4 ->
1031 + <<"%d miesiące temu"/utf8>>;
1032 +
1033 + _ ->
1034 + <<"%d miesięcy temu"/utf8>>
1035 + end
1036 + end,
1037 + replace_percent_d_with_int(_pipe@5, A@5);
1038 +
1039 + {past, year, 1} ->
1040 + <<"1 rok temu"/utf8>>;
1041 +
1042 + {past, year, A@6} ->
1043 + _pipe@6 = case A@6 rem 100 of
1044 + 12 ->
1045 + <<"%d lat temu"/utf8>>;
1046 +
1047 + 13 ->
1048 + <<"%d lat temu"/utf8>>;
1049 +
1050 + 14 ->
1051 + <<"%d lat temu"/utf8>>;
1052 +
1053 + _ ->
1054 + case A@6 rem 10 of
1055 + 2 ->
1056 + <<"%d lata temu"/utf8>>;
1057 +
1058 + 3 ->
1059 + <<"%d lata temu"/utf8>>;
1060 +
1061 + 4 ->
1062 + <<"%d lata temu"/utf8>>;
1063 +
1064 + _ ->
1065 + <<"%d lat temu"/utf8>>
1066 + end
1067 + end,
1068 + replace_percent_d_with_int(_pipe@6, A@6);
1069 +
1070 + {future, second, 1} ->
1071 + <<"za 1 sekundę"/utf8>>;
1072 +
1073 + {future, second, A@7} ->
1074 + _pipe@7 = case A@7 rem 100 of
1075 + 12 ->
1076 + <<"za %d sekund"/utf8>>;
1077 +
1078 + 13 ->
1079 + <<"za %d sekund"/utf8>>;
1080 +
1081 + 14 ->
1082 + <<"za %d sekund"/utf8>>;
1083 +
1084 + _ ->
1085 + case A@7 rem 10 of
1086 + 2 ->
1087 + <<"za %d sekundy"/utf8>>;
1088 +
1089 + 3 ->
1090 + <<"za %d sekundy"/utf8>>;
1091 +
1092 + 4 ->
1093 + <<"za %d sekundy"/utf8>>;
1094 +
1095 + _ ->
1096 + <<"za %d sekund"/utf8>>
1097 + end
1098 + end,
1099 + replace_percent_d_with_int(_pipe@7, A@7);
1100 +
1101 + {future, minute, 1} ->
1102 + <<"za 1 minutę"/utf8>>;
1103 +
1104 + {future, minute, A@8} ->
1105 + _pipe@8 = case A@8 rem 100 of
1106 + 12 ->
1107 + <<"za %d minut"/utf8>>;
1108 +
1109 + 13 ->
1110 + <<"za %d minut"/utf8>>;
1111 +
1112 + 14 ->
1113 + <<"za %d minut"/utf8>>;
1114 +
1115 + _ ->
1116 + case A@8 rem 10 of
1117 + 2 ->
1118 + <<"za %d minuty"/utf8>>;
1119 +
1120 + 3 ->
1121 + <<"za %d minuty"/utf8>>;
1122 +
1123 + 4 ->
1124 + <<"za %d minuty"/utf8>>;
1125 +
1126 + _ ->
1127 + <<"za %d minut"/utf8>>
1128 + end
1129 + end,
1130 + replace_percent_d_with_int(_pipe@8, A@8);
1131 +
1132 + {future, hour, 1} ->
1133 + <<"za 1 godzinę"/utf8>>;
1134 +
1135 + {future, hour, A@9} ->
1136 + _pipe@9 = case A@9 rem 100 of
1137 + 12 ->
1138 + <<"za %d godzin"/utf8>>;
1139 +
1140 + 13 ->
1141 + <<"za %d godzin"/utf8>>;
1142 +
1143 + 14 ->
1144 + <<"za %d godzin"/utf8>>;
1145 +
1146 + _ ->
1147 + case A@9 rem 10 of
1148 + 2 ->
1149 + <<"za %d godziny"/utf8>>;
1150 +
1151 + 3 ->
1152 + <<"za %d godziny"/utf8>>;
1153 +
1154 + 4 ->
1155 + <<"za %d godziny"/utf8>>;
1156 +
1157 + _ ->
1158 + <<"za %d godzin"/utf8>>
1159 + end
1160 + end,
1161 + replace_percent_d_with_int(_pipe@9, A@9);
1162 +
1163 + {future, day, 1} ->
1164 + <<"za 1 dzień"/utf8>>;
1165 +
1166 + {future, day, A@10} ->
1167 + _pipe@10 = <<"za %d dni"/utf8>>,
1168 + replace_percent_d_with_int(_pipe@10, A@10);
1169 +
1170 + {future, week, 1} ->
1171 + <<"za tydzień"/utf8>>;
1172 +
1173 + {future, week, A@11} ->
1174 + _pipe@11 = case A@11 rem 100 of
1175 + 12 ->
1176 + <<"za %d tygodni"/utf8>>;
1177 +
1178 + 13 ->
1179 + <<"za %d tygodni"/utf8>>;
1180 +
1181 + 14 ->
1182 + <<"za %d tygodni"/utf8>>;
1183 +
1184 + _ ->
1185 + case A@11 rem 10 of
1186 + 2 ->
1187 + <<"za %d tygodnie"/utf8>>;
1188 +
1189 + 3 ->
1190 + <<"za %d tygodnie"/utf8>>;
1191 +
1192 + 4 ->
1193 + <<"za %d tygodnie"/utf8>>;
1194 +
1195 + _ ->
1196 + <<"za %d tygodni"/utf8>>
1197 + end
1198 + end,
1199 + replace_percent_d_with_int(_pipe@11, A@11);
1200 +
1201 + {future, month, 1} ->
1202 + <<"za miesiąc"/utf8>>;
1203 +
1204 + {future, month, A@12} ->
1205 + _pipe@12 = case A@12 rem 100 of
1206 + 12 ->
1207 + <<"za %d miesięcy"/utf8>>;
1208 +
1209 + 13 ->
1210 + <<"za %d miesięcy"/utf8>>;
1211 +
1212 + 14 ->
1213 + <<"za %d miesięcy"/utf8>>;
1214 +
1215 + _ ->
1216 + case A@12 rem 10 of
1217 + 2 ->
1218 + <<"za %d miesiące"/utf8>>;
1219 +
1220 + 3 ->
1221 + <<"za %d miesiące"/utf8>>;
1222 +
1223 + 4 ->
1224 + <<"za %d miesiące"/utf8>>;
1225 +
1226 + _ ->
1227 + <<"za %d miesięcy"/utf8>>
1228 + end
1229 + end,
1230 + replace_percent_d_with_int(_pipe@12, A@12);
1231 +
1232 + {future, year, 1} ->
1233 + <<"za rok"/utf8>>;
1234 +
1235 + {future, year, A@13} ->
1236 + _pipe@13 = case A@13 rem 100 of
1237 + 12 ->
1238 + <<"za %d lat"/utf8>>;
1239 +
1240 + 13 ->
1241 + <<"za %d lat"/utf8>>;
1242 +
1243 + 14 ->
1244 + <<"za %d lat"/utf8>>;
1245 +
1246 + _ ->
1247 + case A@13 rem 10 of
1248 + 2 ->
1249 + <<"za %d lata"/utf8>>;
1250 +
1251 + 3 ->
1252 + <<"za %d lata"/utf8>>;
1253 +
1254 + 4 ->
1255 + <<"za %d lata"/utf8>>;
1256 +
1257 + _ ->
1258 + <<"za %d lat"/utf8>>
1259 + end
1260 + end,
1261 + replace_percent_d_with_int(_pipe@13, A@13)
1262 + end.
  @@ -356,3 +356,183 @@ pub fn it_it(tense: Tense, unit: Unit, amount: Int) -> String {
356 356 Future, Year, a -> "fra %d anni" |> replace_percent_d_with_int(a)
357 357 }
358 358 }
359 +
360 + /// Translations for Spanish.
361 + ///
362 + pub fn es_es(tense: Tense, unit: Unit, amount: Int) -> String {
363 + case tense, unit, amount {
364 + _, Nanosecond, _ | _, Microsecond, _ | _, Millisecond, _ -> "ahora mismo"
365 + Past, Second, 1 -> "hace 1 segundo"
366 + Past, Second, a -> "hace %d segundos" |> replace_percent_d_with_int(a)
367 + Past, Minute, 1 -> "hace 1 minuto"
368 + Past, Minute, a -> "hace %d minutos" |> replace_percent_d_with_int(a)
369 + Past, Hour, 1 -> "hace 1 hora"
370 + Past, Hour, a -> "hace %d horas" |> replace_percent_d_with_int(a)
371 + Past, Day, 1 -> "hace 1 día"
372 + Past, Day, a -> "hace %d días" |> replace_percent_d_with_int(a)
373 + Past, Week, 1 -> "hace 1 semana"
374 + Past, Week, a -> "hace %d semanas" |> replace_percent_d_with_int(a)
375 + Past, Month, 1 -> "hace 1 mes"
376 + Past, Month, a -> "hace %d meses" |> replace_percent_d_with_int(a)
377 + Past, Year, 1 -> "hace 1 año"
378 + Past, Year, a -> "hace %d años" |> replace_percent_d_with_int(a)
379 + Future, Second, 1 -> "en 1 segundo"
380 + Future, Second, a -> "en %d segundos" |> replace_percent_d_with_int(a)
381 + Future, Minute, 1 -> "en 1 minuto"
382 + Future, Minute, a -> "en %d minutos" |> replace_percent_d_with_int(a)
383 + Future, Hour, 1 -> "en 1 hora"
384 + Future, Hour, a -> "en %d horas" |> replace_percent_d_with_int(a)
385 + Future, Day, 1 -> "en 1 día"
386 + Future, Day, a -> "en %d días" |> replace_percent_d_with_int(a)
387 + Future, Week, 1 -> "en 1 semana"
388 + Future, Week, a -> "en %d semanas" |> replace_percent_d_with_int(a)
389 + Future, Month, 1 -> "en 1 mes"
390 + Future, Month, a -> "en %d meses" |> replace_percent_d_with_int(a)
391 + Future, Year, 1 -> "en 1 año"
392 + Future, Year, a -> "en %d años" |> replace_percent_d_with_int(a)
393 + }
394 + }
395 +
396 + /// Translations for Polish.
397 + ///
398 + pub fn pl_pl(tense: Tense, unit: Unit, amount: Int) -> String {
399 + case tense, unit, amount {
400 + _, Nanosecond, _ | _, Microsecond, _ | _, Millisecond, _ -> "przed chwilą"
401 + Past, Second, 1 -> "1 sekundę temu"
402 + Past, Second, a ->
403 + case a % 100 {
404 + 12 | 13 | 14 -> "%d sekund temu"
405 + _ ->
406 + case a % 10 {
407 + 2 | 3 | 4 -> "%d sekundy temu"
408 + _ -> "%d sekund temu"
409 + }
410 + }
411 + |> replace_percent_d_with_int(a)
412 + Past, Minute, 1 -> "1 minutę temu"
413 + Past, Minute, a ->
414 + case a % 100 {
415 + 12 | 13 | 14 -> "%d minut temu"
416 + _ ->
417 + case a % 10 {
418 + 2 | 3 | 4 -> "%d minuty temu"
419 + _ -> "%d minut temu"
420 + }
421 + }
422 + |> replace_percent_d_with_int(a)
423 + Past, Hour, 1 -> "1 godzinę temu"
424 + Past, Hour, a ->
425 + case a % 100 {
426 + 12 | 13 | 14 -> "%d godzin temu"
427 + _ ->
428 + case a % 10 {
429 + 2 | 3 | 4 -> "%d godziny temu"
430 + _ -> "%d godzin temu"
431 + }
432 + }
433 + |> replace_percent_d_with_int(a)
434 + Past, Day, 1 -> "1 dzień temu"
435 + Past, Day, a -> "%d dni temu" |> replace_percent_d_with_int(a)
436 + Past, Week, 1 -> "1 tydzień temu"
437 + Past, Week, a ->
438 + case a % 100 {
439 + 12 | 13 | 14 -> "%d tygodni temu"
440 + _ ->
441 + case a % 10 {
442 + 2 | 3 | 4 -> "%d tygodnie temu"
443 + _ -> "%d tygodni temu"
444 + }
445 + }
446 + |> replace_percent_d_with_int(a)
447 + Past, Month, 1 -> "1 miesiąc temu"
448 + Past, Month, a ->
449 + case a % 100 {
450 + 12 | 13 | 14 -> "%d miesięcy temu"
451 + _ ->
452 + case a % 10 {
453 + 2 | 3 | 4 -> "%d miesiące temu"
454 + _ -> "%d miesięcy temu"
455 + }
456 + }
457 + |> replace_percent_d_with_int(a)
458 + Past, Year, 1 -> "1 rok temu"
459 + Past, Year, a ->
460 + case a % 100 {
461 + 12 | 13 | 14 -> "%d lat temu"
462 + _ ->
463 + case a % 10 {
464 + 2 | 3 | 4 -> "%d lata temu"
465 + _ -> "%d lat temu"
466 + }
467 + }
468 + |> replace_percent_d_with_int(a)
469 + Future, Second, 1 -> "za 1 sekundę"
470 + Future, Second, a ->
471 + case a % 100 {
472 + 12 | 13 | 14 -> "za %d sekund"
473 + _ ->
474 + case a % 10 {
475 + 2 | 3 | 4 -> "za %d sekundy"
476 + _ -> "za %d sekund"
477 + }
478 + }
479 + |> replace_percent_d_with_int(a)
480 + Future, Minute, 1 -> "za 1 minutę"
481 + Future, Minute, a ->
482 + case a % 100 {
483 + 12 | 13 | 14 -> "za %d minut"
484 + _ ->
485 + case a % 10 {
486 + 2 | 3 | 4 -> "za %d minuty"
487 + _ -> "za %d minut"
488 + }
489 + }
490 + |> replace_percent_d_with_int(a)
491 + Future, Hour, 1 -> "za 1 godzinę"
492 + Future, Hour, a ->
493 + case a % 100 {
494 + 12 | 13 | 14 -> "za %d godzin"
495 + _ ->
496 + case a % 10 {
497 + 2 | 3 | 4 -> "za %d godziny"
498 + _ -> "za %d godzin"
499 + }
500 + }
501 + |> replace_percent_d_with_int(a)
502 + Future, Day, 1 -> "za 1 dzień"
503 + Future, Day, a -> "za %d dni" |> replace_percent_d_with_int(a)
504 + Future, Week, 1 -> "za tydzień"
505 + Future, Week, a ->
506 + case a % 100 {
507 + 12 | 13 | 14 -> "za %d tygodni"
508 + _ ->
509 + case a % 10 {
510 + 2 | 3 | 4 -> "za %d tygodnie"
511 + _ -> "za %d tygodni"
512 + }
513 + }
514 + |> replace_percent_d_with_int(a)
515 + Future, Month, 1 -> "za miesiąc"
516 + Future, Month, a ->
517 + case a % 100 {
518 + 12 | 13 | 14 -> "za %d miesięcy"
519 + _ ->
520 + case a % 10 {
521 + 2 | 3 | 4 -> "za %d miesiące"
522 + _ -> "za %d miesięcy"
523 + }
524 + }
525 + |> replace_percent_d_with_int(a)
526 + Future, Year, 1 -> "za rok"
527 + Future, Year, a ->
528 + case a % 100 {
529 + 12 | 13 | 14 -> "za %d lat"
530 + _ ->
531 + case a % 10 {
532 + 2 | 3 | 4 -> "za %d lata"
533 + _ -> "za %d lat"
534 + }
535 + }
536 + |> replace_percent_d_with_int(a)
537 + }
538 + }