views/podcasts, views/podcast_episodes i18n (#15020)

* views/podcasts, views/podcast_episodes i18n

* reformat for PR

* helper labels

* PR sync with main

* remove ja.yml

* Update en.yml

* Update fr.yml

* Update _meta.html.erb

* Update podcast_episodes_index_spec.rb

* Update podcast_create_spec.rb

* Update user_visits_podcast_episode_spec.rb

* Update en.yml

* Update feed.rb

* Update index.html.erb
This commit is contained in:
yheuhtozr 2021-10-25 22:32:51 +09:00 committed by GitHub
parent 719b87e2ae
commit 6a3a91d9b7
No known key found for this signature in database
GPG key ID: 4AEE18F83AFDEB23
16 changed files with 144 additions and 60 deletions

View file

@ -35,7 +35,7 @@ module Podcasts
def set_unreachable(status: :unreachable, force_update: false)
# don't recheck if the podcast was already unreachable or force update is required
need_refetching = podcast.reachable || force_update
podcast.update_columns(reachable: false, status_notice: I18n.t(status, scope: "podcasts.statuses"))
podcast.update_columns(reachable: false, status_notice: I18n.t(status, scope: "views.podcasts.statuses"))
refetch_items if need_refetching
true
end

View file

@ -7,7 +7,7 @@
image_options: { alt: episode.title, loading: "lazy"}) %>
</div>
<div class="content">
<h3><span class="tag-identifier">podcast</span><%= episode.title %></h3>
<h3><span class="tag-identifier"><%= t("views.podcasts.tag") %></span><%= episode.title %></h3>
</div>
<h4>
<a href="/<%= episode.podcast.slug %>">

View file

@ -22,25 +22,25 @@
<meta name="twitter:image:src" content="<%= Settings::General.main_social_image %>">
<% end %>
<% else %>
<% title "Podcasts" %>
<% title t("views.podcasts.meta.title") %>
<%= content_for :page_meta do %>
<link rel="canonical" href="<%= app_url(pod_path) %>" />
<meta name="description" content="Discover technical podcasts for <%= community_members_label %>">
<meta name="description" content="<%= t("views.podcasts.meta.description", member: community_members_label) %>">
<%= meta_keywords_default %>
<meta property="og:type" content="article" />
<meta property="og:url" content="<%= app_url(pod_path) %>" />
<meta property="og:title" content="Podcasts on <%= community_name %>" />
<meta property="og:title" content="<%= t("views.podcasts.meta.og.title", community: community_name) %>" />
<meta property="og:image" content="<%= Settings::General.main_social_image %>">
<meta property="og:description" content="Discover technical podcasts for <%= community_members_label %>" />
<meta property="og:description" content="<%= t("views.podcasts.meta.description", member: community_members_label) %>" />
<meta property="og:site_name" content="<%= community_name %>" />
<meta name="twitter:card" content="summary_large_image">
<meta name="twitter:site" content="@<%= Settings::General.social_media_handles["twitter"] %>">
<meta name="twitter:creator" content="@<%= Settings::General.social_media_handles["twitter"] %>">
<meta name="twitter:title" content="Podcasts on <%= community_name %>">
<meta name="twitter:description" content="Discover technical podcasts for <%= community_members_label %>" />
<meta name="twitter:title" content="<%= t("views.podcasts.meta.og.title", community: community_name) %>">
<meta name="twitter:description" content="<%= t("views.podcasts.meta.description", member: community_members_label) %>" />
<meta name="twitter:image:src" content="<%= Settings::General.main_social_image %>">
<% end %>
<% end %>

View file

