Google.Cloud.Translation.V2 - Translate Html
See original GitHub issueEnvironment details
- OS: Windows
- .NET version: 4.5.2
- Package name and version: Google.Cloud.Translation.V2
Steps to reproduce
Large Html snippet to translate
Code GoogleCredential gc = GoogleCredential.FromJson(System.IO.File.ReadAllText(sDrivePath)); TranslationClient tcClient = TranslationClient.Create(gc, TranslationModel.ServiceDefault); TranslationResult result = tcClient.TranslateHtml(sHtml, GetLangCodeCookie(), LanguageCodes.English,TranslationModel.ServiceDefault);
Error
[UriFormatException: Invalid URI: The Uri string is too long.]
System.Uri.CreateThis(String uri, Boolean dontEscape, UriKind uriKind) +6912000
System.Uri..ctor(String uriString) +21
Google.Apis.Requests.RequestBuilder.UriJoin(Uri baseUri, String path) +192
Google.Apis.Requests.RequestBuilder.BuildUri() +279
Google.Apis.Requests.RequestBuilder.CreateRequest() +49
Google.Apis.Requests.ClientServiceRequest`1.CreateRequest(Nullable`1 overrideGZipEnabled) +26
Google.Apis.Requests.<ExecuteUnparsedAsync>d__33.MoveNext() +69
System.Runtime.ExceptionServices.ExceptionDispatchInfo.Throw() +26
Google.Apis.Requests.ClientServiceRequest`1.Execute() +149
Google.Cloud.Translation.V2.TranslationClientImpl.TranslateHtml(IEnumerable`1 htmlItems, String targetLanguage, String sourceLanguage, Nullable`1 model) +150
Related reading would suggest the library code does not switch from GET to POST for large requests: https://stackoverflow.com/questions/9432422/google-translate-v2-cannot-hanlde-large-text-translations-from-c-sharp
Issue Analytics
- State:
- Created 5 years ago
- Comments:16
Top Results From Across the Web
Translating text (Basic)
Translating text (Basic) ... This document describes how to use the Cloud Translation - Basic (v2) to translate text. The input text can...
Read more >Translate - Documentation
With Google Translate, you can dynamically translate text between thousands of language pairs. The Google Cloud Translation API lets websites and programs ...
Read more >Google Cloud Translation API v2 (revision 51)
The Google Cloud Translation API lets websites and programs integrate with Google Translate programmatically. ... This service uses TranslateRequestInitializer to ...
Read more >How to upload an html file for translation
The method TranslateHtml translates html items as a string. Is it possible to upload a file and ... Cloud.Translation.V2.AdvancedTranslationClient.html),.
Read more >Translation by Google Cloud Translate API returns html ...
In my application, I am trying to translate a few Spanish texts to English using the Google Cloud Translation API. I noticed that...
Read more >
Top Related Medium Post
No results found
Top Related StackOverflow Question
No results found
Troubleshoot Live Code
Lightrun enables developers to add logs, metrics and snapshots to live code - no restarts or redeploys required.
Start Free
Top Related Reddit Thread
No results found
Top Related Hackernoon Post
No results found
Top Related Tweet
No results found
Top Related Dev.to Post
No results found
Top Related Hashnode Post
No results found
I’ve pushed Google.Cloud.Translation.V2 version 1.2.0-beta01. Could you give that a try? If all is working, I’ll promote the code to 1.2.0.
No problem.
Using the beta is fine with me.
Thanks again!