Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Translate correctly Welsh published date #3444

Merged
merged 1 commit into from
Dec 2, 2024
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
2 changes: 1 addition & 1 deletion app/presenters/content_item_presenter.rb
Original file line number Diff line number Diff line change
Expand Up @@ -126,7 +126,7 @@ def voting_is_open?
end

def display_date(timestamp, format = "%-d %B %Y")
I18n.l(Time.zone.parse(timestamp), format:, locale: "en") if timestamp
I18n.l(Time.zone.parse(timestamp), format:, locale:) if timestamp
end

def sorted_locales(translations)
Expand Down
14 changes: 14 additions & 0 deletions test/integration/publication_test.rb
Original file line number Diff line number Diff line change
Expand Up @@ -294,4 +294,18 @@ class PublicationTest < ActionDispatch::IntegrationTest
setup_and_visit_content_item("publication-with-featured-attachments", overrides)
assert page.has_css?('meta[name="robots"][content="noindex"]', visible: false)
end

test "translates Welsh published date correctly" do
setup_and_visit_content_item("publication", { "locale" => "cy" })

assert_has_metadata({
published: "3 Mai 2016",
from: {
"Environment Agency": "/government/organisations/environment-agency",
"The Rt Hon Sir Eric Pickles MP": "/government/people/eric-pickles",
},
})

assert_footer_has_published_dates("Cyhoeddwyd ar 3 Mai 2016")
end
end