In this post, we will talk about how to translate the given text from FileMaker using Google Translation API. We have achieved this using the Google Translation URL and API key.
Overview:
One of our customers needs to translate the text from “English to Spanish” and “Spanish to English” from FileMaker, if we do this task manually, it will be a time-consuming process and manual errors may occur.
To avoid the above-mentioned issues, we have found a solution to translate the text from FileMaker using Google Translation API. When we call the Google Translation API using the FileMaker Insert From URL function, it will translate the given text and will provide the result in the JSON format. We can then process that JSON data using FileMaker JSON functions and then the translated text can be used in our application as per our need
Steps to translate the text from FileMaker.
Step 1: Create an API key in the Google Cloud Platform website.
- If you have a Gmail account, log in it and go to the Google Developer Console (https://console.developers.google.com/) and create a project.
- Go to Credentials Page.
- Create a new API key using the “Create Credentials” button and Note the API key.
Step 2: Create fields and Scripts in FileMaker.
- To achieve the above task, In FileMaker Database Create two text Fields, one for “Translate Input” and another for “Translate Output”. For example, enter the text that you want to translate in the “Translate Input” field. I have entered the text “The vessel is stopped due to engine oil is overlooked”. Please see the below screenshot.
- Create a Script to translate the text from the FileMaker using Google Translation API. Mentioned the functionality below,
- Initially, we need to set a variable to get the value of the “Translate Input” field.
- Need to set a variable for the following URL
- For English to Spanish
- https://translation.googleapis.com/language/translate/v2key=xxxxxxxxxxxxxxxxxxxxxxxxxxxx&source=en&target=es&q=InputText&format=text
- For Spanish to English
- https://translation.googleapis.com/language/translate/v2key=xxxxxxxxxxxxxxxxxxxxxxxxxxxx&source=es&target=en&q=InputText&format=text
- Add “Insert from URL” step, here in “Specify URL” pass the URL variable.
- Finally, in the “Translate Output” text field, add a step to get the Translated text from the JSON output, like following,
JSONGetElement ( $Result ; “data.translations[0].translatedText” )
- For clear detail, please refer below screenshot
- After executing the above script, the translated text will store it in the Translate Output field, like below
The team at FMDBSolutions hopes this article taught about how to translate the given text content from FileMaker using Google Translation API. FMDBSolutions is a team of well-qualified experts that have a lot of experience with the many versions of FileMaker Pro and the FileMaker Go app too.
Our team knows all about transitioning, migrating, converting, and upgrading for FileMaker. Companies that require FileMaker Integration can also use our services. We have worked with clients from the USA, Australia, and Singapore and will complete your FileMaker assignment in the best possible way at a lower price but the same or higher level of excellence.
If you want solutions to your FileMaker database, we can help. Click the below box for a free FileMaker consultation.
You can also leave us your email below for receiving new updates regarding FileMaker and our company.