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

RTL languages should have LTR notebooks by default #5921

Closed
Gilthans opened this issue Dec 29, 2020 · 2 comments
Closed

RTL languages should have LTR notebooks by default #5921

Gilthans opened this issue Dec 29, 2020 · 2 comments

Comments

@Gilthans
Copy link

Describe the bug
When the default language is set to an RTL (right-to-left) language (such as hebrew or arabic), the notebook UI is unusable.
Since translation is only partial, english text becomes garbled, and elements that should always be LTR (such as code blocks) are reversed, while others that maybe should be RTL (such as output blocks) are not.

To Reproduce

  1. Go to Chrome's settings.
  2. Go to "Languages".
  3. Set "Hebrew" as the top priority.
  4. Open a new jupyter notebook.

Expected behavior
Either properly support RTL language (a lot of work), or use LTR.

Screenshots
(Taken from this very old ipython issue)
Here's a screenshot - there's nothing useful in Hebrew here, but you get the period on the wrong end of the sentence, and the path is reversed.
image

Again, no useful information in Hebrew, the In [ ] bullets are on the wrong side, and you get RTL only when it's not helpful. If anything, I'd want the word שלום to be right-aligned, but nothing else.
image

Desktop (please complete the following information):

  • OS: Windows
  • Browser: Chrome
  • Version: 87

Additional context
There's a long standing ipython issue about this, ever since this was implemented. Most developers I know ran into this, found that issue, and used one of the workaround. This has always been a terrible default.

Note that the RTL layout is never correct. No user would use it intentionally because it solves no problems and creates several.

The solution is simple:
In notebook/static/bidi/bidi.js, the conditional setting of document.body.dir should be removed.

@m2-farzan
Copy link
Contributor

m2-farzan commented Dec 29, 2020

@Gilthans I think you are using an old version of jupyter notebook. Since jupyter notebook version >= 6.1.0, notebook UI layout is not affected by browser language. For more information check out #5052 (comment).

Note that the tree view (i.e. the first screenshot in your post) is still affected by browser language, but the notebook itself (i.e. the second screenshot) doesn't care about browser language.

P.S. I've just done the repro steps on my notebook installation (version 6.1.5), and here's what I got:

image

P.S. 2

If anything, I'd want the word שלום to be right-aligned, but nothing else.

You can achieve this in version >= 6.1.0. In your LTR notebook, select the cell you want to right-align. Then open the command palette and select toogle current cell ltr/rtl direction.

image

@Gilthans
Copy link
Author

I indeed seem to have 6.0.3 installed...
Thanks for the fix!
I'll send a message in the ipython thread (since this is where google brings you), may be a good idea to close the issue though.

@github-actions github-actions bot locked as resolved and limited conversation to collaborators Jun 28, 2021
Sign up for free to subscribe to this conversation on GitHub. Already have an account? Sign in.
Projects
None yet
Development

No branches or pull requests

2 participants