Skip to content

Commit

Permalink
Merge pull request #3444 from alphagov/translate-correctly-welsh-publ…
Browse files Browse the repository at this point in the history
…ished-date

Translate correctly Welsh published date
  • Loading branch information
catalinailie authored Dec 2, 2024
2 parents 915ce5d + 74979b8 commit d7eeea1
Show file tree
Hide file tree
Showing 2 changed files with 15 additions and 1 deletion.
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

0 comments on commit d7eeea1

Please sign in to comment.