-
Notifications
You must be signed in to change notification settings - Fork 20
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
Brexit countdown language and direction fix #1790
Merged
Merged
Conversation
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
maxgds
reviewed
Nov 23, 2020
app/views/govuk_publishing_components/components/_transition_countdown.html.erb
Outdated
Show resolved
Hide resolved
injms
force-pushed
the
countdown-dir-lang-fix
branch
from
November 23, 2020 16:31
ac55c25
to
74acd61
Compare
injms
force-pushed
the
countdown-dir-lang-fix
branch
from
November 23, 2020 16:32
74acd61
to
cd1b673
Compare
The countdown has the page's language whether or not there was a translation available - there is now a check in place to make sure that there is a translation available to see whether a `lang` attribute is needed. The countdown was inheriting a page's right-to-left direction, which would make the countdown display the numbers in the wrong order - so 39 became 93. The `dir` attribute that controls the text direction has been set to `ltr` to avoid this problem. The translation helpers were previously being used by the related navigation component - they've now been moved to the shared helpers and tests have been added to ensure that they work as expected.
injms
force-pushed
the
countdown-dir-lang-fix
branch
from
November 23, 2020 16:56
cd1b673
to
1fc445c
Compare
brucebolt
approved these changes
Nov 23, 2020
injms
force-pushed
the
countdown-dir-lang-fix
branch
from
November 23, 2020 17:26
1fc445c
to
c7ca70c
Compare
Merged
injms
added a commit
that referenced
this pull request
Nov 23, 2020
Includes: - Fix Brexit countdown in the contextual sidebar to use appropriate lang and text direction #1790
injms
added a commit
that referenced
this pull request
Nov 23, 2020
Includes: - Fix Brexit countdown in the contextual sidebar to use appropriate lang and text direction (#1790)
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Add this suggestion to a batch that can be applied as a single commit.
This suggestion is invalid because no changes were made to the code.
Suggestions cannot be applied while the pull request is closed.
Suggestions cannot be applied while viewing a subset of changes.
Only one suggestion per line can be applied in a batch.
Add this suggestion to a batch that can be applied as a single commit.
Applying suggestions on deleted lines is not supported.
You must change the existing code in this line in order to create a valid suggestion.
Outdated suggestions cannot be applied.
This suggestion has been applied or marked resolved.
Suggestions cannot be applied from pending reviews.
Suggestions cannot be applied on multi-line comments.
Suggestions cannot be applied while the pull request is queued to merge.
Suggestion cannot be applied right now. Please check back later.
What
Update the countdown component to check whether a translation is available before setting the language element; and set the direction to
ltr
.Why
When used on pages that are in right to left lanuages (such as Arabic) and without a translation available, the countdown displayed the number of days left in reverse.
It was also tagged as being in the page's language even when there was no translation available, which led to the countdown displaying English but being tagged as being in another language.
The translation check is done for the "components.related_navigation.transition.title" key only as I think that it's a reasonable assumption that if the title isn't translated then the text won't be either. Ideally there would be a check for both, but for the moment this will ensure that it is fixed. If and when further languages are added then this should be reassessed.
The text direction can be hard-coded to
ltr
because there are currently only two translations available for this text - Welsh and English. Both of these languages are left to right.Visual Changes