@ -1,7 +1,7 @@
<div class="hidden-audio" id="hidden-audio-<%= episode.slug %>" style="display:none" data-episode="<%= episode.slug %>" data-podcast="<%= podcast.slug %>">
<audio id="audio" data-episode="<%= episode.slug %>" data-podcast="<%= podcast.slug %>">
<source src="<%= episode.media_url %>" type="audio/mpeg">
Your browser does not support the audio element.
<%= t("views.podcasts.unsupported") %>
</audio>
<div id="progressBar" class="audio-player-display">
<a href="/<%= podcast.slug %>/<%= episode.slug %>">
@ -26,13 +26,13 @@
<span id="mutebutt" class="volume-icon-wrapper hidden">
<%= image_tag("volume-mute.png", alt: "volume-mute", class: "icon-img", height: 16, width: 16) %>
</span>
<span class="speed" id="speed" data-speed=1>1x</span>
<span class="speed" id="speed" data-speed=1><%= t("views.podcasts.speed") %></span>
</span>
<span class="buffer-wrapper" id="bufferwrapper">
<span id="buffer"></span>
<span id="progress"></span>
<span id="time">initializing...</span>
<span id="closebutt">×</span>
<span id="time"><%= t("views.podcasts.initializing") %></span>
<span id="closebutt"><%= t("views.podcasts.close") %></span>
</span>
</div>
</div>

View file

@ -5,7 +5,7 @@
<div class="spec__podcast-header" style="background:#<%= @podcast.main_color_hex %>;" class="mb-4">
<div class="crayons-layout relative">
<nav class="s:absolute mt-2">
<a href="/pod" class="crayons-btn crayons-btn--ghost crayons-btn--inverted">&laquo; <%= t("podcasts.view_all_podcasts") %></a>
<a href="/pod" class="crayons-btn crayons-btn--ghost crayons-btn--inverted"><%= t("views.podcasts.view_all_podcasts") %></a>
</nav>
<div class="flex s:flex-col items-start s:items-center p-3 pt-0 s:pt-3">
<span class="crayons-logo crayons-logo--2xl s:crayons-logo--3xl mr-4 s:mr-0 s:mb-2">
@ -34,12 +34,12 @@
<% unless @podcast %>
<header class="flex items-center justify-between p-3 pb-0 m:p-0">
<h1 class="crayons-title">
<%= t("core.podcasts") %>
<%= t("views.podcasts.heading") %>
</h1>
<p><%= link_to t("podcasts.suggest_a_podcast"), new_podcast_path, class: "crayons-btn crayons-btn--ghost" %></p>
<p><%= link_to t("views.podcasts.suggest_a_podcast"), new_podcast_path, class: "crayons-btn crayons-btn--ghost" %></p>
</header>
<% end %>
<h2 class="crayons-subtitle-1 p-3 pt-0 m:p-0"><%= t("podcasts.latest_episodes") %></h2>
<h2 class="crayons-subtitle-1 p-3 pt-0 m:p-0"><%= t("views.podcasts.latest_episodes") %></h2>
<div class="grid gap-2 m:gap-4 grid-cols-2 s:grid-cols-3 m:grid-cols-5 px-2 m:px-0 mb-6">
<% @podcast_episodes.each do |episode| %>
<% episode = episode.decorate %>
@ -68,7 +68,7 @@
<%= paginate @podcast_episodes, params: { i: nil } %>
<% end %>
<% if @featured_podcasts && @featured_podcasts.any? %>
<h2 class="crayons-subtitle-1 p-3 m:p-0"><%= t("podcasts.featured_shows") %></h2>
<h2 class="crayons-subtitle-1 p-3 m:p-0"><%= t("views.podcasts.featured_shows") %></h2>
<div class="grid gap-2 m:gap-4 l:gap-6 grid-cols-2 m:grid-cols-<%= [@featured_podcasts.size, 3].max %> px-2 m:px-0 mb-6">
<% @featured_podcasts.each do |podcast| %>
<a href="/<%= podcast.slug %>">
@ -81,7 +81,7 @@
</a>
<% end %>
</div>
<h2 class="crayons-subtitle-1 p-3 m:p-0"><%= t("core.browse") %></h2>
<h2 class="crayons-subtitle-1 p-3 m:p-0"><%= t("views.podcasts.browse") %></h2>
<div class="grid gap-2 s:grid-cols-2 m:grid-cols-4 px-2 m:px-0">
<% @more_podcasts.each do |podcast| %>
<a href="/<%= podcast.slug %>" class="crayons-link flex items-center m:fs-l lh-tight">

