fujiapple852 / trippy

A network diagnostic tool
https://trippy.cli.rs
Apache License 2.0
3.8k stars 82 forks source link

feat(tui): add Arabic (`ar`) locale #1344

Open fujiapple852 opened 1 month ago

c-git commented 3 weeks ago

Thanks @tsallabi you got it. That's perfect thanks.

c-git commented 3 weeks ago

Thank you @tsallabi will go over it soon and get back to you, really appreciate the help.

tsallabi commented 3 weeks ago

You are welcome There some of them are abbreviation like ttrI had to write full sentences 

Yahoo Mail: Search, organise, conquer

c-git commented 3 weeks ago

The space where the abbreviation has to go may not fit the full sentence. Do you think people would understand if we just use the English abbreviation?

tsallabi commented 3 weeks ago

Yes if they work in this filed they should understand it as it will come into sentences 

Yahoo Mail: Search, organise, conquer

On Fri, 8 Nov 2024 at 20:34, @.***> wrote:

The space where the abbreviation has to go may not fit the full sentence. Do you think people would understand if we just use the English abbreviation?

— Reply to this email directly, view it on GitHub, or unsubscribe. You are receiving this because you were mentioned.Message ID: @.***>

fujiapple852 commented 2 weeks ago

@tsallabi @c-git I agree that we should stick to the English abbreviations for technical terms, as we've done with the other languages. I'll close the related threads.

fujiapple852 commented 2 weeks ago

@tsallabi thanks for your contribution!

I've left a couple of questions on the open threads above.

Here is is how currently looks:

Screenshot 2024-11-15 at 6 39 48 PM Screenshot 2024-11-15 at 6 39 35 PM Screenshot 2024-11-15 at 6 39 21 PM Screenshot 2024-11-15 at 6 39 13 PM
tsallabi commented 2 weeks ago

It looks like it doesn't support Arabic language 

It should strat from right to left But in the screenshots below it start from left to right So it is wrong 

Yahoo Mail: Search, organise, conquer

On Fri, 15 Nov 2024 at 10:41, @.***> wrote:

@tsallabi thanks for your contribution!

I've left a couple of questions on the open threads above.

Here is is how currently looks: Screenshot.2024-11-15.at.6.39.48.PM.png (view on web)Screenshot.2024-11-15.at.6.39.35.PM.png (view on web)Screenshot.2024-11-15.at.6.39.21.PM.png (view on web)Screenshot.2024-11-15.at.6.39.13.PM.png (view on web) — Reply to this email directly, view it on GitHub, or unsubscribe. You are receiving this because you were mentioned.Message ID: @.***>

fujiapple852 commented 1 week ago

@tsallabi you are correct. After some research it seems the terminal I am using (iTerm2 on macOS) does not support RTL/BiDi for languages such as ar. Worse, even for terminals which do support this (such as the Terminal that comes with macOS), the rendering is still wrong for complex TUI layouts as it attempts to reorder everything on the line.

Instead, I've taken the approach of reordering the translated text (using a library which supports the Unicode Bidirectional Algorithm) in the application prior to rendering.

Below are revised screenshots for ar:

Screenshot 2024-11-16 at 4 35 04 PM Screenshot 2024-11-16 at 4 35 13 PM Screenshot 2024-11-16 at 4 35 25 PM

These do not match exactly with the desired ar translations (i'm not sure why) and there is clearly an issue for mixed text (note the inverted [ and ]). There will also be an issue for terminals which do try to reorder BiDi/RTL text as it would be reordered twice in effect (this may be fixable).

My question to you is therefore, is the updated rendering better than before and is it right (or at least "good enough")? If not, then it may not be possible to add translations for RTL languages at the moment.