Description
Jupyter Notebook
Arabic Data Handling
Overview
Mirroring is essential in case the application interface is translated to any language with a Bidirectional script (e.g. Arabic, Hebrew). The Arabic and Hebrew script natural Global Orientation is from right-to-left, hence, the native speakers of these languages expect to see the GUI layout mirrored so that the whole GUI can be read from right-to left as well. This includes viewing menu buttons on the right, the navigation tree on the right, and indentation to the left. GUI mirroring is necessary for any application which has GUIs meant to be translated to a language based on bidi (i.e. Bidirectional) scripts such as Arabic and Hebrew.
High-level Design
Whenever the Arabic or Hebrew translation is loaded, mirroring of the UI will occur, this may depend on web browser setting or UI language setting.
Preferences
No special preference needed for mirroring
Terminology and Acronyms
• LTR: Left to Right
• RTL: Right to Left
• GUI Mirroring: Change the Graphical User Interface directionality from a Left to Right orientation to a Right to Left orientation. (The effect is a horizontal position swapping of the GUI elements)
Mirroring Issues
In this section, we highlight mirroring issues found when enforcing right directionality (RTL) on Jupyter Notebook.
1- Main Page :
Comparing the below two images, it is apparent that mirroring issues with the editor. The following is a list of issues found:
• Header logo should be on the right.
• Tabbed items should be on the right (menu tabs)
• Toolbar items should be swapped
Figure:1 Main Page in RTL Mode
Figure:2 Main Page in LTR Mode
2- Dropdown Menu:
• Menu items should be aligned right.
• Tree-selector buttons should be swapped.
The following images will highlight these issues.
Figure:3 Dropdown Menu in RTL mode
Figure:4 Dropdown Menu in LTR mode
3- Dialogues:
Dialogues had several mirroring issues:
• Close button should be placed on the left.
• Action buttons should be placed on the left.
The following images will highlight these issues.
Figure 5: Dialogues in RTL mode
Figure 6: Dialogues in LTR mode
4- Notebooks:
It has several mirroring issue:
• Code editor: missing parts in the line editor.
• Dropdown menu & sub menus should be on the right.
• Menu bar blocks should be swapped.
The following images will highlight these issues.
Figure 7: Notebook in RTL mode.
Figure 8: Notebook in LTR mode.
Low Level Design
In this section, the detailed design proposed will be explained.
Document Direction
Add an attribute named ‘dir’ with value ‘rtl’ to an element, and all elements underneath will be
rendered right-to-left. For the sake of simplicity, let us assume we put this attribute on the body
element.
Code 1:
by creating a function to check the ui language & change the dir attribute if it's RTL language on the body in a separate script tag inside main.js
CSS Style
The browser doesn’t render right-to-left perfectly, and a lot of the remaining issues can be solved using CSS. For this, we will use “CSS Overriding” mirroring approach to fix the CSS classes. We will use CSS attributes to enforce the change in the CSS attributes.
We will update the CSS files by overriding them with the “dir” attribute and update the properties as
well in the same style sheet that contains the original style (LTR-mode) .
Code 2:
by overriding these styles in:
- tree.less :
- page.less :
Results
The screenshot shows the results of applying the design proposed in this report.