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

Add RTL support #88

Open
yarons opened this issue Jan 23, 2024 · 2 comments
Open

Add RTL support #88

yarons opened this issue Jan 23, 2024 · 2 comments
Labels
enhancement New feature or request

Comments

@yarons
Copy link

yarons commented Jan 23, 2024

Some projects using this library have been translated into RTL languages like Arabic, Urdu, and Hebrew.

The menus should support aligning to the right instead of the left to make the user interface more suitable for RTL users.

Example of a menu:
תמונה

@IngoMeyer441
Copy link
Owner

Thanks for your request. I am not familiar with RTL languages (my mother tongue is German). Is this "only" an aligning problem, or is it also necessary to mirror the menu items (the underlying Python strings) before they are displayed?

@IngoMeyer441 IngoMeyer441 added the enhancement New feature or request label Jan 24, 2024
@yarons
Copy link
Author

yarons commented Jan 24, 2024

Great question, thank you :)

Well, in the Archinstall script, for example, you would see something like:

Select timezone UTC

The title is aligned to the left according to the beginning of the line in English.
In Hebrew, I would expect to see it the other way around:

בחירת אזור זמן UTC

Regarding the order of the letters internally, that's another problem; Hebrew strings are sorted in arrays the same way English or Latin strings would; the difference is the "directionality" of the individual character, which is usually handled by the display that renders those (Pango\HarfBuzz\etc.)
This problem was already solved by a competent and efficient library called FriBiDi, and it has an excellent Python implementation called pyfribidi; the main advantage is that this library makes all the complicated decisions for you so if you're unsure if this string is in English/Hebrew it will handle every character individually so the English text won't be reversed and vice versa.

Some terminal emulators support RTL natively, so the main problem is usually the Linux kernel terminal. There is an open proposal to implement RTL as a first-class citizen in the Linux kernel terminal, but I haven't seen any intentions to follow it over the past couple of years.

Herzlichen Dank!

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
enhancement New feature or request
Projects
None yet
Development

No branches or pull requests

2 participants