top of page
Search
info0139422

DeepL Translate API with Azure functions

As a developer, We often encounter exciting challenges, and my recent project was no exception. Our client requested an additional feature in the user panel that allows users to input information in any language. However, the admin panel needed to display this information translated into English. While Google Translate API is a common choice for such tasks, it can sometimes alter the context of sentences, leading to inaccuracies. In contrast, we found that the DeepL Translate API provides more reliable translations.


Another significant challenge we faced was ensuring that our translation process did not delay existing save operations. One potential solution was to translate the text when loading it on the admin side, but this approach could slow down loading times and increase costs due to repeated API calls, as DeepL charges per word.


After evaluating various options, we decided to perform translations when the user submits their information. To implement this efficiently, we utilized Azure Functions with a Queue Trigger for the DeepL API integration. This setup allows us to trigger the function with a payload containing the text to be translated. The function handles the translation and saves the translated text into a SQL database, which we can then use to display the translated content in the admin panel.


This approach not only streamlines our workflow but also optimizes costs by minimizing unnecessary API calls while ensuring timely translations for our users. By leveraging Azure Functions and the DeepL API, we can effectively manage multilingual input while providing accurate translations in our application. Now lets discuss the step by step approach for this task.

 

Step 1 - DeepL API Setup


You need to setup account in deepL and then generate the API keys.

DeepL API is very simple to integrate and its documentation explains it very well even in C#


 

Step 2 - Azure Storage Account Queues


To trigger Azure function, we must have a Azure Storage account where we need to setup a Queue that have a unique URL which is executed by our C# application with payload. so from your actual application you just need to send the payload to the Azure storage Queue


 

Step 3 - Azure function - HTTP Trigger


Our next step is create an azure function app using consumption plan as our translation operation is not that operational heavy and we can bear the delay as its all working in behind the scenes. Please note that you must connect an storage account when to create the function app.


Next you need to create an HTTP Trigger function using Visual studio and implement DeepL Api logic and SQL operation to save translated results into SQL DB and publish the function to azure.

you can now test, check logs, metrics and other parameters in azure to monitor and debug your application.

 

Conclusion:

Azure Functions is an invaluable tool for executing serverless operations, allowing developers to enhance applications without adding extra load. Its independent development environment makes it easy to maintain and update, ensuring minimal disruption to existing systems. As part of the Azure ecosystem, it offers excellent scalability, automatically adjusting resources based on demand.

This feature ensures optimal performance during peak usage times. Additionally, Azure Functions provides robust debugging and monitoring capabilities through tools like Application Insights, enabling real-time tracking of function execution and performance metrics. This visibility is crucial for maintaining application reliability. By focusing on business logic instead of infrastructure management, developers can innovate more efficiently. Whether processing data from IoT devices or handling background tasks, Azure Functions streamlines cloud-native development. Overall, it empowers teams to build scalable and efficient applications while reducing operational overhead.


At ARC Infosoft, we are committed to exploring innovative approaches that ensure our applications are not only future-ready but also optimized for performance. Our team of skilled professionals brings extensive industry experience across all stages of development—from documentation and planning to design and execution. We implement standardized practices at every level of application development, guaranteeing that our solutions perform exceptionally in production while remaining easy to maintain. Whether you have a unique idea for a customized software solution or need to hire remote resources, we are here to be your reliable partner. Reach out to us at info@arcinfosoft.com to discuss how we can help elevate your business with tailored IT solutions.



12 views
bottom of page