Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Problem in using google translate in rtl language #1056

Open
MohammadrezaTazian opened this issue Aug 29, 2018 · 10 comments
Open

Problem in using google translate in rtl language #1056

MohammadrezaTazian opened this issue Aug 29, 2018 · 10 comments

Comments

@MohammadrezaTazian
Copy link

Hi
When google translates a word to rtl language, it is shown like picture:
oie_uqjg6dyemoah

@darnn
Copy link

darnn commented Aug 29, 2018

Wait, how are you using Google Translate at all? How have you added it?

@MohammadrezaTazian
Copy link
Author

MohammadrezaTazian commented Aug 29, 2018

I am using translate-shell. I act like following link:
https://stackoverflow.com/questions/49972190/how-to-simply-implement-online-dictionaries-for-goldendict/

Of cource insted of fr(france)language,I am using fa(persian) language that is a rtl language.

@darnn
Copy link

darnn commented Aug 29, 2018

Ahh... I assume you wouldn't know of an easy way to implement this in Windows, right?

@MohammadrezaTazian
Copy link
Author

I use linux (ubuntu).

@ghost
Copy link

ghost commented Sep 6, 2018

Did you sew this Python script for GoldenDict?

@darnn
Copy link

darnn commented Sep 7, 2018

Not to derail this thread worse than I already did, but I installed that Python script per the instructions on the page, and I get this error in Goldendict:
Query error: The program has returned exit code 1. Traceback (most recent call last): File "D:\gt\googletranslate.py", line 43, in gtrans() File "D:\gt\googletranslate.py", line 37, in gtrans print(result.encode('gbk', 'ignore').decode('gbk')) File "D:\Python\Python37-32\lib\encodings\cp1255.py", line 19, in encode return codecs.charmap_encode(input,self.errors,encoding_table)[0] UnicodeEncodeError: 'charmap' codec can't encode characters in position 33-34: character maps to

@devshashtag
Copy link

devshashtag commented May 3, 2020

hi you can use this command for translate english texts to fars/persian texts :
trans -e google -s en -t fa -show-original n -show-original-phonetics n -show-translation y -no-ansi -show-translation-phonetics n -show-prompt-message n -show-languages n -show-original-dictionary n -show-dictionary n -show-alternatives n "%GDWORD%" -no-bidi

Image of Yaktocat
Image of Yaktocat

@ghost
Copy link

ghost commented May 4, 2020

trans -e google -s en -t fa -show-original n -show-original-phonetics n -show-translation y -no-ansi -show-translation-phonetics n -show-prompt-message n -show-languages n -show-original-dictionary n -show-dictionary n -show-alternatives n "%GDWORD%" -no-bidi

What is that?

BTW, Take a look on this Google Translate Shell-script (bash+curl+sed):

@devshashtag
Copy link

devshashtag commented May 4, 2020

trans -e google -s en -t fa -show-original n -show-original-phonetics n -show-translation y -no-ansi -show-translation-phonetics n -show-prompt-message n -show-languages n -show-original-dictionary n -show-dictionary n -show-alternatives n "%GDWORD%" -no-bidi

What is that?

its translate-shell program you can use it on goldendict just you need change src and dest lang and use it in goldendict .

BTW, Take a look on this Google Translate Shell-script (bash+curl+sed):

* https://github.com/OPHoperHPO/GT-bash-client
  
  * How to use it in GoldenDict - [OPHoperHPO/GT-bash-client#3](https://github.com/OPHoperHPO/GT-bash-client/issues/3)

in before i write a program like this in 3 line : both program for me and you have same problem
when i try to translate multiple line text .program cant translate multiple lines becase of '.' and other symbol .
translated text
look just one line tranlated...
but with translate-shell we can translate multiple lines like this
translated text
my old program :
its can multiple line translate but not good like translate shell :

#!/usr/bin/env bash

text=$(sed 's/[\W \.]/+/g' <<< "$(xsel -o)"|sed ':a;N;$!ba;s/\n/+\\n+/g')

[[ $(egrep "[A-Za-z]" <<< "$text") ]] && type="fa" || type="en"

translated_text=$(curl -s "http://translate.googleapis.com/translate_a/single?client=gtx&sl=auto&tl=${type}&dt=t&q=${text}"|head -n1|cut -d'"' -f 2|sed 's/\\ n/n/g')

echo "$text > $type > $translated_text"

notify-send -u critical -t 30000 "$(echo -e "$translated_text")"


@ghost
Copy link

ghost commented May 4, 2020

its can multiple line translate but not good like translate shell:

Maybe, @OPHoperHPO could help.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

No branches or pull requests

3 participants