Free Lessons
Courses
Seminars
TechHelp
Fast Tips
Templates
Topic Index
Forum
ABCD
 
Home   Courses   TechHelp   Forums   Help   Contact   Merch   Join   Order   Logon  
 
Back to Access Developer Forum    Comments List
Upload Images   @Reply   Bookmark    Link   Email   Next Unseen 
Translation Google Translate
Brad Wile 
      
2 months ago
I was trying to get Google Translate to translate field data.

The function i added as a module sure seems close.  Can anyone expand on it..?

If you put us it like:  The "en" from English to "es" Spanish.
TranslateText([Field Data to Translate],"en","es")

It is sending back the same text that I sent out.....

****************************
DetailsFunction TranslateText(strText As String, strFrom As String, strTo As String) As String
    
    Dim http As Object
    Dim url As String
    Dim result As String

    url = "https://translate.googleapis.com/translate_a/single?client=gtx&sl=" & _
           strFrom & "&tl=" & strTo & "&dt=t&q=" & Replace(strText, " ", "%20")

    Set http = CreateObject("MSXML2.XMLHTTP")
    http.Open "GET", url, False
    http.send

    result = http.responseText
    result = Split(result, Chr(34))(3)

    TranslateText = result
    
End Function

*****************************
Brad Wile OP  @Reply  
      
2 months ago
Google Cloud Translate API Support Page
https://docs.cloud.google.com/translate/docs/overview
Alex Hedley  @Reply  
           
2 months ago
If you print/msgbox/status url does it show what you expected?

If you hardcode your values and paste in the url does it work?
Richard Rost  @Reply  
          
2 months ago
That's pretty cool. I haven't played with Google's Translate API yet, honestly, I don't do much translation. And what little that I do, I just use ChatGPT for, which you can plug into your Access database using OpenAI.
Raymond Spornhauer  @Reply  
          
2 months ago
I would like to see a video on how this would be done.  I also struggle with how to use API's.

-Raymond
Thomas Gonder  @Reply  
      
2 months ago
If you put in Fred Flintstone, would it come back Pablo Picapiedra?
Brad Wile OP  @Reply  
      
2 months ago
Alex It only returns the same text in English.  I have tried to convert it to "es" Spanish, "fr" French, and "gr" German.  All it ever returns is English.
Richard Rost  @Reply  
          
2 months ago
The main issue is that you're not properly URL-encoding the text you're sending to Google. Replacing spaces with %20 isn't enough. If the string contains punctuation or special characters, Google may just return the original text. You also have to deal with & / " and a bunch of other characters.

This thread is now CLOSED. If you wish to comment, start a NEW discussion in Access Developer Forum.
 

Next Unseen

 
New Feature: Comment Live View
 
 

The following is a paid advertisement
Computer Learning Zone is not responsible for any content shown or offers made by these ads.
 

Learn
 
Access - index
Excel - index
Word - index
Windows - index
PowerPoint - index
Photoshop - index
Visual Basic - index
ASP - index
Seminars
More...
Customers
 
Login
My Account
My Courses
Lost Password
Memberships
Student Databases
Change Email
Info
 
Latest News
New Releases
User Forums
Topic Glossary
Tips & Tricks
Search The Site
Code Vault
Collapse Menus
Help
 
Customer Support
Web Site Tour
FAQs
TechHelp
Consulting Services
About
 
Background
Testimonials
Jobs
Affiliate Program
Richard Rost
Free Lessons
Mailing List
PCResale.NET
Order
 
Video Tutorials
Handbooks
Memberships
Learning Connection
Idiot's Guide to Excel
Volume Discounts
Payment Info
Shipping
Terms of Sale
Contact
 
Contact Info
Support Policy
Mailing Address
Phone Number
Fax Number
Course Survey
Email Richard
[email protected]
Blog RSS Feed    YouTube Channel

LinkedIn
Copyright 2026 by Computer Learning Zone, Amicron, and Richard Rost. All Rights Reserved. Current Time: 5/8/2026 9:11:39 AM. PLT: 1s