Layout for RTL users can't be set per user, only at the whole site level

My browser is recognized as Hebrew which is RTL, and therefore the entire UI is laid out RTL, even when I access LTR forums like Vuejs.

This is not the right way to build RTL UI, and it makes it really hard to use the app.

Take for example the screenshot below, and try to read it. You will see it is really hard because all punctuation is placed on the wrong side, and alignment is bad.

The only parts that need to have direction:rtl css property are those that are fully translated.

So for instance the date widget itself should have this property. Indeed, it looks good in RTL since the texts are in Hebrew too.

At the moment I find myself opening dev tools and changing the UI to LTR in order to be able to use it.
RTL for the entire UI should be used only in cases that the entire forum is in RTL language, and not when the browser is recognized as RTL.

1 Like

Discourse only uses the browser’s locale to set the user’s locale if the set locale from accept language header site setting is enabled. When enabled, the locale will be set for anonymous users from their browser’s language header. This setting also sets the locale for users when they first create an account on the site. That locale can be overridden by the user by going to their Preferences / Interface page and selecting the interface language that they want for the site. Once this has been done, the language headers will be ignored - the user’s chosen interface language overrides the browser’s language header.

If you select a RTL locale for a Discourse forum, all content will be displayed with a RTL layout. If you are on a LTR site, it would be best to select a LTR locale on your preferences page. The only exception to this is if the support mixed text direction site setting is enabled. When that setting is enabled, post content will be parsed for its text direction and the appropriate dir attributes will be added to the post content. You can find more details about that setting here: What does the support mixed text direction setting do?.

5 Likes

My point is that this creates a broken experience for the user.
You can’t just put RTL on anything you want since it breaks the layout. You should only put RTL on translated texts.

So it’s ok that the “set locale from accept language header” picks my locale, but it doesn’t mean you can put rtl on the entire html.

The locale should affect menus and other translated content, and all user content should remain in its original direction.

This is a bug for 2 reasons:

  1. It doesn’t make sense that all RTL users that visit some forum should change their settings. The forum should be displayed correctly out of the box.

  2. Changing the settings will fix the direction but it will also change the language of translated texts such as menus, dates, etc which is not what I want.

I know that for native English users (and other LTR languages) it is hard to see this because you can’t make much sense of Hebrew or Arabic UI, but please trust me that this is simply wrong behavior - user content and all non-translated content should remain with it’s original locale.

1 Like

Does the “support mixed text direction” site setting described above not accomplish this?

2 Likes

This is a legitimate concern for RTL locales. As has been mentioned in this topic, enabling the support mixed text direction will fix the issue, but that setting needs to be enabled by a site admin and will affect all users on the site. Possibly a setting could be added to give the option to only apply the setting for users whose chosen locale has a different direction than the site’s default locale.

2 Likes

I didn’t see how mixed-content looks, but from your description it should do the trick.
I think it should be the default setting, and I wonder why would anyone ever want to turn it off? Shouldn’t a post look exactly as its author wrote it? Does it have any other side effect?

I’ve opened this bug as a member in a few forums, not as a forum owner.

It would be awkward if I would have to ask all those forum admins to change a setting that would fix the experience for users like me. I think they expect the forum to look good for all of their users out of the box.

When the setting is enabled, text is parsed in the browser to find its direction. This will have some effect on the site’s performance. It would be good to be able to only enable the setting for users who need it. The setting was designed to help RTL sites that have a lot of code in their posts. For that case, it makes sense for it to be enabled for all users.

I think that for the case of a user’s locale having a different direction than the site’s default locale, it could make sense to automatically parse post content for its text direction.

3 Likes

Maybe that’s a good approach.
Anyway, I’m just placing it here as a frustrated customer of your customers. I hope that you fix it because you seem to be very successful which means I’m experiencing this more and more :slight_smile:

I have re-categorized this to #ux, but I’ve also assigned it to myself to take a closer look at how to best deal with this issue. I’ll report back here with what I find.

This is how it should be handled. Contact your site admin @danbars.

1 Like

What I’m wondering about is if it makes sense for a site to have to enable that setting when they have no RTL content on the site. For that case, would it make sense to enable the setting automatically on a per user basis when a user’s locale has a different direction than the site’s default locale. For example, if I select the Hebrew locale on Meta, all text content is alligned in the wrong direction.