Add view count to video items

This commit is contained in:
Omar Roth 2019-04-14 17:43:44 -05:00
parent efe86c37b2
commit b51fd7fc13
13 changed files with 28 additions and 16 deletions

View file

@ -5,7 +5,6 @@
"Shared `x` ago": "تم رفع الفيديو منذ `x`", "Shared `x` ago": "تم رفع الفيديو منذ `x`",
"Unsubscribe": "إلغاء الإشتراك", "Unsubscribe": "إلغاء الإشتراك",
"Subscribe": "إشتراك", "Subscribe": "إشتراك",
"View channel on YouTube": "زيارة القناة على موقع يوتيوب", "View channel on YouTube": "زيارة القناة على موقع يوتيوب",
"newest": "الأجدد", "newest": "الأجدد",
"oldest": "الأقدم", "oldest": "الأقدم",
@ -115,6 +114,7 @@
"Whitelisted regions: ": "الدول المسموح فيها هذا الفيديو: ", "Whitelisted regions: ": "الدول المسموح فيها هذا الفيديو: ",
"Blacklisted regions: ": "الدول الحظور فيها هذا الفيديو: ", "Blacklisted regions: ": "الدول الحظور فيها هذا الفيديو: ",
"Shared `x`": "شارك منذ `x`", "Shared `x`": "شارك منذ `x`",
"`x` views": "",
"Premieres in `x`": "يعرض فى 'x'", "Premieres in `x`": "يعرض فى 'x'",
"Hi! Looks like you have JavaScript disabled. Click here to view comments, keep in mind it may take a bit longer to load.": "اهلا! يبدو ان الجافاسكريبت معطلة. اضغط هنا لعرض التعليقات, ضع فى إعتبارك انها ستأخذ وقت اطول للعرض.", "Hi! Looks like you have JavaScript disabled. Click here to view comments, keep in mind it may take a bit longer to load.": "اهلا! يبدو ان الجافاسكريبت معطلة. اضغط هنا لعرض التعليقات, ضع فى إعتبارك انها ستأخذ وقت اطول للعرض.",
"View YouTube comments": "عرض تعليقات اليوتيوب", "View YouTube comments": "عرض تعليقات اليوتيوب",

View file

@ -5,7 +5,6 @@
"Shared `x` ago": "Vor `x` geteilt", "Shared `x` ago": "Vor `x` geteilt",
"Unsubscribe": "Abbestellen", "Unsubscribe": "Abbestellen",
"Subscribe": "Abonnieren", "Subscribe": "Abonnieren",
"View channel on YouTube": "Kanal auf YouTube anzeigen", "View channel on YouTube": "Kanal auf YouTube anzeigen",
"newest": "neueste", "newest": "neueste",
"oldest": "älteste", "oldest": "älteste",
@ -115,6 +114,7 @@
"Whitelisted regions: ": "Erlaubte Regionen: ", "Whitelisted regions: ": "Erlaubte Regionen: ",
"Blacklisted regions: ": "Unerlaubte Regionen: ", "Blacklisted regions: ": "Unerlaubte Regionen: ",
"Shared `x`": "Geteilt `x`", "Shared `x`": "Geteilt `x`",
"`x` views": "",
"Premieres in `x`": "", "Premieres in `x`": "",
"Hi! Looks like you have JavaScript disabled. Click here to view comments, keep in mind it may take a bit longer to load.": "Hallo! Anscheinend haben Sie JavaScript deaktiviert. Klicken Sie hier um Kommentare anzuzeigen, beachten sie dass es etwas länger dauern kann um sie zu laden.", "Hi! Looks like you have JavaScript disabled. Click here to view comments, keep in mind it may take a bit longer to load.": "Hallo! Anscheinend haben Sie JavaScript deaktiviert. Klicken Sie hier um Kommentare anzuzeigen, beachten sie dass es etwas länger dauern kann um sie zu laden.",
"View YouTube comments": "YouTube Kommentare anzeigen", "View YouTube comments": "YouTube Kommentare anzeigen",

View file

