soimort / translate-shell

:speech_balloon: Command-line translator using Google Translate, Bing Translator, Yandex.Translate, etc.
https://www.soimort.org/translate-shell
The Unlicense
7k stars 392 forks source link

Stuck at getting output for RTL languages #502

Closed Nefcanto closed 1 year ago

Nefcanto commented 1 year ago

Hello

I installed trans using sudo apt install translate-shell. I'm using Ubuntu 22.04 and I use bash.

Then I installed fribidi-bin and fribidi-dev as your link to FriBidi does not show us what should we do.

Then I used trans :ar -brief "How are you" and I got the characters in reverse.

This is my trans -V:

Translate Shell       0.9.7.1-release

platform              Linux
terminal type         xterm-256color
bi-di emulator        [N/A]
gawk (GNU Awk)        5.1.0
fribidi (GNU FriBidi) 1.0.8
audio player          [NOT INSTALLED]
terminal pager        less
web browser           xdg-open
user locale           en_US.UTF-8 (English)
host language         en
source language       auto
target language       en
translation engine    auto
proxy                 [NONE]
user-agent            Mozilla/5.0 (Windows NT 10.0; Win64; x64) AppleWebKit/537.36 (KHTML, like Gecko) Chrome/104.0.0.0 Safari/537.36 Edg/104.0.1293.54
ip version            [DEFAULT]
theme                 default
init file             [NONE]

Report bugs to:       https://github.com/soimort/translate-shell/issues

It seems that bi-di emulator is empty. How should I install it?

soimort commented 1 year ago

Most likely you already have FriBidi installed.

Currently there is an inconsistency in supporting various terminal emulators, and if the emulator does bi-directional transform itself, but trans doesn't recognize this (especially in the case of those emulators depending on GTK3's VTE), the text will be reversed twice (by trans once and by the term emulator again), hence the inverse output.

For now if your emulator already does support BiDi transformation itself, you can add option -no-bidi to prevent trans from reversing the text, then you'll get the right output.

Nefcanto commented 1 year ago

@soimort yes that helped. -no-bidi worked. Thank you so much.