mirror of https://github.com/iv-org/invidious.git
video lengths on badge are now translatable
This commit is contained in:
parent
e89f739e02
commit
34a2a92090
File diff suppressed because it is too large
Load Diff
|
@ -11,16 +11,16 @@ def ci_lower_bound(pos, n)
|
||||||
return (phat + z*z/(2*n) - z * Math.sqrt((phat*(1 - phat) + z*z/(4*n))/n))/(1 + z*z/n)
|
return (phat + z*z/(2*n) - z * Math.sqrt((phat*(1 - phat) + z*z/(4*n))/n))/(1 + z*z/n)
|
||||||
end
|
end
|
||||||
|
|
||||||
def video_length_abbreviated(length)
|
def video_length_abbreviated(locale, length)
|
||||||
length_abbreviated = ""
|
length_abbreviated = ""
|
||||||
if length.days > 0
|
if length.days > 0
|
||||||
length_abbreviated = "#{length.days} d #{length.hours} hr #{length.minutes} min"
|
length_abbreviated = "#{translate_count(locale, "generic_count_days_short", length.days)} #{translate_count(locale, "generic_count_hours_short", length.hours)} #{translate_count(locale, "generic_count_minutes_short", length.minutes)}"
|
||||||
elsif length.hours > 0
|
elsif length.hours > 0
|
||||||
length_abbreviated = "#{length.hours} h #{length.minutes} min"
|
length_abbreviated = "#{translate_count(locale, "generic_count_hours_short", length.hours)} #{translate_count(locale, "generic_count_minutes_short", length.minutes)}"
|
||||||
elsif length.minutes > 0
|
elsif length.minutes > 0
|
||||||
length_abbreviated = "#{length.minutes} min"
|
length_abbreviated = translate_count(locale, "generic_count_minutes_short", length.minutes)
|
||||||
else
|
else
|
||||||
length_abbreviated = "#{length.seconds} seconds"
|
length_abbreviated = translate_count(locale, "generic_count_seconds", length.seconds)
|
||||||
end
|
end
|
||||||
|
|
||||||
return length_abbreviated
|
return length_abbreviated
|
||||||
|
|
|
@ -77,8 +77,8 @@ we're going to need to do it here in order to allow for translations.
|
||||||
<div class="h-box">
|
<div class="h-box">
|
||||||
<h1>
|
<h1>
|
||||||
<%= title %>
|
<%= title %>
|
||||||
<span class="length-watch-page">
|
<span class="length-watch-page">
|
||||||
<%= video_length_abbreviated(video.length_seconds.seconds)%>
|
<%= video_length_abbreviated(locale, video.length_seconds.seconds)%>
|
||||||
</span>
|
</span>
|
||||||
<% if params.listen %>
|
<% if params.listen %>
|
||||||
<a title="<%=translate(locale, "Video mode")%>" href="/watch?<%= env.params.query %>&listen=0">
|
<a title="<%=translate(locale, "Video mode")%>" href="/watch?<%= env.params.query %>&listen=0">
|
||||||
|
@ -90,7 +90,7 @@ we're going to need to do it here in order to allow for translations.
|
||||||
</a>
|
</a>
|
||||||
<% end %>
|
<% end %>
|
||||||
</h1>
|
</h1>
|
||||||
|
|
||||||
|
|
||||||
<% if !video.is_listed %>
|
<% if !video.is_listed %>
|
||||||
<h3>
|
<h3>
|
||||||
|
|
Loading…
Reference in New Issue