View file

@ -70,10 +70,10 @@
<% unless @episode.https? %>
<center>
<h1 style="color: #e05252;">
<%= I18n.t "podcasts.statuses.unplayable" %>
<%= t("views.podcasts.statuses.unplayable") %>
</h1>
<p>
<a href="<%= @episode.media_url %>">Click here to download/listen</a>
<a href="<%= @episode.media_url %>"><%= t("views.podcasts.listen") %></a>
</p>
</center>
<% end %>
@ -89,7 +89,7 @@
attributes: %w[href strong em class ref rel src title alt colspan height width size rowspan span value start data-conversation data-lang id] %>
<% end %>
<p><a href="<%= @episode.website_url %>">Episode source</a></p>
<p><a href="<%= @episode.website_url %>"><%= t("views.podcasts.source") %></a></p>
</div>
<section

View file

@ -3,12 +3,12 @@
<%= form_with(model: podcast, local: true) do |form| %>
<div>
<header class="mb-4">
<a href="/pod" class="crayons-link crayons-link--secondary fs-s">&laquo; Return to podcasts</a>
<h1 class="crayons-title"><%= I18n.t("podcasts.suggest_a_podcast") %></h1>
<a href="/pod" class="crayons-link crayons-link--secondary fs-s"><%= t("views.podcasts.form.return") %></a>
<h1 class="crayons-title"><%= t("views.podcasts.form.heading") %></h1>
</header>
<% if podcast.errors.any? %>
<div class="podcast-errors">
<h2><%= pluralize(podcast.errors.count, "error") %> while creating a podcast:</h2>
<h2><%= t("views.podcasts.form.errors", count: podcast.errors.count) %></h2>
<ul>
<% podcast.errors.full_messages.each do |message| %>
<li><%= message %></li>
@ -19,7 +19,7 @@
<div id="podcast-form-data" class="crayons-card mb-6 grid grid-flow-row gap-4 s:gap-6 p-4 s:p-6">
<div class="crayons-field crayons-field--checkbox">
<%= check_box_tag :i_am_owner, {}, {}, class: "crayons-checkbox" %>
<%= label_tag :i_am_owner, "I am the owner of this podcast", class: "crayons-field__label" %>
<%= label_tag :i_am_owner, t("views.podcasts.form.owner"), class: "crayons-field__label" %>
</div>
<div class="crayons-field">
<%= form.label :title, class: "crayons-field__label" %>
@ -74,7 +74,7 @@
<%= form.text_field :soundcloud_url, class: "crayons-textfield", placeholder: "https://..." %>
</div>
<div class="crayons-field">
<%= form.submit "Suggest", class: "crayons-btn" %>
<%= form.submit t("views.podcasts.form.suggest"), class: "crayons-btn" %>
</div>
</div>
</div>

View file

@ -7,7 +7,6 @@ en:
core:
add_comment: Add comment
analytics: Analytics
browse: Browse
comment: Comment
comments: Comments
community_name_is_great: "%{community_name} is great!"
@ -38,7 +37,6 @@ en:
month: Month
more_from: More from
my_tags: My Tags
podcasts: Podcasts
pinned: Pinned
popular_tags: Popular Tags
post: Post
@ -147,16 +145,6 @@ en:
wrong_length:
one: is the wrong length (should be 1 character)
other: is the wrong length (should be %{count} characters)
podcasts:
featured_shows: Featured shows
latest_episodes: Latest episodes
suggest_a_podcast: Suggest a podcast
view_all_podcasts: View all podcasts
statuses:
ssl_failed: SSL certificate verify failed while fetching podcast's feed_url
unparsable: Podcast's rss couldn't be parsed
unplayable: This podcast may not be playable in the browser
unreachable: Podcast's feed_url is not reachable
settings_menu:
account: Account
billing: Billing

View file

