soimort / translate-shell

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

`gawk` bug in conflict with `pt-PT`, while only `pt-BR` works, even if with a set translation engine #470

Closed gusbemacbe closed 1 year ago

gusbemacbe commented 1 year ago

Hello!

If you add only one language, it will work:

$ trans -b :pt-BR "File and folder"
Arquivo e pasta

But if you use pt-PT, it will fail with a gawk bug:

$ trans -b :pt-PT "File and folder"
gawk: /dev/fd/63:215: fatal: internal error: file interpret.h, line 254: unexpected parameter type Node_val

With a set translation engine, any language will fail with gawk bug:

$ trans -engine bing :pt-BR "File and folder"
gawk: /dev/fd/63:215: fatal: internal error: file interpret.h, line 254: unexpected parameter type Node_val

$ trans -engine bing :pt-PT "File and folder"
gawk: /dev/fd/63:215: fatal: internal error: file interpret.h, line 254: unexpected parameter type Node_val

References

432

453

Details

Translate Shell       0.9.7-git:a3bba39

platform              Linux
terminal type         xterm-256color
bi-di emulator        konsole
gawk (GNU Awk)        5.2.0
fribidi (GNU FriBidi) 1.0.12
audio player          mpg123
terminal pager        less
web browser           firefox
user locale           en_GB.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]
gusbemacbe commented 1 year ago

I solved with the #463, but I will comment on #432.

moonlightz commented 1 year ago

└─$ trans --version


Translate Shell       0.9.6.12

platform              Linux
terminal type         linux
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           pt_PT.UTF-8 (Portuguese)
home language         pt
source language       auto
target language       pt
translation engine    google
proxy                 [NONE]
user-agent            Mozilla/5.0 (Macintosh; Intel Mac OS X 10_15_4) AppleWebKit/537.36 (KHTML, like Gecko) Chrome/81.0.4044.138 Safari/537.36
ip version            [DEFAULT]
theme                 default
init file             [NONE]

┌──(pi㉿raspberrypi)-[~]
└─$ trans -b :pt-BR "File and folder"
Arquivo e pasta

From what I know, Google Translate ONLY has one Portuguese and that only outputs Portuguese spoken in Brazil. I never seen it outputing Portuguese spoken in Portugal. I already nagging the Google Translate team if I need to wait 200 years for them to add support to Portuguese-Portugal and correct the language list. Bing does have both languages separated but the Portuguese-Portugal has leftovers from Portuguese-Brazil. No idea why they flavour a derived language instead of the NATIVE language. 
This obviously will never work because Google Translate does not have support for pt-PT: 
┌──(pi㉿raspberrypi)-[~]
└─$ trans -b :pt-PT "File and folder"
Arquivo e pasta
------> If it worked, it would output "Ficheiro e pasta".

This also does not work:
┌──(pi㉿raspberrypi)-[~]
└─$ trans -engine bing en:pt-PT "File and folder"
File and folder
[ English -> Português ]

┌──(pi㉿raspberrypi)-[~]
└─$ trans -engine bing en:pt-BR "File and folder"
File and folder
[ English -> Português ]