This article describes an easy way to translate text in K2 Smartforms using one of the most common translation toolkits – Google Cloud Translate API. This does not mean that this solution is limited to this particular API. You can use any API just by modifying a very simple JS script (download).
Below is the video of how this script works in K2 Smartforms
For convenience, at the end of the article there is a link to download the archive, which consists of a K2 package with an already integrated script and a separate script file. All you need to do is add your API KEY from the Google Cloud Translate API to the parameter of one of the View – BlogPost.ItemView, namely pGoogleCloudTranslationAPIKey. By default, the source and target language options are set to en (English) and es (Spanish), respectively. The languages can be changed in the parameters or simply by setting the parameter values in the URL. The language codes must be from the list supported by this API.
For testing, you can run the form – BlogPost.Form.
As a result, we get an empty form
You need to enter any text in Title or Text and click outside this field. This event will trigger the script launch rule and the text will be translated in parallel control.
Thank you for attention.
For more detailed information please contact – info@neentech.com