@ -5,7 +5,6 @@
"Shared `x` ago": "Shared `x` ago", "Shared `x` ago": "Shared `x` ago",
"Unsubscribe": "Unsubscribe", "Unsubscribe": "Unsubscribe",
"Subscribe": "Subscribe", "Subscribe": "Subscribe",
"View channel on YouTube": "View channel on YouTube", "View channel on YouTube": "View channel on YouTube",
"newest": "newest", "newest": "newest",
"oldest": "oldest", "oldest": "oldest",
@ -103,7 +102,7 @@
"View JavaScript license information.": "View JavaScript license information.", "View JavaScript license information.": "View JavaScript license information.",
"View privacy policy.": "View privacy policy.", "View privacy policy.": "View privacy policy.",
"Trending": "Trending", "Trending": "Trending",
"Unlisted": "", "Unlisted": "Unlisted",
"Watch video on Youtube": "Watch video on Youtube", "Watch video on Youtube": "Watch video on Youtube",
"Genre: ": "Genre: ", "Genre: ": "Genre: ",
"License: ": "License: ", "License: ": "License: ",
@ -113,7 +112,8 @@
"Whitelisted regions: ": "Whitelisted regions: ", "Whitelisted regions: ": "Whitelisted regions: ",
"Blacklisted regions: ": "Blacklisted regions: ", "Blacklisted regions: ": "Blacklisted regions: ",
"Shared `x`": "Shared `x`", "Shared `x`": "Shared `x`",
"Premieres in `x`": "", "`x` views": "",
"Premieres in `x`": "Premieres in `x`",
"Hi! Looks like you have JavaScript disabled. Click here to view comments, keep in mind it may take a bit longer to load.": "Hi! Looks like you have JavaScript disabled. Click here to view comments, keep in mind it may take a bit longer to load.", "Hi! Looks like you have JavaScript disabled. Click here to view comments, keep in mind it may take a bit longer to load.": "Hi! Looks like you have JavaScript disabled. Click here to view comments, keep in mind it may take a bit longer to load.",
"View YouTube comments": "View YouTube comments", "View YouTube comments": "View YouTube comments",
"View more comments on Reddit": "View more comments on Reddit", "View more comments on Reddit": "View more comments on Reddit",

View file

@ -5,7 +5,6 @@
"Shared `x` ago": "Compartido hace `x`", "Shared `x` ago": "Compartido hace `x`",
"Unsubscribe": "Desuscribirse", "Unsubscribe": "Desuscribirse",
"Subscribe": "Suscribirse", "Subscribe": "Suscribirse",
"View channel on YouTube": "Ver el canal en YouTube", "View channel on YouTube": "Ver el canal en YouTube",
"newest": "más nuevos", "newest": "más nuevos",
"oldest": "más viejos", "oldest": "más viejos",
@ -113,6 +112,7 @@
"Whitelisted regions: ": "Regiones permitidas: ", "Whitelisted regions: ": "Regiones permitidas: ",
"Blacklisted regions: ": "Regiones bloqueadas: ", "Blacklisted regions: ": "Regiones bloqueadas: ",
"Shared `x`": "Compartido `x`", "Shared `x`": "Compartido `x`",
"`x` views": "",
"Premieres in `x`": "", "Premieres in `x`": "",
"Hi! Looks like you have JavaScript disabled. Click here to view comments, keep in mind it may take a bit longer to load.": "¡Hola! Parece que tiene JavaScript desactivado. Haga clic aquí para ver los comentarios, pero tenga en cuenta que pueden tardar un poco más en cargarse.", "Hi! Looks like you have JavaScript disabled. Click here to view comments, keep in mind it may take a bit longer to load.": "¡Hola! Parece que tiene JavaScript desactivado. Haga clic aquí para ver los comentarios, pero tenga en cuenta que pueden tardar un poco más en cargarse.",
"View YouTube comments": "Ver los comentarios de YouTube", "View YouTube comments": "Ver los comentarios de YouTube",

View file

@ -5,7 +5,6 @@
"Shared `x` ago": "Duela `x` partekatua", "Shared `x` ago": "Duela `x` partekatua",
"Unsubscribe": "Harpidetza kendu", "Unsubscribe": "Harpidetza kendu",
"Subscribe": "Harpidetu", "Subscribe": "Harpidetu",
"View channel on YouTube": "Ikusi kanala YouTuben", "View channel on YouTube": "Ikusi kanala YouTuben",
"newest": "berrienak", "newest": "berrienak",
"oldest": "zaharrenak", "oldest": "zaharrenak",
@ -113,6 +112,7 @@
"Whitelisted regions: ": "", "Whitelisted regions: ": "",
"Blacklisted regions: ": "", "Blacklisted regions: ": "",
"Shared `x`": "", "Shared `x`": "",
"`x` views": "",
"Premieres in `x`": "", "Premieres in `x`": "",
"Hi! Looks like you have JavaScript disabled. Click here to view comments, keep in mind it may take a bit longer to load.": "", "Hi! Looks like you have JavaScript disabled. Click here to view comments, keep in mind it may take a bit longer to load.": "",
"View YouTube comments": "", "View YouTube comments": "",

