Localize your web application using DeepL API
Web site localization is a major part of web development. Because we need to develop a web portal for multilingual people. For their better understanding, we need to localize web applications with different languages. This allows us to better engages our readers or web site visitors to a better personal level.
There have mainly two several options to localize our web application. First, Human translation and secondly, Machine translation / Automated translation.
Human Translation
Human translation is a way to translate every word or sentence by human or human interaction. This a very longly used process and also a very slow process. Because anyone needs to translate a text with the different languages we need to support our customers or clients. But most of us are not well comfortable in different languages.
Although, many agencies or services provide human translations but its a long process. Because someone needs to list every text with the key to our application then provide it to agencies and wait for their work is done. Then we need to incorporate it into our application and deploy it. It’s a little bit slow process.
Machine Translation / Automated Translation
There have several machine translation or automated translation service which provide translation for different language using AI. For example, Google translator and DeepL, etc. They provide online translation and also provide API with more accurate service.
Google translator
Probably we are most familiar with google translators for translating any text. We can translate any text from translate.google.com.
DeepL API
DeepL API provides more fast, accurate, and secure translations for any text. They provide their API to translate any text with any specific language. DeepL API incorporation is also easy and simple to integrate. Because only we need an authentication key which we can get by taking any plan from them. Their only API is https://api.deepl.com/v2/translate.
For example, DeepL API Request cURL
curl https://api.deepl.com/v2/translate \
-d auth_key=[yourAuthKey] \
-d "text=Hello, world" \
-d "target_lang=DE"
Then DeepL API response will be like:
{
"translations": [{
"detected_source_language":"EN",
"text":"Hallo, Welt!"
}]
}
For more detail about DeepL API click here.
Now the question is how can we translate our whole application’s text with DeepL API.
Step 1:
Write an API in your server-side which can store all your localization text with key-value pairs. The Key will be the key that you can set in your application view / HTML and Value will be the original text that you want to translate with different languages.
Step 2:
Translate each value from DeepL API for the languages you want to support and store it with the key.
Step 3:
Serve your localization for the required language for your application with the key by using your API.
Summary
Unlike human translation, Machine translation / Automated translation will not be accurate than humans. But it is fast to incorporate it into our application and serve it. If there any mismatch of translations, then we can give an option to fix it manually.
Localizing our web application for different target language’s people will extent our visitors.