bjakja / Kainote

Kainote subtitles editor and player
GNU General Public License v3.0
98 stars 16 forks source link

Add support to RTL in text editor #354

Open animefn opened 3 years ago

animefn commented 3 years ago

Hi there,

I noticed your fork adds a lot of features to Aegisub which is something I really appreciate. Thank you for this!

I was wondering would you be able to add right-to-left support to the text editor? This feature will make life easier for users of Arabic, Farsi, and other RTL languages.

I can try to help if necessary, I have some knowledge in programming in various languages but I never worked on a complicated project like Aegisub, I lack the skills to do it all by myself, so I was wondering if you might consider adding this modification to your future releases...

Thanks in advance!

bjakja commented 3 years ago

Hi, as i thought this will be the problem in my program. RTL should work not only on text field but in entire program. Can you provide some screens from text or other editors how this should look and screen of entire window of Aegisub. I found that wxWidgets have option for RTL, and probably Windows draws every Arabic text in that way.

animefn commented 3 years ago

Hi, thanks for your reply,

"RTL should work not only on text field but in entire program. " why exactly? The UI should still be usable to RTL users once translated even if things are kept aligned on the left, it's the editing box that is so messed up in the current Aegisub version (and Kainote)

The current Aegisub only translates the UI and keeps it aligned to the left, but the RTL writing remains an issue...

Here is a screenshot of the current Aegisub translated to Arabic, nothing special at all, just simple translation of the English strings, the menus and the text editor are aligned to the left.

Aegi-current

While the translation is nice, But It's actually not that useful since as you can see the editor is still aligned to the left. The solution that hundreds of Arabic translators are hoping for is just the following:

Just bringing the text to right with correct direction (so that punctuation is handled correctly) is what is needed

Aegi-current-suggested-fix

(right align is not enough, text-direction has to be set too, otherwise punctuation will remain reversed)

In an ideal world the program at best should look like this (but really I'm not even dreaming or asking for this, just to show for reference):

Aegi-ideal-fix

This is far from what we're hoping for, and honestly its not really necessary to "mirror" the interface for Arabic users, if the editor is fixed we will be more than happy and able to use without crying everytime we edit subtitles.

I know it might be a bit hard to understand the difference if you can't read Arabic... Here is another example to help you understand why correctly setting direction (not only right align) is important: Please look at the editing cursor here, it's on the right, it should be on the left

wrong (ltr) cursor

Here is how it is supposed to appear

correct (rtl) cursor

Possible issues you might want to consider:

Thunderbird: image Here I just selected the second line and switched it to RTL, but my thunderbird usually aligns LTR

So my suggestion If this is ever achieved the Entire all rtl users will be indebted forever to the developers who does it. image

Thanks a lot for taking the time to reply to my request, please let me know if anything is not clear, and please let me know how I could be of help in this, I have recently learned QT and I already did some very basic work in QT, maybe I can be of help...

bjakja commented 3 years ago

Thanks for more explanation. First I have to check if Windows can draw texts from right, cause separate drawing every character is pain in ass. Main problem in Kainote is that text editor is written by me and every i18n things I have to write myself. Option for changing RTL to LTR for your language is not a bad idea. It will take several months to solve this problem but I want to solve it to get more users from abroad. You can download code and see if you understand something from it.

ThePhantom00 commented 3 years ago

still waiting to add this feature👌

bjakja commented 3 years ago

I just working alone with this program and have other things to do, but I made release and can now make more changes in code, that I should start to solve this problem in this month. And it's have the highest priority.

ThePhantom00 commented 3 years ago

Take ur time bro, will wait👌 we all gonna move to ur program

bjakja commented 3 years ago

Looks like after getting conversion from ICU I could made some progress. Take some time to make text field usable I have selecting, copying and switched cursor move.

ThePhantom00 commented 3 years ago

"And better option is turn off it automatically when cursor is placed between { }. After some thinking in brackets it still need writhing from right to work properly." The problem is here and maybe so is the solution cuz when u r in RTL mode, tags in { } will get the same problem like Arabic in LTR and also if i add more { } between words, the whole sentence will be reversed

bjakja commented 3 years ago

It's still a more work with RTL in Kainote but first i mention what's is done. Text field works with RTL from left, can write, copy and spellchecker works. Some characters can break it that's more tests is needed. Text with tags in {} is switched in that way that vsfilter show it properly till tag is placed between linked chars. This need to save converted text. And font's show it in different way, some have right order, some changed, some show nothing or garbage.

animefn commented 2 years ago

Hi there, apologies for not getting back to you in a timely manner.

I checked the latest version. It seems a bit better because the curser puts itself on right in the direction of writing, even though the text itself is still aligned on the left. as you mentioned there are still imperfections, notably putting a "!" or a number like "1, 2 ,3 , etc" will confuse the direction and the punctuation will remain at the end of the sentence.

The selection however (just like in this comment here on another fork ) works fine. When you double click a word, it gets selected correctly, in old versions of Aegisub, you select a work, another one gets selected!

Example: the ! in this video should be in the middle of my text, it is inserted before the 2nd word, yet it remained at the end. https://streamable.com/h7knrl

Thanks a lot for your time and for trying to fix this.

bjakja commented 2 years ago

Hi, thanks for that testing. If I recover from sickness, I will try fix this in future.

evar312ga commented 2 years ago

Hey! I'm a Hebrew fan sub so this mod gonna help me so much! Where can I download it? and thank you soo much~!!