Setting input direction in UI

AI-generated summary

The discussion revolves around setting input direction in UI, specifically for RTL (Right-to-Left) languages. mrphs highlights the existing functionality of switching the site’s locale to RTL languages and using HTML to specify direction. However, a key issue remains: handling English words or sentences within RTL text. Two potential solutions are proposed: using a library to detect language direction or allowing users to set direction from the text editing toolbar. The latter option, inspired by Google Docs, would enable users to easily adjust the direction of paragraphs or sentences. sam notes that implementing this feature would require significant changes to the editor, potentially making it “content editable” to support multiple languages within a single text area.

I noticed that there has been multiple long conversations about RTL support and each of them have gone many different directions. All and all have added great functionality of the website in RTL languages.

To do a quick recap:

  • Now you can change the locale of the discourse site to one of the RTL languages and the whole site flips the right direction.

  • If you need ocassional LTR posts, you can use <div dir=ltr>...</div> to make sure it’s showing the right direction. And that’s good. Except there’s one key element missing here.

Because of its dominance and adoption, English words and sentences in middle of any RTL language are almost inevitable.

Now there are two ways to tackle this issue:

  1. Make use of a library to detect language direction
    I understand this option has been discussed extensively and because of its complexity, it’s not a priority for the core team until someone offers a patch.

  2. Let users set the direction from the text editing tool bar
    A good example of that is Google docs. I trust others like WordPress and Wikimedia also have the similar option:


    This way, user can easily select a paragraph or sentence and make sure they’re in the right direction.

This can significantly increase the usability of discourse for bilingual users.

5 « J'aime »

This would require quite radical changes, cause the editor is now a single textarea, it would have to become “content editable” or something else fancy to support 1 para in English and a second in an RTL lang.

3 « J'aime »