atykhonov / google-translate

Emacs interface to Google Translate
370 stars 48 forks source link

Add "hl" parameter by current-iso639-language (if nil, "en") #64

Closed OGAWAHirofumi closed 4 years ago

OGAWAHirofumi commented 7 years ago

Now translate_s/single has "hl" parameter. It looks like set from browser's Accept-Language setting.

This try to set it by emacs's current-iso639-language, however I'm not sure whether improving translation or not.

patch file

stardiviner commented 4 years ago

I suggest a simpler workaround.

@@ -189,6 +194,7 @@ translate TEXT from SOURCE-LANGUAGE to T
     `(("client" . "t")
       ("ie"     . "UTF-8")
       ("oe"     . "UTF-8")
+      ("hl"     . ,(if current-iso639-language (symbol-name current-iso639-language) "en"))
       ("sl"     . ,source-language)
       ("tl"     . ,target-language)
       ("q"      . ,text)

WDYT?

stardiviner commented 4 years ago

And PR welcome.

stardiviner commented 4 years ago

I checked the variable current-iso639-language on my machine, it is "en". What's the value on your machine?

OGAWAHirofumi commented 4 years ago

I'm setting japanese environment, so current-iso639-language is "ja" for me.

stardiviner commented 4 years ago

I see, Do you agree with my upper patch? if ok, I'm going to fix it. WDYT?

OGAWAHirofumi commented 4 years ago

Yes, I'm ok with your patch. Thanks