Open asdoost opened 4 years ago
I think it's a very important feature to support. I suppose that RTL languages insert right-to-left mark to change direction. Tabulate needs to insert RTL mark in every cell where RTL text is present, and revert back to LTR to draw table structure.
This is a kind of issue where a speaker of one of the RTL languages can make a valuable contribution, because he or she knows ow the text should look like.
Can you provide a test case for this feature? (An example of the data table to render, and the output, formatted by hand, how it should look like? I suggest you mix RTL and LTR text within the same cells.
I'm using PgCli
and I think this mostly related to your terminal emulator, I can see this happening in Gnome-Terminal
but not in KDE Konsole
. I have not other terminal emulators to check it.
NOTE: stralign="right"
may be the cause of problem, I can't test it!
Left side: Konsole
and the right one is Gnome-Terminal
But for other tablefmt
like psql
this is the same even in Konsole
:
So as I said this must be related to the emulator that how arrange and render character shapes in such a complicated text
...
@astanin Sorry that I am answering with delay.
These are three Persian sentences with the normal order:
گوشی Galaxy A03s برایش خرید
رژیم صهیونیستی را محکوم کردند
نتانیاهو شکست بسیار سختی خورد
You could use this the following and compare the results' order with above sentences:
from tabulate import tabulate
table = [["گوشی", "Galaxy" ,"A03s", "برایش", "خرید"],
["رژیم", "صهیونیستی", "را", "محکوم", "کردند"],
["نتانیاهو", "شکست", "بسیار", "سختی", "خورد"]]
print(tabulate(table, tablefmt="grid"))
I tried tabulate in my code to return a KWIC table, but it doesn't work properly. Even when I use stralign, the result doesn't change much. Here is the line of the code: tabulate(lst, headers=header, stralign="right", tablefmt="fancy_grid") And here is a link to a screenshot of the result: https://pasteboard.co/Ju3KaVk.png The language that I tried is Persian and I tried the code in Linux terminal.