Invidious is an alternative front-end to YouTube
i18n: Use plurals for year/month/day/etc...
Samantaz Fox692f4e5be2c8
diff --git a/locales/en-US.json b/locales/en-US.jsonindex 94aac89e..166143ac 100644--- a/locales/en-US.json+++ b/locales/en-US.json@@ -359,34 +359,20 @@"Yiddish": "Yiddish","Yoruba": "Yoruba","Zulu": "Zulu",- "`x` years": {- "([^.,0-9]|^)1([^.,0-9]|$)": "`x` year",- "": "`x` years"- },- "`x` months": {- "([^.,0-9]|^)1([^.,0-9]|$)": "`x` month",- "": "`x` months"- },- "`x` weeks": {- "([^.,0-9]|^)1([^.,0-9]|$)": "`x` week",- "": "`x` weeks"- },- "`x` days": {- "([^.,0-9]|^)1([^.,0-9]|$)": "`x` day",- "": "`x` days"- },- "`x` hours": {- "([^.,0-9]|^)1([^.,0-9]|$)": "`x` hour",- "": "`x` hours"- },- "`x` minutes": {- "([^.,0-9]|^)1([^.,0-9]|$)": "`x` minute",- "": "`x` minutes"- },- "`x` seconds": {- "([^.,0-9]|^)1([^.,0-9]|$)": "`x` second",- "": "`x` seconds"- },+ "generic_count_years": "{{count}} year",+ "generic_count_years_plural": "{{count}} years",+ "generic_count_months": "{{count}} month",+ "generic_count_months_plural": "{{count}} months",+ "generic_count_weeks": "{{count}} week",+ "generic_count_weeks_plural": "{{count}} weeks",+ "generic_count_days": "{{count}} day",+ "generic_count_days_plural": "{{count}} days",+ "generic_count_hours": "{{count}} hour",+ "generic_count_hours_plural": "{{count}} hours",+ "generic_count_minutes": "{{count}} minute",+ "generic_count_minutes_plural": "{{count}} minutes",+ "generic_count_seconds": "{{count}} second",+ "generic_count_seconds_plural": "{{count}} seconds","Fallback comments: ": "Fallback comments: ","Popular": "Popular","Search": "Search",diff --git a/locales/fa.json b/locales/fa.jsonindex 1f723a63..d8df2b4f 100644--- a/locales/fa.json+++ b/locales/fa.json@@ -340,34 +340,13 @@"Yiddish": "ییدیش","Yoruba": "یوروبایی","Zulu": "زولو",- "`x` years": {- "([^.,0-9]|^)1([^.,0-9]|$)": "`x` سال",- "": "`x` سال"- },- "`x` months": {- "([^.,0-9]|^)1([^.,0-9]|$)": "`x` ماه",- "": "`x` ماه"- },- "`x` weeks": {- "([^.,0-9]|^)1([^.,0-9]|$)": "`x` هفته",- "": "`x` هفته"- },- "`x` days": {- "([^.,0-9]|^)1([^.,0-9]|$)": "`x` روز",- "": "`x` روز"- },- "`x` hours": {- "([^.,0-9]|^)1([^.,0-9]|$)": "`x` ساعت",- "": "`x` ساعت"- },- "`x` minutes": {- "([^.,0-9]|^)1([^.,0-9]|$)": "`x` دقیقه",- "": "`x` دقیقه"- },- "`x` seconds": {- "([^.,0-9]|^)1([^.,0-9]|$)": "`x` ثانیه",- "": "`x` ثانیه"- },+ "generic_count_years_0": "{{count}} سال",+ "generic_count_months_0": "{{count}} ماه",+ "generic_count_weeks_0": "{{count}} هفته",+ "generic_count_days_0": "{{count}} روز",+ "generic_count_hours_0": "{{count}} ساعت",+ "generic_count_minutes_0": "{{count}} دقیقه",+ "generic_count_seconds_0": "{{count}} ثانیه","Fallback comments: ": "نظرات عقب گرد: ","Popular": "محبوب","Search": "جستجو",diff --git a/locales/fr.json b/locales/fr.jsonindex 5ebd6f70..f9975a6b 100644--- a/locales/fr.json+++ b/locales/fr.json@@ -340,34 +340,20 @@"Yiddish": "Yiddish","Yoruba": "Yoruba","Zulu": "Zoulou",- "`x` years": {- "([^.,0-9]|^)1([^.,0-9]|$)": "`x` an",- "": "`x` ans"- },- "`x` months": {- "([^.,0-9]|^)1([^.,0-9]|$)": "`x` mois",- "": "`x` mois"- },- "`x` weeks": {- "([^.,0-9]|^)1([^.,0-9]|$)": "`x` semaine",- "": "`x` semaines"- },- "`x` days": {- "([^.,0-9]|^)1([^.,0-9]|$)": "`x` jour",- "": "`x` jours"- },- "`x` hours": {- "([^.,0-9]|^)1([^.,0-9]|$)": "`x` heure",- "": "`x` heures"- },- "`x` minutes": {- "([^.,0-9]|^)1([^.,0-9]|$)": "`x` minute",- "": "`x` minutes"- },- "`x` seconds": {- "([^.,0-9]|^)1([^.,0-9]|$)": "`x` seconde",- "": "`x` secondes"- },+ "generic_count_years": "{{count}} an",+ "generic_count_years_plural": "{{count}} ans",+ "generic_count_months": "{{count}} mois",+ "generic_count_months_plural": "{{count}} mois",+ "generic_count_weeks": "{{count}} semaine",+ "generic_count_weeks_plural": "{{count}} semaines",+ "generic_count_days": "{{count}} jour",+ "generic_count_days_plural": "{{count}} jours",+ "generic_count_hours": "{{count}} heure",+ "generic_count_hours_plural": "{{count}} heures",+ "generic_count_minutes": "{{count}} minute",+ "generic_count_minutes_plural": "{{count}} minutes",+ "generic_count_seconds": "{{count}} seconde",+ "generic_count_seconds_plural": "{{count}} secondes","Fallback comments: ": "Commentaires alternatifs : ","Popular": "Populaire","Search": "Rechercher",diff --git a/locales/id.json b/locales/id.jsonindex b3918955..78f5e773 100644--- a/locales/id.json+++ b/locales/id.json@@ -340,34 +340,13 @@"Yiddish": "Bahasa Yiddi","Yoruba": "Bahasa Yoruba","Zulu": "Bahasa Zulu",- "`x` years": {- "([^.,0-9]|^)1([^.,0-9]|$)": "`x` tahun",- "": "`x` tahun"- },- "`x` months": {- "([^.,0-9]|^)1([^.,0-9]|$)": "`x` bulan",- "": "`x` bulan"- },- "`x` weeks": {- "([^.,0-9]|^)1([^.,0-9]|$)": "`x` pekan",- "": "`x` pekan"- },- "`x` days": {- "([^.,0-9]|^)1([^.,0-9]|$)": "`x` hari",- "": "`x` hari"- },- "`x` hours": {- "([^.,0-9]|^)1([^.,0-9]|$)": "`x` jam",- "": "`x` jam"- },- "`x` minutes": {- "([^.,0-9]|^)1([^.,0-9]|$)": "`x` menit",- "": "`x` menit"- },- "`x` seconds": {- "([^.,0-9]|^)1([^.,0-9]|$)": "`x` detik",- "": "`x` detik"- },+ "generic_count_years_0": "{{count}} tahun",+ "generic_count_months_0": "{{count}} bulan",+ "generic_count_weeks_0": "{{count}} pekan",+ "generic_count_days_0": "{{count}} hari",+ "generic_count_hours_0": "{{count}} jam",+ "generic_count_minutes_0": "{{count}} menit",+ "generic_count_seconds_0": "{{count}} detik","Fallback comments: ": "Komentar alternatif: ","Popular": "Populer","Search": "Cari",diff --git a/locales/it.json b/locales/it.jsonindex a43e1a49..befdd665 100644--- a/locales/it.json+++ b/locales/it.json@@ -330,34 +330,20 @@"Yiddish": "Yiddish","Yoruba": "Yoruba","Zulu": "Zulu",- "`x` years": {- "([^.,0-9]|^)1([^.,0-9]|$)": "`x` anno",- "": "`x` anni"- },- "`x` months": {- "([^.,0-9]|^)1([^.,0-9]|$)": "`x` mese",- "": "`x` mesi"- },- "`x` weeks": {- "([^.,0-9]|^)1([^.,0-9]|$)": "`x` settimana",- "": "`x` settimane"- },- "`x` days": {- "([^.,0-9]|^)1([^.,0-9]|$)": "`x` giorno",- "": "`x` giorni"- },- "`x` hours": {- "([^.,0-9]|^)1([^.,0-9]|$)": "`x` ora",- "": "`x` ore"- },- "`x` minutes": {- "([^.,0-9]|^)1([^.,0-9]|$)": "`x` minuto",- "": "`x` minuti"- },- "`x` seconds": {- "([^.,0-9]|^)1([^.,0-9]|$)": "`x` secondo",- "": "`x` secondi"- },+ "generic_count_years": "{{count}} anno",+ "generic_count_years_plural": "{{count}} anni",+ "generic_count_months": "{{count}} mese",+ "generic_count_months_plural": "{{count}} mesi",+ "generic_count_weeks": "{{count}} settimana",+ "generic_count_weeks_plural": "{{count}} settimane",+ "generic_count_days": "{{count}} giorno",+ "generic_count_days_plural": "{{count}} giorni",+ "generic_count_hours": "{{count}} ora",+ "generic_count_hours_plural": "{{count}} ore",+ "generic_count_minutes": "{{count}} minuto",+ "generic_count_minutes_plural": "{{count}} minuti",+ "generic_count_seconds": "{{count}} secondo",+ "generic_count_seconds_plural": "{{count}} secondi","Fallback comments: ": "Commenti alternativi: ","Popular": "Popolare","Search": "Cerca",diff --git a/locales/ja.json b/locales/ja.jsonindex bf858f1f..7423d2ca 100644--- a/locales/ja.json+++ b/locales/ja.json@@ -340,34 +340,13 @@"Yiddish": "イディッシュ語","Yoruba": "ヨルバ語","Zulu": "ズール語",- "`x` years": {- "([^.,0-9]|^)1([^.,0-9]|$)": "`x`年",- "": "`x`年"- },- "`x` months": {- "([^.,0-9]|^)1([^.,0-9]|$)": "`x`ヶ月",- "": "`x`ヶ月"- },- "`x` weeks": {- "([^.,0-9]|^)1([^.,0-9]|$)": "`x`週",- "": "`x`週"- },- "`x` days": {- "([^.,0-9]|^)1([^.,0-9]|$)": "`x`日",- "": "`x`日"- },- "`x` hours": {- "([^.,0-9]|^)1([^.,0-9]|$)": "`x`時間",- "": "`x`時間"- },- "`x` minutes": {- "([^.,0-9]|^)1([^.,0-9]|$)": "`x`分",- "": "`x`分"- },- "`x` seconds": {- "([^.,0-9]|^)1([^.,0-9]|$)": "`x`秒",- "": "`x`秒"- },+ "generic_count_years_0": "{{count}}年",+ "generic_count_months_0": "{{count}}ヶ月",+ "generic_count_weeks_0": "{{count}}週",+ "generic_count_days_0": "{{count}}日",+ "generic_count_hours_0": "{{count}}時間",+ "generic_count_minutes_0": "{{count}}分",+ "generic_count_seconds_0": "{{count}}秒","Fallback comments: ": "フォールバック時のコメント: ","Popular": "人気","Search": "検索",diff --git a/locales/ko.json b/locales/ko.jsonindex b96b3c0b..96fd41ff 100644--- a/locales/ko.json+++ b/locales/ko.json@@ -336,36 +336,15 @@"Scottish Gaelic": "스코틀랜드 게일어","Popular": "인기","Fallback comments: ": "대체 댓글: ",- "`x` seconds": {- "": "`x` 초",- "([^.,0-9]|^)1([^.,0-9]|$)": "`x` 초"- },"Swahili": "스와힐리어","Sundanese": "순다어",- "`x` hours": {- "": "`x` 시",- "([^.,0-9]|^)1([^.,0-9]|$)": "`x` 시"- },- "`x` minutes": {- "": "`x` 분",- "([^.,0-9]|^)1([^.,0-9]|$)": "`x` 분"- },- "`x` days": {- "": "`x` 일",- "([^.,0-9]|^)1([^.,0-9]|$)": "`x` 일"- },- "`x` weeks": {- "": "`x` 주",- "([^.,0-9]|^)1([^.,0-9]|$)": "`x` 주"- },- "`x` months": {- "": "`x` 월",- "([^.,0-9]|^)1([^.,0-9]|$)": "`x` 월"- },- "`x` years": {- "": "`x` 년",- "([^.,0-9]|^)1([^.,0-9]|$)": "`x` 년"- },+ "generic_count_years_0": "{{count}} 년",+ "generic_count_months_0": "{{count}} 월",+ "generic_count_weeks_0": "{{count}} 주",+ "generic_count_days_0": "{{count}} 일",+ "generic_count_hours_0": "{{count}} 시",+ "generic_count_minutes_0": "{{count}} 분",+ "generic_count_seconds_0": "{{count}} 초","Zulu": "줄루어","Yoruba": "요루바어","Yiddish": "이디시어",diff --git a/locales/pt-BR.json b/locales/pt-BR.jsonindex 6baa2c0d..01407669 100644--- a/locales/pt-BR.json+++ b/locales/pt-BR.json@@ -340,34 +340,20 @@"Yiddish": "Iídiche","Yoruba": "Iorubá","Zulu": "Zulu",- "`x` years": {- "([^.,0-9]|^)1([^.,0-9]|$)": "`x` ano",- "": "`x` anos"- },- "`x` months": {- "([^.,0-9]|^)1([^.,0-9]|$)": "`x` mês",- "": "`x` meses"- },- "`x` weeks": {- "([^.,0-9]|^)1([^.,0-9]|$)": "`x` semana",- "": "`x` semanas"- },- "`x` days": {- "([^.,0-9]|^)1([^.,0-9]|$)": "`x` dia",- "": "`x` dia"- },- "`x` hours": {- "([^.,0-9]|^)1([^.,0-9]|$)": "`x` hora",- "": "`x` horas"- },- "`x` minutes": {- "([^.,0-9]|^)1([^.,0-9]|$)": "`x` minuto",- "": "`x` minutos"- },- "`x` seconds": {- "([^.,0-9]|^)1([^.,0-9]|$)": "`x` segundo",- "": "`x` segundos"- },+ "generic_count_years": "{{count}} ano",+ "generic_count_years_plural": "{{count}} anos",+ "generic_count_months": "{{count}} mês",+ "generic_count_months_plural": "{{count}} meses",+ "generic_count_weeks": "{{count}} semana",+ "generic_count_weeks_plural": "{{count}} semanas",+ "generic_count_days": "{{count}} dia",+ "generic_count_days_plural": "{{count}} dia",+ "generic_count_hours": "{{count}} hora",+ "generic_count_hours_plural": "{{count}} horas",+ "generic_count_minutes": "{{count}} minuto",+ "generic_count_minutes_plural": "{{count}} minutos",+ "generic_count_seconds": "{{count}} segundo",+ "generic_count_seconds_plural": "{{count}} segundos","Fallback comments: ": "Comentários alternativos: ","Popular": "Populares","Search": "Procurar",diff --git a/locales/pt-PT.json b/locales/pt-PT.jsonindex f3952f12..83b59ab5 100644--- a/locales/pt-PT.json+++ b/locales/pt-PT.json@@ -340,34 +340,20 @@"Yiddish": "Iídiche","Yoruba": "Ioruba","Zulu": "Zulu",- "`x` years": {- "([^.,0-9]|^)1([^.,0-9]|$)": "`x` ano",- "": "`x` anos"- },- "`x` months": {- "([^.,0-9]|^)1([^.,0-9]|$)": "`x` mês",- "": "`x` meses"- },- "`x` weeks": {- "([^.,0-9]|^)1([^.,0-9]|$)": "`x` seman",- "": "`x` semanas"- },- "`x` days": {- "([^.,0-9]|^)1([^.,0-9]|$)": "`x` dia",- "": "`x` dias"- },- "`x` hours": {- "([^.,0-9]|^)1([^.,0-9]|$)": "`x` hora",- "": "`x` horas"- },- "`x` minutes": {- "([^.,0-9]|^)1([^.,0-9]|$)": "`x` minuto",- "": "`x` minutos"- },- "`x` seconds": {- "([^.,0-9]|^)1([^.,0-9]|$)": "`x` segundo",- "": "`x` segundos"- },+ "generic_count_years": "{{count}} ano",+ "generic_count_years_plural": "{{count}} anos",+ "generic_count_months": "{{count}} mês",+ "generic_count_months_plural": "{{count}} meses",+ "generic_count_weeks": "{{count}} seman",+ "generic_count_weeks_plural": "{{count}} semanas",+ "generic_count_days": "{{count}} dia",+ "generic_count_days_plural": "{{count}} dias",+ "generic_count_hours": "{{count}} hora",+ "generic_count_hours_plural": "{{count}} horas",+ "generic_count_minutes": "{{count}} minuto",+ "generic_count_minutes_plural": "{{count}} minutos",+ "generic_count_seconds": "{{count}} segundo",+ "generic_count_seconds_plural": "{{count}} segundos","Fallback comments: ": "Comentários alternativos: ","Popular": "Popular","Search": "Pesquisar",diff --git a/locales/pt.json b/locales/pt.jsonindex 1976fe38..065170fb 100644--- a/locales/pt.json+++ b/locales/pt.json@@ -46,34 +46,20 @@"Default": "Predefinido","Top": "Destaques","Search": "Pesquisar",- "`x` seconds": {- "([^.,0-9]|^)1([^.,0-9]|$)": "`x` segundo",- "": "`x` segundos"- },- "`x` minutes": {- "([^.,0-9]|^)1([^.,0-9]|$)": "`x` minuto",- "": "`x` minutos"- },- "`x` hours": {- "([^.,0-9]|^)1([^.,0-9]|$)": "`x` hora",- "": "`x` horas"- },- "`x` days": {- "([^.,0-9]|^)1([^.,0-9]|$)": "`x` dia",- "": "`x` dias"- },- "`x` weeks": {- "([^.,0-9]|^)1([^.,0-9]|$)": "`x` seman",- "": "`x` semanas"- },- "`x` months": {- "([^.,0-9]|^)1([^.,0-9]|$)": "`x` mês",- "": "`x` meses"- },- "`x` years": {- "([^.,0-9]|^)1([^.,0-9]|$)": "`x` ano",- "": "`x` anos"- },+ "generic_count_years": "{{count}} segundo",+ "generic_count_years_plural": "{{count}} segundos",+ "generic_count_months": "{{count}} minuto",+ "generic_count_months_plural": "{{count}} minutos",+ "generic_count_weeks": "{{count}} hora",+ "generic_count_weeks_plural": "{{count}} horas",+ "generic_count_days": "{{count}} dia",+ "generic_count_days_plural": "{{count}} dias",+ "generic_count_hours": "{{count}} seman",+ "generic_count_hours_plural": "{{count}} semanas",+ "generic_count_minutes": "{{count}} mês",+ "generic_count_minutes_plural": "{{count}} meses",+ "generic_count_seconds": "{{count}} ano",+ "generic_count_seconds_plural": "{{count}} anos","Chinese (Traditional)": "Chinês (tradicional)","Chinese (Simplified)": "Chinês (simplificado)","Could not pull trending pages.": "Não foi possível obter as páginas de tendências.",diff --git a/locales/zh-CN.json b/locales/zh-CN.jsonindex ed5d82ce..6108a680 100644--- a/locales/zh-CN.json+++ b/locales/zh-CN.json@@ -340,34 +340,13 @@"Yiddish": "意第绪语","Yoruba": "约鲁巴语","Zulu": "祖鲁语",- "`x` years": {- "([^.,0-9]|^)1([^.,0-9]|$)": "`x` 年",- "": "`x` 年"- },- "`x` months": {- "([^.,0-9]|^)1([^.,0-9]|$)": "`x` 月",- "": "`x` 个月"- },- "`x` weeks": {- "([^.,0-9]|^)1([^.,0-9]|$)": "`x` 周",- "": "`x` 周"- },- "`x` days": {- "([^.,0-9]|^)1([^.,0-9]|$)": "`x` 天",- "": "`x` 天"- },- "`x` hours": {- "([^.,0-9]|^)1([^.,0-9]|$)": "`x` 小时",- "": "`x` 小时"- },- "`x` minutes": {- "([^.,0-9]|^)1([^.,0-9]|$)": "`x` 分钟",- "": "`x` 分钟"- },- "`x` seconds": {- "([^.,0-9]|^)1([^.,0-9]|$)": "`x` 秒",- "": "`x` 秒"- },+ "generic_count_years_0": "{{count}} 年",+ "generic_count_months_0": "{{count}} 月",+ "generic_count_weeks_0": "{{count}} 周",+ "generic_count_days_0": "{{count}} 天",+ "generic_count_hours_0": "{{count}} 小时",+ "generic_count_minutes_0": "{{count}} 分钟",+ "generic_count_seconds_0": "{{count}} 秒","Fallback comments: ": "后备评论: ","Popular": "热门频道","Search": "搜索",diff --git a/locales/zh-TW.json b/locales/zh-TW.jsonindex aad51069..d3580c4d 100644--- a/locales/zh-TW.json+++ b/locales/zh-TW.json@@ -340,34 +340,13 @@"Yiddish": "意第緒語","Yoruba": "約魯巴語","Zulu": "祖魯語",- "`x` years": {- "([^.,0-9]|^)1([^.,0-9]|$)": "`x` 年",- "": "`x` 年"- },- "`x` months": {- "([^.,0-9]|^)1([^.,0-9]|$)": "`x` 月",- "": "`x` 月"- },- "`x` weeks": {- "([^.,0-9]|^)1([^.,0-9]|$)": "`x` 週",- "": "`x` 週"- },- "`x` days": {- "([^.,0-9]|^)1([^.,0-9]|$)": "`x` 天",- "": "`x` 天"- },- "`x` hours": {- "([^.,0-9]|^)1([^.,0-9]|$)": "`x` 小時",- "": "`x` 小時"- },- "`x` minutes": {- "([^.,0-9]|^)1([^.,0-9]|$)": "`x` 天",- "": "`x` 分鐘"- },- "`x` seconds": {- "([^.,0-9]|^)1([^.,0-9]|$)": "`x` 秒",- "": "`x` 秒"- },+ "generic_count_years_0": "{{count}} 年",+ "generic_count_months_0": "{{count}} 月",+ "generic_count_weeks_0": "{{count}} 週",+ "generic_count_days_0": "{{count}} 天",+ "generic_count_hours_0": "{{count}} 小時",+ "generic_count_minutes_0": "{{count}} 分鐘",+ "generic_count_seconds_0": "{{count}} 秒","Fallback comments: ": "汰退留言: ","Popular": "熱門頻道","Search": "搜尋",diff --git a/src/invidious/helpers/utils.cr b/src/invidious/helpers/utils.crindex 8453d605..09181c10 100644--- a/src/invidious/helpers/utils.cr+++ b/src/invidious/helpers/utils.cr@@ -123,22 +123,20 @@ def recode_date(time : Time, locale)span = Time.utc - timeif span.total_days > 365.0- span = translate(locale, "`x` years", (span.total_days.to_i // 365).to_s)+ return translate_count(locale, "generic_count_years", span.total_days.to_i // 365)elsif span.total_days > 30.0- span = translate(locale, "`x` months", (span.total_days.to_i // 30).to_s)+ return translate_count(locale, "generic_count_months", span.total_days.to_i // 30)elsif span.total_days > 7.0- span = translate(locale, "`x` weeks", (span.total_days.to_i // 7).to_s)+ return translate_count(locale, "generic_count_weeks", span.total_days.to_i // 7)elsif span.total_hours > 24.0- span = translate(locale, "`x` days", (span.total_days.to_i).to_s)+ return translate_count(locale, "generic_count_days", span.total_days.to_i)elsif span.total_minutes > 60.0- span = translate(locale, "`x` hours", (span.total_hours.to_i).to_s)+ return translate_count(locale, "generic_count_hours", span.total_hours.to_i)elsif span.total_seconds > 60.0- span = translate(locale, "`x` minutes", (span.total_minutes.to_i).to_s)+ return translate_count(locale, "generic_count_minutes", span.total_minutes.to_i)else- span = translate(locale, "`x` seconds", (span.total_seconds.to_i).to_s)+ return translate_count(locale, "generic_count_seconds", span.total_seconds.to_i)end-- return spanenddef number_with_separator(number)