@ -7,7 +7,6 @@ fr:
core:
add_comment: Ajouter un commentaire
analytics: Analytique
browse: Parcourir
comment: Commentaire
comments: Commentaires
community_name_is_great: "%{community_name} est super"
@ -38,7 +37,6 @@ fr:
month: Mois
more_from: Plus de la part de
my_tags: Mes sujets
podcasts: Podcasts
pinned: Épinglé
popular_tags: Sujets populaires
post: Publication
@ -170,16 +168,6 @@ fr:
wrong_length:
one: est la mauvaise longueur (devrait être 1 caractère)
other: est la mauvaise longueur (devrait être %{count} caractères)
podcasts:
featured_shows: Épisodes en vedette
latest_episodes: Épisodes Récents
suggest_a_podcast: Suggérer un podcast
view_all_podcasts: Voir tous les podcasts
statuses:
ssl_failed: Échec de la vérification du certificat SSL lors de la récupération de feed_url du podcast
unparsable: Le rss du podcast n'a pas pu être analysé
unplayable: Ce podcast peut ne pas être lisible dans le navigateur
unreachable: Le feed_url du podcast n'est pas accessible
settings_menu:
account: Compte
billing: Facturation

View file

@ -0,0 +1,18 @@
---
en:
helpers:
label:
podcast:
android_url: Android url
description: Description
feed_url: Feed url
image: Image
itunes_url: Itunes url
main_color_hex: Main color hex
overcast_url: Overcast url
pattern_image: Pattern image
slug: Slug
soundcloud_url: Soundcloud url
title: Title
twitter_username: Twitter username
website_url: Website url

View file

@ -0,0 +1,18 @@
---
fr:
helpers:
label:
podcast:
android_url: Android url
description: Description
feed_url: Feed url
image: Image
itunes_url: Itunes url
main_color_hex: Main color hex
overcast_url: Overcast url
pattern_image: Pattern image
slug: Slug
soundcloud_url: Soundcloud url
title: Title
twitter_username: Twitter username
website_url: Website url

View file

@ -0,0 +1,36 @@
---
en:
views:
podcasts:
meta:
title: Podcasts
description: Discover technical podcasts for %{member}
og:
title: Podcasts on %{community}
browse: Browse
heading: Podcasts
close: "×"
form:
heading: Suggest a Podcast
errors:
one: '1 error while creating a podcast:'
other: "%{count} errors while creating a podcast:"
owner: I am the owner of this podcast
return: "< return to podcasts"
suggest: Suggest
list: podcasts
listen: Click here to download/listen
source: Episode source
statuses:
ssl_failed: SSL certificate verify failed while fetching podcast's feed_url
unparsable: Podcast's rss couldn't be parsed
unplayable: This podcast may not be playable in the browser
unreachable: Podcast's feed_url is not reachable
speed: 1x
tag: podcast
initializing: initializing...
unsupported: Your browser does not support the audio element.
featured_shows: Featured shows
latest_episodes: Latest episodes
suggest_a_podcast: Suggest a Podcast
view_all_podcasts: View all podcasts

View file

@ -0,0 +1,36 @@
---
fr:
views:
podcasts:
meta:
title: Podcasts
description: Discover technical podcasts for %{member}
og:
title: Podcasts on %{community}
browse: Parcourir
heading: Podcasts
close: "×"
form:
heading: Suggest a Podcast
errors:
one: '1 error while creating a podcast:'
other: "%{count} errors while creating a podcast:"
owner: I am the owner of this podcast
return: "< return to podcasts"
suggest: Suggest
list: podcasts
listen: Click here to download/listen
source: Episode source
statuses:
ssl_failed: Échec de la vérification du certificat SSL lors de la récupération de feed_url du podcast
unparsable: Le rss du podcast n'a pas pu être analysé
unplayable: Ce podcast peut ne pas être lisible dans le navigateur
unreachable: Le feed_url du podcast n'est pas accessible
speed: 1x
tag: podcast
initializing: initializing...
unsupported: Your browser does not support the audio element.
featured_shows: Épisodes en vedette
latest_episodes: Épisodes Récents
suggest_a_podcast: Suggérer un podcast
view_all_podcasts: Voir tous les podcasts

View file

