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

Set dir="auto" on all user-generated-content #3428

Open
gravitystorm opened this issue Jan 19, 2022 · 0 comments · May be fixed by #3429
Open

Set dir="auto" on all user-generated-content #3428

gravitystorm opened this issue Jan 19, 2022 · 0 comments · May be fixed by #3429
Labels
i18n Internationalisation - related to translation into different languages

Comments

@gravitystorm
Copy link
Collaborator

gravitystorm commented Jan 19, 2022

I think we have a reasonably complex scenario, since we have lots of "mixed-direction" situations - where someone has the site set to a language in one direction (e.g. RTL) but is viewing content in another direction (e.g. LTR). This makes it different to many websites which are usually either one or the other, and so extra care is needed.

"Mixed-direction"? For example, an Arabic speaker looking at map notes, or a French speaker viewing a Hebrew diary entry, or many other things like this. It's particularly hard for RTL users since much of the website user-generated-content (e.g. tag values) are in LTR text, and we currently set the whole page to be treated as RTL which then messes things up:

Screenshot from 2022-01-19 16-26-27

Note how the placement of the punctuation is scrambled. The logic used by browsers is to work through the text, and if it's recognisably LTR characters it will keep them in the right order, but placing each chunk right-to-left. So it places following characters (e.g. punctuation) "after" the text, which makes it look garbled.
bitmap

The first way that we can fix this is by putting dir=auto around any user-generated-content. We don't need to know or store language used for the UGC, since browsers will auto-detect based on the first indicative character found. Note that this means it happens element-by-element, so e.g. a diary entry with a paragraph in Arabic and another in English (or a blockquote, etc) will then work fine since the browser will auto-detect each individually. Setting dir=auto in this case gets us:

Screenshot from 2022-01-19 16-31-53

That's already better. The text-alignment is still incorrect, but that'll be dealt with in a different issue.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
i18n Internationalisation - related to translation into different languages
Projects
None yet
Development

Successfully merging a pull request may close this issue.

1 participant