Automatically add direction (dir) attribute to header and userstuff divs on news posts in right-to-left (rtl) languages

Description

  1. Log in as an admin

  2. Admin Posts > Post AO3 News

  3. Fill in a title and content using a right-to-left language

  4. Select appropriate language from the "Choose a language" menu

  5. Press "Post"

What happens

If you haven't added dir="rtl" to all of your HTML – which is terribly annoying – the text won't flow from right to left.

What should happen

For RTL languages, the header div that contains the title and the userstuff div that contains the post content should have dir="rtl" added to them, like we do with FAQs in RTL languages.

Activity

Show:
Sarken
January 29, 2020, 8:32 AM

captured_in_lspace 34 minutes ago
That doesn't seem to work?
Tried with both Arabic and Hebrew and everything stays from left to right, unless we add the "dir" tags ourselves.
https://test.archiveofourown.org/admin_posts/4

It looks like the problem is the rtl? method relies on the locale as set by the FAQ code, but admin posts don’t set a locale – they just have a language.

Alix R
January 29, 2020, 10:56 AM

Ah, that’s a bit annoying. I’ve been looking into the code for a while, and don’t exactly understand how to get the post’s language?

Sarken
January 29, 2020, 9:18 PM

Each admin post belongs to a language, so admin_post.language should do it. If you wanted the short name (e.g. en for English) specifically, that would be admin_post.language.short

 

Sarken
February 2, 2020, 6:42 AM

The posts in Hebrew and Arabic have the proper dir="rtl" attributes on them now!

Sarken
February 4, 2020, 8:55 PM

captured_in_lspace 7 hours ago
\o/
It seems to be working well now! I have 2 remarks:

  1. There's a problem when we add header images, or maybe just images in general: https://test.archiveofourown.org/admin_posts/6

  2. Can you also fix the blockquotes issue? I thought it would be easier to add it now but it's up to you <3

sarken < 1 minute ago

  1. I'm looking at the HTML for the post and I think the problem is the image was in the same paragraph as the text rather than its own paragraph. (If it were a LTR language instead, it would do the same thing, just on the right of the text.) I fixed that and it looks as expected.

  2. That will probably be in one of the next few releases; we don't want to add more issues to this one -- we're just about ready to deploy.

 

DeployedToBeta

Assignee

Alix R

Reporter

Sarken

Roadmap

Admin
Internationalization

Priority

Medium

Affects versions

Fix versions

Components

BackEnd
FrontEnd

Difficulty

Medium

Required Access Level

Admin

Milestone

Internal 0.9
Configure