View file

@ -5,7 +5,6 @@
"Shared `x` ago": "Ajoutée il y a `x`", "Shared `x` ago": "Ajoutée il y a `x`",
"Unsubscribe": "Se désabonner", "Unsubscribe": "Se désabonner",
"Subscribe": "S'abonner", "Subscribe": "S'abonner",
"View channel on YouTube": "Voir la chaîne sur YouTube", "View channel on YouTube": "Voir la chaîne sur YouTube",
"newest": "Date d'ajout (la plus récente)", "newest": "Date d'ajout (la plus récente)",
"oldest": "Date d'ajout (la plus ancienne)", "oldest": "Date d'ajout (la plus ancienne)",
@ -113,6 +112,7 @@
"Whitelisted regions: ": "Régions en liste blanche : ", "Whitelisted regions: ": "Régions en liste blanche : ",
"Blacklisted regions: ": "Régions sur liste noire : ", "Blacklisted regions: ": "Régions sur liste noire : ",
"Shared `x`": "Ajoutée le `x`", "Shared `x`": "Ajoutée le `x`",
"`x` views": "",
"Premieres in `x`": "Première dans `x`", "Premieres in `x`": "Première dans `x`",
"Hi! Looks like you have JavaScript disabled. Click here to view comments, keep in mind it may take a bit longer to load.": "Il semblerait que JavaScript soit désactivé. Cliquez ici pour voir les commentaires sans. Gardez à l'esprit que le chargement peut prendre plus de temps.", "Hi! Looks like you have JavaScript disabled. Click here to view comments, keep in mind it may take a bit longer to load.": "Il semblerait que JavaScript soit désactivé. Cliquez ici pour voir les commentaires sans. Gardez à l'esprit que le chargement peut prendre plus de temps.",
"View YouTube comments": "Voir les commentaires YouTube", "View YouTube comments": "Voir les commentaires YouTube",

View file

@ -5,7 +5,6 @@
"Shared `x` ago": "Condiviso `x` fa", "Shared `x` ago": "Condiviso `x` fa",
"Unsubscribe": "Disiscriviti", "Unsubscribe": "Disiscriviti",
"Subscribe": "Iscriviti", "Subscribe": "Iscriviti",
"View channel on YouTube": "Vedi canale su YouTube", "View channel on YouTube": "Vedi canale su YouTube",
"newest": "Data di aggiunta (più recente)", "newest": "Data di aggiunta (più recente)",
"oldest": "Data di aggiunta (più vecchia)", "oldest": "Data di aggiunta (più vecchia)",
@ -113,6 +112,7 @@
"Whitelisted regions: ": "Regioni nella lista bianca: ", "Whitelisted regions: ": "Regioni nella lista bianca: ",
"Blacklisted regions: ": "Regioni nella lista nera: ", "Blacklisted regions: ": "Regioni nella lista nera: ",
"Shared `x`": "Condiviso `x`", "Shared `x`": "Condiviso `x`",
"`x` views": "",
"Premieres in `x`": "", "Premieres in `x`": "",
"Hi! Looks like you have JavaScript disabled. Click here to view comments, keep in mind it may take a bit longer to load.": "Ciao! Sembra che tu abbia disattivato JavaScript. Clicca qui per visualizzare i commenti. Considera che potrebbe volerci più tempo.", "Hi! Looks like you have JavaScript disabled. Click here to view comments, keep in mind it may take a bit longer to load.": "Ciao! Sembra che tu abbia disattivato JavaScript. Clicca qui per visualizzare i commenti. Considera che potrebbe volerci più tempo.",
"View YouTube comments": "Visualizza i commenti da YouTube", "View YouTube comments": "Visualizza i commenti da YouTube",

View file

@ -5,7 +5,6 @@
"Shared `x` ago": "Delt for `x` siden", "Shared `x` ago": "Delt for `x` siden",
"Unsubscribe": "Opphev abonnement", "Unsubscribe": "Opphev abonnement",
"Subscribe": "Abonner", "Subscribe": "Abonner",
"View channel on YouTube": "Vis kanal på YouTube", "View channel on YouTube": "Vis kanal på YouTube",
"newest": "nyeste", "newest": "nyeste",
"oldest": "eldste", "oldest": "eldste",
@ -113,6 +112,7 @@
"Whitelisted regions: ": "Hvitlistede regioner: ", "Whitelisted regions: ": "Hvitlistede regioner: ",
"Blacklisted regions: ": "Svartelistede regioner: ", "Blacklisted regions: ": "Svartelistede regioner: ",
"Shared `x`": "Delt `x`", "Shared `x`": "Delt `x`",
"`x` views": "",
"Premieres in `x`": "Premiere om `x`", "Premieres in `x`": "Premiere om `x`",
"Hi! Looks like you have JavaScript disabled. Click here to view comments, keep in mind it may take a bit longer to load.": "Hei. Det ser ut til at du har JavaScript avslått. Klikk her for å vise kommentarer, ha i minnet at innlasting tar lengre tid.", "Hi! Looks like you have JavaScript disabled. Click here to view comments, keep in mind it may take a bit longer to load.": "Hei. Det ser ut til at du har JavaScript avslått. Klikk her for å vise kommentarer, ha i minnet at innlasting tar lengre tid.",
"View YouTube comments": "Vis YouTube-kommentarer", "View YouTube comments": "Vis YouTube-kommentarer",

