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

Add ability to change API params value #10

Open
wants to merge 1 commit into
base: master
Choose a base branch
from

Conversation

jstoxrocky
Copy link

@jstoxrocky jstoxrocky commented May 29, 2023

Hey man, I've been following your repos for a while they are genuinely impressive. Great work!

Recently, I've been working with translating Japanese text to English using your library. While it's been immensely useful, I felt the translation results were slightly off compared to when I translate pages directly in the browser.

Intrigued by this, I did a bit of digging and found a disparity in the 'client' parameter value in the request made to Google. Specifically, I noticed that my browser was passing { "client": "te_lib" } while your library passes { "client": "t" }.

I did some experimentation and swapped these values around. From my testing, it seems like "te_lib" gives more accurate results for my use case. Have you come across anything like this before with this parameter? It's possible that the current value might be a little outdated? I put together this PR to allow for customization of this param. Let me know if you think a different approach would be better. (Maybe this PR could even close out this lingering issue).

Looking forward to your thoughts. Cheers!

Japanese Source (Browser)
Screen Shot 2023-05-29 at 3 20 29 PM

English Translation (Browser)
Screen Shot 2023-05-29 at 3 13 44 PM

English Translation (client set to "t" (default))
Screen Shot 2023-05-29 at 3 21 24 PM

English Translation (client set to "te_lib")
Screen Shot 2023-05-29 at 3 21 45 PM

URL for reference: https://www.athome.co.jp/kodate/6978282056/?DOWN=1&BKLISTID=001LPC&sref=list_simple

@jstoxrocky
Copy link
Author

@ultrafunkamsterdam What do you think of the above? ^

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

Successfully merging this pull request may close these issues.

1 participant