@ -72,7 +72,7 @@ RSpec.describe "Podcast Create", type: :request do
it "doesn't create with invalid attributes" do
create(:podcast, slug: valid_attributes[:slug])
post podcasts_path, params: { podcast: valid_attributes }
expect(response.body).to include(I18n.t("podcasts.suggest_a_podcast"))
expect(response.body).to include(I18n.t("views.podcasts.suggest_a_podcast"))
end
it "returns error if image file name is too long" do
@ -80,14 +80,14 @@ RSpec.describe "Podcast Create", type: :request do
allow(image).to receive(:original_filename).and_return("#{'a_very_long_filename' * 15}.png")
valid_attributes[:image] = image
post podcasts_path, params: { podcast: valid_attributes }
expect(response.body).to include(I18n.t("podcasts.suggest_a_podcast"))
expect(response.body).to include(I18n.t("views.podcasts.suggest_a_podcast"))
end
it "returns error if image is not a file" do
image = "A String"
valid_attributes[:image] = image
post podcasts_path, params: { podcast: valid_attributes }
expect(response.body).to include(I18n.t("podcasts.suggest_a_podcast"))
expect(response.body).to include(I18n.t("views.podcasts.suggest_a_podcast"))
end
it "returns error if pattern_image file name is too long" do
@ -95,14 +95,14 @@ RSpec.describe "Podcast Create", type: :request do
allow(image).to receive(:original_filename).and_return("#{'a_very_long_filename' * 15}.png")
valid_attributes[:pattern_image] = image
post podcasts_path, params: { podcast: valid_attributes }
expect(response.body).to include(I18n.t("podcasts.suggest_a_podcast"))
expect(response.body).to include(I18n.t("views.podcasts.suggest_a_podcast"))
end
it "returns error if pattern_image is not a file" do
image = "A String"
valid_attributes[:pattern_image] = image
post podcasts_path, params: { podcast: valid_attributes }
expect(response.body).to include(I18n.t("podcasts.suggest_a_podcast"))
expect(response.body).to include(I18n.t("views.podcasts.suggest_a_podcast"))
end
end
end

View file

@ -4,7 +4,7 @@ RSpec.describe "Podcast Episodes Index Spec", type: :request do
describe "GET podcast episodes index" do
it "renders page with proper sidebar" do
get "/pod"
expect(response.body).to include(I18n.t("podcasts.suggest_a_podcast"))
expect(response.body).to include(I18n.t("views.podcasts.suggest_a_podcast"))
end
it "shows reachable podcasts" do
@ -19,12 +19,12 @@ RSpec.describe "Podcast Episodes Index Spec", type: :request do
podcast = create(:podcast, featured: true, published: true)
create(:podcast_episode, title: "SuperMario", podcast: podcast)
get "/pod"
expect(response.body).to include(I18n.t("podcasts.featured_shows"))
expect(response.body).to include(I18n.t("views.podcasts.featured_shows"))
end
it "does not show featured podcasts area if there are not any" do
get "/pod"
expect(response.body).not_to include(I18n.t("podcasts.featured_shows"))
expect(response.body).not_to include(I18n.t("views.podcasts.featured_shows"))
end
it "sets proper surrogate key" do

View file

@ -52,7 +52,7 @@ RSpec.describe "User visits podcast show page", type: :system, js: true do
podcast_episode = create(:podcast_episode, https: false)
visit podcast_episode.path.to_s
expect(page).to have_text(I18n.t("podcasts.statuses.unplayable"))
expect(page).to have_text(I18n.t("views.podcasts.statuses.unplayable"))
expect(page).to have_text("Click here to download")
end
end
@ -64,7 +64,7 @@ RSpec.describe "User visits podcast show page", type: :system, js: true do
it "doesn't display status_notice" do
visit podcast_episode.path.to_s
expect(page).not_to have_text("Random status notice")
expect(page).not_to have_text(I18n.t("podcasts.statuses.unplayable"))
expect(page).not_to have_text(I18n.t("views.podcasts.statuses.unplayable"))
expect(page).not_to have_text("Click here to download")
end
end