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

GoogleTranslate2 produces invalid result #5

Open
Nuklon opened this issue Jun 27, 2023 · 1 comment
Open

GoogleTranslate2 produces invalid result #5

Nuklon opened this issue Jun 27, 2023 · 1 comment

Comments

@Nuklon
Copy link

Nuklon commented Jun 27, 2023

GoogleTranslator2 t = new();
string text = "[ZZ_123456_ZZ]";
var r = t.TranslateAsync(text, "tg", "en").GetAwaiter().GetResult();
Console.WriteLine(r.Translation);

This results in: [ZZ_1233456_ZZ] (2x 33). With GoogleTranslator "v1" this works OK.

@d4n3436
Copy link
Owner

d4n3436 commented Jun 27, 2023

This is a known issue of GoogleTranslate2 and the JSON RPC API. There's a HTTP header generated by an algorithm (X-Goog-BatchExecute-Bgr) that Google sends with the HTTP request on their website. Without the correct header value the translation will have a lower quality. GoogleTranslator doesn't have this problem because it uses another endpoint.

You should use GoogleTranslator until someone manages to reverse-engineer the algorithm.

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

2 participants