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`",
"Unsubscribe": "إلغاء الإشتراك",
"Subscribe": "إشتراك",
"View channel on YouTube": "زيارة القناة على موقع يوتيوب",
"newest": "الأجدد",
"oldest": "الأقدم",
@ -115,6 +114,7 @@
"Whitelisted regions: ": "الدول المسموح فيها هذا الفيديو: ",
"Blacklisted regions: ": "الدول الحظور فيها هذا الفيديو: ",
"Shared `x`": "شارك منذ `x`",
"`x` views": "",
"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.": "اهلا! يبدو ان الجافاسكريبت معطلة. اضغط هنا لعرض التعليقات, ضع فى إعتبارك انها ستأخذ وقت اطول للعرض.",
"View YouTube comments": "عرض تعليقات اليوتيوب",

View File

@ -5,7 +5,6 @@
"Shared `x` ago": "Vor `x` geteilt",
"Unsubscribe": "Abbestellen",
"Subscribe": "Abonnieren",
"View channel on YouTube": "Kanal auf YouTube anzeigen",
"newest": "neueste",
"oldest": "älteste",
@ -115,6 +114,7 @@
"Whitelisted regions: ": "Erlaubte Regionen: ",
"Blacklisted regions: ": "Unerlaubte Regionen: ",
"Shared `x`": "Geteilt `x`",
"`x` views": "",
"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.",
"View YouTube comments": "YouTube Kommentare anzeigen",

View File

@ -5,7 +5,6 @@
"Shared `x` ago": "Shared `x` ago",
"Unsubscribe": "Unsubscribe",
"Subscribe": "Subscribe",
"View channel on YouTube": "View channel on YouTube",
"newest": "newest",
"oldest": "oldest",
@ -103,7 +102,7 @@
"View JavaScript license information.": "View JavaScript license information.",
"View privacy policy.": "View privacy policy.",
"Trending": "Trending",
"Unlisted": "",
"Unlisted": "Unlisted",
"Watch video on Youtube": "Watch video on Youtube",
"Genre: ": "Genre: ",
"License: ": "License: ",
@ -113,7 +112,8 @@
"Whitelisted regions: ": "Whitelisted regions: ",
"Blacklisted regions: ": "Blacklisted regions: ",
"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.",
"View YouTube comments": "View YouTube comments",
"View more comments on Reddit": "View more comments on Reddit",

View File

@ -5,7 +5,6 @@
"Shared `x` ago": "Compartido hace `x`",
"Unsubscribe": "Desuscribirse",
"Subscribe": "Suscribirse",
"View channel on YouTube": "Ver el canal en YouTube",
"newest": "más nuevos",
"oldest": "más viejos",
@ -113,6 +112,7 @@
"Whitelisted regions: ": "Regiones permitidas: ",
"Blacklisted regions: ": "Regiones bloqueadas: ",
"Shared `x`": "Compartido `x`",
"`x` views": "",
"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.",
"View YouTube comments": "Ver los comentarios de YouTube",

View File

@ -5,7 +5,6 @@
"Shared `x` ago": "Duela `x` partekatua",
"Unsubscribe": "Harpidetza kendu",
"Subscribe": "Harpidetu",
"View channel on YouTube": "Ikusi kanala YouTuben",
"newest": "berrienak",
"oldest": "zaharrenak",
@ -113,6 +112,7 @@
"Whitelisted regions: ": "",
"Blacklisted regions: ": "",
"Shared `x`": "",
"`x` views": "",
"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.": "",
"View YouTube comments": "",

View File

@ -5,7 +5,6 @@
"Shared `x` ago": "Ajoutée il y a `x`",
"Unsubscribe": "Se désabonner",
"Subscribe": "S'abonner",
"View channel on YouTube": "Voir la chaîne sur YouTube",
"newest": "Date d'ajout (la plus récente)",
"oldest": "Date d'ajout (la plus ancienne)",
@ -113,6 +112,7 @@
"Whitelisted regions: ": "Régions en liste blanche : ",
"Blacklisted regions: ": "Régions sur liste noire : ",
"Shared `x`": "Ajoutée le `x`",
"`x` views": "",
"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.",
"View YouTube comments": "Voir les commentaires YouTube",

View File

@ -5,7 +5,6 @@
"Shared `x` ago": "Condiviso `x` fa",
"Unsubscribe": "Disiscriviti",
"Subscribe": "Iscriviti",
"View channel on YouTube": "Vedi canale su YouTube",
"newest": "Data di aggiunta (più recente)",
"oldest": "Data di aggiunta (più vecchia)",
@ -113,6 +112,7 @@
"Whitelisted regions: ": "Regioni nella lista bianca: ",
"Blacklisted regions: ": "Regioni nella lista nera: ",
"Shared `x`": "Condiviso `x`",
"`x` views": "",
"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.",
"View YouTube comments": "Visualizza i commenti da YouTube",

View File

@ -5,7 +5,6 @@
"Shared `x` ago": "Delt for `x` siden",
"Unsubscribe": "Opphev abonnement",
"Subscribe": "Abonner",
"View channel on YouTube": "Vis kanal på YouTube",
"newest": "nyeste",
"oldest": "eldste",
@ -113,6 +112,7 @@
"Whitelisted regions: ": "Hvitlistede regioner: ",
"Blacklisted regions: ": "Svartelistede regioner: ",
"Shared `x`": "Delt `x`",
"`x` views": "",
"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.",
"View YouTube comments": "Vis YouTube-kommentarer",

View File

@ -5,7 +5,6 @@
"Shared `x` ago": "Gedeeld `x` geleden",
"Unsubscribe": "Abonnement opzeggen",
"Subscribe": "Abonneren",
"View channel on YouTube": "Bekijk kanaal op Youtube",
"newest": "nieuwste",
"oldest": "oudste",
@ -113,6 +112,7 @@
"Whitelisted regions: ": "Toegestane regio's: ",
"Blacklisted regions: ": "Geblokkeerde regio's: ",
"Shared `x`": "`x` gedeeld",
"`x` views": "",
"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.",
"View YouTube comments": "Bekijk YouTube reacties",

View File

@ -5,7 +5,6 @@
"Shared `x` ago": "Udostępniono `x` temu",
"Unsubscribe": "Odsubskrybuj",
"Subscribe": "Subskrybuj",
"View channel on YouTube": "Wyświetl kanał na YouTube",
"newest": "najnowsze",
"oldest": "najstarsze",
@ -113,6 +112,7 @@
"Whitelisted regions: ": "Dostępny na obszarach: ",
"Blacklisted regions: ": "Niedostępny na obszarach: ",
"Shared `x`": "Udostępniono `x`",
"`x` views": "",
"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.",
"View YouTube comments": "Wyświetl komentarze z YouTube",

View File

@ -5,7 +5,6 @@
"Shared `x` ago": "Опубликовано `x` назад",
"Unsubscribe": "Отписаться",
"Subscribe": "Подписаться",
"View channel on YouTube": "Канал на YouTube",
"newest": "новые",
"oldest": "старые",
@ -115,6 +114,7 @@
"Whitelisted regions: ": "Доступно для: ",
"Blacklisted regions: ": "Недоступно для: ",
"Shared `x`": "Опубликовано `x`",
"`x` views": "",
"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. Нажмите сюда, чтобы увидеть комментарии (учтите, что они могут загружаться дольше).",
"View YouTube comments": "Смотреть комментарии с YouTube",

View File

@ -189,7 +189,9 @@ def number_to_short_text(number)
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"
elsif number / 1000 != 0
text += "K"

View File

@ -71,7 +71,12 @@
<% 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>
<% 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 %>
<% else %>
<% 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 %>
<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 %>
<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 %>
</div>