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

Right-to-left (RTL) language support #252

Open
querkmachine opened this issue Jun 9, 2022 · 4 comments
Open

Right-to-left (RTL) language support #252

querkmachine opened this issue Jun 9, 2022 · 4 comments

Comments

@querkmachine
Copy link
Member

querkmachine commented Jun 9, 2022

What

Add support for right-to-left (RTL) languages to GOV.UK Frontend components.

Why

A number of pages on GOV.UK are made available in RTL languages, however they tend to insert RTL content into the same layout used by left-to-right (LTR) languages instead of mirroring the entire interface, as is typical for RTL languages. For example, in RTL languages a right-pointing arrow indicates moving backwards, whereas a left-pointing arrow indicates progress.

RTL languages are currently in use in various areas of GOV.UK. (Google search results are for a rough indication of how widely used each language is.)

GOV.UK's lack of RTL support produces unexpected layouts in situation where RTL languages are already in use (though many of these instances are with publishing components and not Frontend):

There are some situations where RTL language content has only been made available in PDF format, potentially due to restrictions with creating this content in HTML, which creates an accessibility barrier for end users. For example, detention rights are available in English as a HTML page but must be downloaded as a PDF for Arabic, Farsi and Urdu speakers.

@querkmachine
Copy link
Member Author

In an audit of content published on GOV.UK between March 2019 and February 2020 (not public data, sorry!):

  • Arabic was the 3rd most published language, after English and Welsh.
  • Farsi was 12th, ahead of common western European languages such as Portuguese (14th) and German (18th).
  • Urdu and Hebrew were joint 23rd, ahead of many eastern European languages like Czech and Serbian (joint 27th), and Estonian and Hungarian (joint 31st).
  • Dari ranked 37th, tied with Irish and several northern European languages like Swedish, Norwegian, Icelandic, Finnish and Danish.

@paulmsmith
Copy link

paulmsmith commented Jun 28, 2022

I have been thinking about this recently, the time might be approaching to replace the use of floats for the grid layouts and components on GOV.UK.

No doubt this has been discussed already in GDS but using CSS Grid or Flexbox would make this much easier to do and maintain.

Some of the most troublesome parts of handling RTL layouts are starting to go away (as browsers roll out of use). For example, the need to adjust the direction of spacing, such as switching a margin-right to a margin-left, etc can be avoided by using the CSS gap property.

Also "source order" of layout elements is less tricky when using CSS Grid or Flexbox.

I think this is an excellent suggestion and would make GOVUK much more accessible and inclusive. How to achieve this is what will take a lot of thought. I'd be very happy to contribute to any discussions or workshops.

@querkmachine
Copy link
Member Author

Another, possibly complementary, approach would be to embrace the use of Logical Properties and Values, and rewrite our CSS to use logical properties (like start and end) rather than physical ones (left and right).

Although the spec is supported by current versions of all the evergreen browsers, the spec is relatively new, a little unstable, and most people haven't even heard of it, let alone feel comfortable using it. There's a bit of a learning curve if we want to take that route.

@paulmsmith
Copy link

Agree I'm looking forward to using logical properties and did some experiments not long ago. I tried using a post-processor to cleverly switch them out whilst generating a fall-back stylesheet for older IEs but I backed out of it slowly because:

  1. It got super complicated fast
  2. I suspected it would introduce an auto-magic box people wouldn't easily be able to debug or trust.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Development

No branches or pull requests

2 participants