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

Force English for metadata #1416

Merged
merged 1 commit into from
Jul 18, 2019
Merged

Force English for metadata #1416

merged 1 commit into from
Jul 18, 2019

Conversation

maxgds
Copy link
Contributor

@maxgds maxgds commented Jul 16, 2019

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

Screen Shot 2019-07-16 at 13 37 59
Screen Shot 2019-07-16 at 13 38 08
Screen Shot 2019-07-16 at 13 38 15

After

Screen Shot 2019-07-16 at 13 37 28
Screen Shot 2019-07-16 at 13 37 35
Screen Shot 2019-07-16 at 13 37 48

@bevanloon bevanloon temporarily deployed to government-frontend-pr-1416 July 16, 2019 12:39 Inactive
@maxgds maxgds force-pushed the published-english branch from c2aaab7 to 8a18980 Compare July 17, 2019 07:33
@bevanloon bevanloon temporarily deployed to government-frontend-pr-1416 July 17, 2019 07:33 Inactive
@maxgds maxgds force-pushed the published-english branch from 8a18980 to 5961d81 Compare July 17, 2019 07:50
@bevanloon bevanloon temporarily deployed to government-frontend-pr-1416 July 17, 2019 07:51 Inactive
<% if link_to_history && history.empty? %>
&mdash; <a href="#history"><%= t('components.published_dates.see_all_updates') %></a>
&mdash; <a href="#history">see all updates</a>
Copy link
Contributor

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="&#45;&nbsp;<%= t('components.published_dates.hide_all_updates') %>">&#43;&nbsp;<%= t('components.published_dates.show_all_updates')
%></a>
data-toggled-text="&#45;&nbsp;hide all updates">&#43;&nbsp;show all updates</a>
Copy link
Contributor

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.
@maxgds maxgds merged commit bfa781d into master Jul 18, 2019
@maxgds maxgds deleted the published-english branch July 18, 2019 10:20
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

Successfully merging this pull request may close these issues.

3 participants