View file

@ -5,7 +5,6 @@
"Shared `x` ago": "Gedeeld `x` geleden", "Shared `x` ago": "Gedeeld `x` geleden",
"Unsubscribe": "Abonnement opzeggen", "Unsubscribe": "Abonnement opzeggen",
"Subscribe": "Abonneren", "Subscribe": "Abonneren",
"View channel on YouTube": "Bekijk kanaal op Youtube", "View channel on YouTube": "Bekijk kanaal op Youtube",
"newest": "nieuwste", "newest": "nieuwste",
"oldest": "oudste", "oldest": "oudste",
@ -113,6 +112,7 @@
"Whitelisted regions: ": "Toegestane regio's: ", "Whitelisted regions: ": "Toegestane regio's: ",
"Blacklisted regions: ": "Geblokkeerde regio's: ", "Blacklisted regions: ": "Geblokkeerde regio's: ",
"Shared `x`": "`x` gedeeld", "Shared `x`": "`x` gedeeld",
"`x` views": "",
"Premieres in `x`": "", "Premieres in `x`": "",
"Hi! Looks like you have JavaScript disabled. Click here to view comments, keep in mind it may take a bit longer to load.": "Hoi! Het lijkt erop dat je JavaScript uit hebt staan. Klik hier om de reacties te bekijken, hou er rekening mee dat het wat langer duurt om te laden.", "Hi! Looks like you have JavaScript disabled. Click here to view comments, keep in mind it may take a bit longer to load.": "Hoi! Het lijkt erop dat je JavaScript uit hebt staan. Klik hier om de reacties te bekijken, hou er rekening mee dat het wat langer duurt om te laden.",
"View YouTube comments": "Bekijk YouTube reacties", "View YouTube comments": "Bekijk YouTube reacties",

View file

@ -5,7 +5,6 @@
"Shared `x` ago": "Udostępniono `x` temu", "Shared `x` ago": "Udostępniono `x` temu",
"Unsubscribe": "Odsubskrybuj", "Unsubscribe": "Odsubskrybuj",
"Subscribe": "Subskrybuj", "Subscribe": "Subskrybuj",
"View channel on YouTube": "Wyświetl kanał na YouTube", "View channel on YouTube": "Wyświetl kanał na YouTube",
"newest": "najnowsze", "newest": "najnowsze",
"oldest": "najstarsze", "oldest": "najstarsze",
@ -113,6 +112,7 @@
"Whitelisted regions: ": "Dostępny na obszarach: ", "Whitelisted regions: ": "Dostępny na obszarach: ",
"Blacklisted regions: ": "Niedostępny na obszarach: ", "Blacklisted regions: ": "Niedostępny na obszarach: ",
"Shared `x`": "Udostępniono `x`", "Shared `x`": "Udostępniono `x`",
"`x` views": "",
"Premieres in `x`": "", "Premieres in `x`": "",
"Hi! Looks like you have JavaScript disabled. Click here to view comments, keep in mind it may take a bit longer to load.": "Cześć! Wygląda na to, że masz wyłączoną obsługę JavaScriptu. Kliknij tutaj, żeby zobaczyć komentarze. Pamiętaj, że wczytywanie może potrwać dłużej.", "Hi! Looks like you have JavaScript disabled. Click here to view comments, keep in mind it may take a bit longer to load.": "Cześć! Wygląda na to, że masz wyłączoną obsługę JavaScriptu. Kliknij tutaj, żeby zobaczyć komentarze. Pamiętaj, że wczytywanie może potrwać dłużej.",
"View YouTube comments": "Wyświetl komentarze z YouTube", "View YouTube comments": "Wyświetl komentarze z YouTube",

View file

