manzyuk / google-translate

Obsolete, see https://github.com/atykhonov/google-translate

Geek Repo:Geek Repo

Github PK Tool:Github PK Tool

Hi, can you add this function?

llcc opened this issue · comments

commented

Dear manzyuk,

I have tried your google-translate package and I think it is really a great tool to use google translate in emacs.

However, I really want to urge you to add a function that can satisfy my need, which is:
I always translate English and Japanese each other, and the results offered are good, but I always need to know the pronunciation of translated Japanese or the selected Japanese words. It will be great if the results can be shown like 漢字(kanji)or others forms.

I knew that google translate supports this function which is pretty useful. So I will be very appreciate that if you can add this function. Is it very hard to accomplish this function?

Thanks very much if you can help me.

Best regards!

Hi @llcc !

Currently I'm maintainer of this package.
manzyuk/google-translate package is obsolete. atykhonov/google-translate is the current one.
Please add to you config file:

(setq google-translate-show-phonetic t)

or

M-x customize-group RET google-translate-core-ui RET

and change the value of google-translate-show-phonetic to Yes.

Let me know please whether everything will work as you expecting.

Thanks!

commented

@atykhonov Thanks for your reply.
I have appended the code into the customizing file, but no lucky happens.

Below is my setting code:

;; google-translate.el
(require 'google-translate)

(global-set-key (kbd "C-x T") 'google-translate-at-point)

(custom-set-variables
  '(google-translate-default-source-language "en")
  '(google-translate-default-target-language "ja"))

(setq google-translate-show-phonetic t)

;; popwin.el
(require 'popwin)

(setq display-buffer-function 'popwin:display-buffer)

(setq popwin:popup-window-position 'bottom)

If there is something wrong, please help me.

Do you use atykhonov/google-translate (manzyuk/google-translate should work in the same way but I'm testing in atykhonov/google-translate just in case) ? If no please checkout it.

In case of the following config:

(require 'google-translate)
(require 'google-translate-default-ui)

(global-set-key "\C-ct" 'google-translate-at-point)
(global-set-key "\C-cT" 'google-translate-query-translate)
(setq google-translate-show-phonetic t)

I perform (cursor at word book):

M-x google-translate-at-point RET English RET Japanese RET

and see the following output:

Translate from English to Japanese:

book

本

Hon

noun
 1. 本
 2. 書籍
 3. ブック
 4. 著書
 5. 書物
 6. 著作
 7. 冊子
 8. 巻
 9. 編
10. 双紙

verb
 1. 申し込む

I see phonetic Hon. Do you see the same?

commented

@atykhonov Thank you very much. The google translation works greatly.

However there is another issue. when i want to know the pronunciation of a Japanese sentence, it works not properly, like below
image

So what is the problem?

@llcc you are welcome :-)

First of all on the screen shot I see the translation from nil to Japanese. If nil then it would detect Japanese language. So you are doing translation from Japanese to Japanese. This is not correct case. Try this with google translate and you'll see. And also please note that google translate doesn't produce a pronunciation for the sentences but only for the single words.

commented

@atykhonov Thank you very much.

I tried the website of google site, and I think if the Read Phonetically function, Google translation can show both the pronunciation of two sides languages even if I chose the sample language as the screenshot shows:

image

I have no idea if it is a though work, but really you helped me a lot, thanks again!

I misunderstood you. Now I see what you meant. I just fixed that issue. Please check out and try again. Now it should show pronunciation.

Also, could you please explain how did you get that nil appeared in the Translate from nil to Japanese? Is that relates to the manzyuk/google-translate or atykhonov/google-translate?

commented

@atykhonov I have no idea what causes it. I just insert the code you gave me, and press C-c t, it gave me the results directly.

Then I reinstalled it and it works greatly. But the nil problem is still there.

I installed the google-translate from elpa and I think it is atykhonov/google-translate.

Thanks!!

commented

I do not know anything about the api of google tranlate. But I wonder:
The google translate website can support audio reading, can it be accomplished in emacs?

Please, if you can, file the issue about that to the atykhonov/google-translate repository. I'll investigate it and will see whether it is possible to implement that feature.

I installed the google-translate from elpa and I think it is atykhonov/google-translate.

Yes, this is atykhonov/google-translate.

I have no idea what causes it. I just insert the code you gave me, and press C-c t, it gave me the results directly.

Yes, I have no idea also. Trying to reproduce but without luck for now. Could you help me with that?

You press C-c t and what afterwards? Do you just press RET when you see Translate from:? Could you please to write the command in the following format:

C-c t ru RET en RET

Do you translate the region? And it would be great if you can copy paste the text which you translate.

Thank you!

commented

@atykhonov I just simply press C-c T without any RET, there is no option for me to select the source and target language like Translate from:. I remembered that I have seen the language list before, maybe after I add the code

(custom-set-variables
  '(google-translate-default-source-language "en")
  '(google-translate-default-target-language "ja"))

and I changed the "en" to Nil once in order to try if it can translate from any language to Japanese. I have no idea if it can cause that problem even if I have already re installed it once.

So I can not enter that command C-c t ru RET en RET, maybe you can make it in other way?

In case of:

(custom-set-variables
  '(google-translate-default-source-language nil)
  '(google-translate-default-target-language "ja"))

(global-set-key "\C-cT" 'google-translate-query-translate)

and the following C-c T I get the prompt Translate from: and I need to select source language or I can just hit RET (in that case source language will be auto detected). Then I input the word or sentence and hit RET again and then I get pop up in which I see translation. But I cannot get nil as I see on the screen shot (Translate from nil to Japanese). I cannot find the way for sorry.

Could you please M-x find-library RET google-translate RET and let me know which Version: you see in the headers?

commented

@atykhonov , Here it is:

;;; google-translate.el --- Emacs interface to Google Translate

;; Copyright (C) 2012 Oleksandr Manzyuk <manzyuk@gmail.com>

;; Author: Oleksandr Manzyuk <manzyuk@gmail.com>
;; Maintainer: Andrey Tykhonov <atykhonov@gmail.com>
;; URL: https://github.com/atykhonov/google-translate
;; Version: 0.8.2
;; Keywords: convenience

Ok, this is one of the latest versions. Cannot reproduce with that.

By the way, the latest one is 0.8.3 which includes the fix relates to your issue with phonetic output. You can update to have the functionality which outputs phonetic when you translate for example from Japanese to Japanese.

commented

@atykhonov I updated it to the latest version 0.8.3, the nil issues still exists. phonetic output is great like:
image