dotnet / ResXResourceManager

Manage localization of all ResX-Based resources in one central place.
MIT License
1.33k stars 217 forks source link

Google API gets bad request (400) on English translations #436

Open Jakar510 opened 2 years ago

Jakar510 commented 2 years ago

Describe the bug Any time I try to get English translations (neutral is also English) from Google API, I get a bad request (400).

To Reproduce Create a record, try to translate it.

Expected behavior Either auto-selects the neutral language (English) or sends it to the API for translation, even if it's redundant.

tom-englert commented 2 years ago

Can you provide a PR to fix this? - I don't have a google account, this feature was provided by the community.

Outworldz commented 2 years ago

I have this problem for DEEPL, Azure and Google now. Nothing works any more. Very frustrating as I have used this for several years and it always worked perfectly.

I made a DeepL pro account ( 30 days free) and have an API key. What would be the url? I have tried many variations of https://api-free.deepl.com/v2/translate

tom-englert commented 2 years ago

@Outworldz https://api-free.deepl.com/v2/translate is the url for the free account. To get the url for the pro account see https://www.deepl.com/docs-api

tom-englert commented 2 years ago

I just tried DEEPL and Azure, both working fine...

Outworldz commented 2 years ago

This is still very intermittent even with the latest update. I will document my issues here in case someone else has them.

I am using just one resource file "My Project/Resources" in Visual Basic. This has worked many times before. I have about 1400 translations in 30 different languages already, but often add some more. It is frustratingly intermittent. I realize it must be something to do with my project or my network, so I have tried it at work on a very high end AMD, at a Contabo ISP with Server 2019, and at home with 3 different PC's from I9 to I7 Alienwares, all with similar issues, which seems to indicate it must be my project, somehow. But how?

The project is a Open Source 3D Virtual world at https://github.com/Outworldz/DreamWorld written in VB and C#. It is just like Second Life, though free and easy to use on Windows PC's, with about 5,000 installs and 100K users.

I have valid accounts for DeepL Pro, Google, and Azure. All of them work "sometimes". As in rarely. But they do work on occasion. I try almost every day, and might be able to get a partial translation of new things once a week.

Today I tried my Alienware, Win 10, on hardwired network at home, which is a fast fiber optic. This PC seems to work best. Some PCs have never worked, ever.

Azure has a valid translation key in it, the region is South Central US, and I get a 401 Unauthorized. However, on occasions It works for a few translations then gives me a 401. Today I get nothing but 401s. I tried three different keys and its a paid account. I know these keys are good as I use them to make translations in world using LSL language, and have had as many 140,000 of them working for various users.

Deepl Pro has a valid translation key in it, I tried both https://api.deepl.com/v2/translate and https://api-free.deepl.com/v2/translate is the URL, and today, for the first time in a week, the free one ran immediately, then aborted. I received about 18 translations on 10 of 30 languages before DeepL aborted with "DeepL Response status code does not indicate success: 403 (Forbidden)". It will abort if I run it again, and any restarts, changes to words, or selection of just one word or all words do nothing but cause it to spin for a few seconds and abort. That's a typical day for me for any of the three major engines.

Google always failed on these runs with a 403. I tried this about 5 times while writing this, and I just selected Google again and this 6th time it ran and completed with no errors. Yay! All 30 languages resources are there now, instead of just the 1st 10 resources, and there are the expected 18 translations in each of them.

I have examined the source of the Google module and might be able to debug this if I knew how to run an Extension in Debug mode in Visual Studio.

Any ideas?

Fred

tom-englert commented 2 years ago

@Outworldz for debugging it's easier to just run the standalone (ResXManager.exe)

norton287 commented 2 years ago

I am having the issue today as well when translating English 400 errors on Google, Microsoft, and Deepl Free. Was working fine this morning. Then it started this afternoon, switched to the standalone client and it translated a couple then quit working. I rebooted and even switch computers and am getting the same issue on the other computer. When I check the limited states on Microsoft Translate it shows nothing but errors coming from the client, nothing else.

Outworldz commented 2 years ago

After an update, the Standalone Client works!. It too fails at Google with an error 400 (Bad request). However, it now ignores this (!!) and proceeds to do all the translations!! Yay! W()()T! I have over 34,000 of them so this is a HUGE relief.
Thanks for the tip and this package, @tom-englert !