-
Notifications
You must be signed in to change notification settings - Fork 17
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
Force English for metadata #1416
Conversation
c2aaab7
to
8a18980
Compare
8a18980
to
5961d81
Compare
<% if link_to_history && history.empty? %> | ||
— <a href="#history"><%= t('components.published_dates.see_all_updates') %></a> | ||
— <a href="#history">see all updates</a> |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Rather than hardcode the text here, we can be explicit about which locale translation we want to use: <%= t('components.published_dates.see_all_updates', locale: :en) %>
<% elsif history.any? %> | ||
<a href="#full-history" | ||
class="app-c-published-dates__toggle" | ||
data-controls="full-history" | ||
data-expanded="false" | ||
data-toggled-text="- <%= t('components.published_dates.hide_all_updates') %>">+ <%= t('components.published_dates.show_all_updates') | ||
%></a> | ||
data-toggled-text="- hide all updates">+ show all updates</a> |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
As above, we can specify the locale in the translation by passing the locale: :en
param.
On translated pages we are largely failing to translate the metadata, leading to messy strings where the only translated content is the month or the word "and" amongst otherwise English sentences. This change sets the locale to English for the dates, and reverts attempts to translate other sections of the page, and it marks the components as being in English. It removes classnames that aren't used from the CSS and forces the text direction to be left-to-right for these components. This marks the page up more semantically, and supports a better experience for screenreader users as they can now context switch the language appropriately.
5961d81
to
2017156
Compare
https://trello.com/c/YjWKQe6Z/12-update-metadata-component-for-language
On translated pages we are largely failing to translate the metadata,
leading to messy strings where the only translated content is the month
or the word "and" amongst otherwise English sentences.
This change sets the locale to English for the dates, and reverts attempts
to translate other sections of the page, and it marks the components
as being in English. It removes classnames that aren't used from the CSS
and forces the text direction to be left-to-right for these components.
This marks the page up more semantically, and supports a better experience
for screenreader users as they can now context switch the language
appropriately.
Relevant urls:
https://www.gov.uk/government/news/death-of-former-prime-minister-lady-thatcher.ar
https://www.gov.uk/government/news/death-of-former-prime-minister-lady-thatcher.es
https://www.gov.uk/government/news/death-of-former-prime-minister-lady-thatcher.ur
https://www.gov.uk/government/news/ambassador-hobbs-inaugurates-social-projects-in-the-department-of-san-pedro.es-419
Screenshots
Before
After