@ -5,7 +5,6 @@
"Shared `x` ago": "Опубликовано `x` назад", "Shared `x` ago": "Опубликовано `x` назад",
"Unsubscribe": "Отписаться", "Unsubscribe": "Отписаться",
"Subscribe": "Подписаться", "Subscribe": "Подписаться",
"View channel on YouTube": "Канал на YouTube", "View channel on YouTube": "Канал на YouTube",
"newest": "новые", "newest": "новые",
"oldest": "старые", "oldest": "старые",
@ -115,6 +114,7 @@
"Whitelisted regions: ": "Доступно для: ", "Whitelisted regions: ": "Доступно для: ",
"Blacklisted regions: ": "Недоступно для: ", "Blacklisted regions: ": "Недоступно для: ",
"Shared `x`": "Опубликовано `x`", "Shared `x`": "Опубликовано `x`",
"`x` views": "",
"Premieres in `x`": "Премьера через `x`", "Premieres in `x`": "Премьера через `x`",
"Hi! Looks like you have JavaScript disabled. Click here to view comments, keep in mind it may take a bit longer to load.": "Похоже, что у Вас отключен JavaScript. Нажмите сюда, чтобы увидеть комментарии (учтите, что они могут загружаться дольше).", "Hi! Looks like you have JavaScript disabled. Click here to view comments, keep in mind it may take a bit longer to load.": "Похоже, что у Вас отключен JavaScript. Нажмите сюда, чтобы увидеть комментарии (учтите, что они могут загружаться дольше).",
"View YouTube comments": "Смотреть комментарии с YouTube", "View YouTube comments": "Смотреть комментарии с YouTube",

View file

@ -189,7 +189,9 @@ def number_to_short_text(number)
text = text.rchop(".0") text = text.rchop(".0")
if number / 1000000 != 0 if number / 1_000_000_000 != 0
text += "B"
elsif number / 1_000_000 != 0
text += "M" text += "M"
elsif number / 1000 != 0 elsif number / 1000 != 0
text += "K" text += "K"

View file

@ -71,7 +71,12 @@
<% if item.responds_to?(:premiere_timestamp) && item.premiere_timestamp && item.premiere_timestamp.not_nil! > Time.now %> <% if item.responds_to?(:premiere_timestamp) && item.premiere_timestamp && item.premiere_timestamp.not_nil! > Time.now %>
<h5><%= translate(locale, "Premieres in `x`", recode_date((item.premiere_timestamp.as(Time) - Time.now).ago, locale)) %></h5> <h5><%= translate(locale, "Premieres in `x`", recode_date((item.premiere_timestamp.as(Time) - Time.now).ago, locale)) %></h5>
<% elsif Time.now - item.published > 1.minute %> <% elsif Time.now - item.published > 1.minute %>
<h5><%= translate(locale, "Shared `x` ago", recode_date(item.published, locale)) %></h5> <h5 class="pure-g">
<div class="pure-u-2-3"><%= translate(locale, "Shared `x` ago", recode_date(item.published, locale)) %></div>
<div class="pure-u-1-3" style="text-align: right">
<%= item.responds_to?(:views) ? translate(locale, "`x` views", number_to_short_text(item.views)) : "" %>
</div>
</h5>
<% end %> <% end %>
<% else %> <% else %>
<% if env.get("preferences").as(Preferences).thin_mode %> <% if env.get("preferences").as(Preferences).thin_mode %>
@ -108,7 +113,12 @@
<% if item.responds_to?(:premiere_timestamp) && item.premiere_timestamp && item.premiere_timestamp.not_nil! > Time.now %> <% if item.responds_to?(:premiere_timestamp) && item.premiere_timestamp && item.premiere_timestamp.not_nil! > Time.now %>
<h5><%= translate(locale, "Premieres in `x`", recode_date((item.premiere_timestamp.as(Time) - Time.now).ago, locale)) %></h5> <h5><%= translate(locale, "Premieres in `x`", recode_date((item.premiere_timestamp.as(Time) - Time.now).ago, locale)) %></h5>
<% elsif Time.now - item.published > 1.minute %> <% elsif Time.now - item.published > 1.minute %>
<h5><%= translate(locale, "Shared `x` ago", recode_date(item.published, locale)) %></h5> <h5 class="pure-g">
<div class="pure-u-2-3"><%= translate(locale, "Shared `x` ago", recode_date(item.published, locale)) %></div>
<div class="pure-u-1-3" style="text-align: right">
<%= item.responds_to?(:views) ? translate(locale, "`x` views", number_to_short_text(item.views)) : "" %>
</div>
</h5>
<% end %> <% end %>
<% end %> <% end %>
</div> </div>