Main menu

Automatic translation

Using third party translation providers with Loco Translate WordPress plugin

As of Loco Translate 2.4 automatic translation services are integrated into the translation file editor. This is accessed via two functions which both show the :robot icon:

  • The "Auto" button in the main toolbar provides automatic translation of the entire file. You will be shown a calculation of how many characters are to be sent to the service provider. This this will likely affect how much the provider charges you, or how much of your free quota gets used up.

  • The "Suggest" feature is available from each individual translation window. (Shortcut: Ctrl J). This function immediately contacts all your configured translation services and offers the choice of using their translation. See the editor documentation.

Supported services / APIs

The following machine translation services are supported via their APIs directly from Loco Translate. You will have to register with each service you wish to use and generate an API key.

Follow the official links below for the most up to date information on using each service and please note that your chosen provider may charge you. We are listing providers in alphabetical order. We aren't recommending or promoting any of them.

DeepL Translator

You will need a DeepL developer plan in order to access their API. Be sure to purchase the correct one.

https://www.deepl.com/pro#developer

Steps for generating an API key are as follows:

  1. Get a DeepL account and subscribe to the API plan.
  2. Go to your DeepL account settings and copy the Authentication Key to your clipboard.
  3. Paste your key into the Loco Translate plugin settings.
  4. If you're using DeepL's free API, enter https://api-free.deepl.com in the URL field (as of Loco Translate v2.5.3).

If you have any questions about DeepL plans and API access, please ask their support.

Google Translate

Google Translate is part of Google Cloud. You will need a simple API key to use it with Loco Translate.

https://cloud.google.com/translate

Steps for generating an API key are as follows:

  1. Register for Google Cloud.
  2. Go to the cloud console and create a new project.
  3. Go to "APIs & Services", click "Enable APIs and services", find the "Cloud Translation API" and click "Enable".
  4. You may have to Enable Billing at this point. Usage of Google's API is not free, but we don't charge you.
  5. Generate a key from APIs & Services > Credentials. Click "Create Credentials" and choose "API key".
  6. We recommend clicking "Restrict key" and at least locking it to the Translation API.
  7. Enter your key into the Loco Translate plugin settings.

Read more about Google Cloud API keys here if you get stuck. Ignore any mentions of service accounts. Loco Translate does not support service accounts.

If you want extra security you can restrict your key to your IP address, but be aware that this is your IP address, not your server's. Requests to the API are made directly from your browser.

Lecto AI

Lecto AI offer a free trial of their Translation API and a range of paid plans for higher volumes of text. You will need a simple API key.

Steps for generating a Lecto API key are as follows:

  1. Sign up for Lecto AI.
  2. Either stay on the free plan, or choose a subscription plan.
  3. Copy the pre-generated API key from the Lecto dashboard.
  4. Enter your key into the Loco Translate plugin settings.

Loco is a referral partner for Lecto AI. However, we do not promote their products above any of the others listed here.

Note that as of Loco Translate 2.5.6 a maximum of 1,000 characters will be sent per request to the Lecto API. Although higher plans support larger request bodies and parallel requests, such features are not supported by the plugin.

Microsoft Translator

Microsoft Translator Text API (to give it its full name) is part of Azure Cognitive Services. You will need an Azure account and a Subscription API key. https://aka.ms/MicrosoftTranslator

Steps for generating a Microsoft API key are as follows:

  1. Sign up for Microsoft Azure
  2. From the portal click "Create a resource", search for "Translator Text" and click "Create"
  3. Complete your subscription by choosing your pricing tier and region (or select global).
  4. Select Keys in the Resource Management section of your subscription and note your key.
  5. Enter your key and region into the Loco Translate plugin settings.

Note that if you created your subscription in a region other than global you will need to enter the short code into Loco Translate. e.g. "West Europe" is actually westeurope. The wrong region will produce authentication errors.

Depending on your Azure customer status you may be entitled to a free trial before having to set up billing. Check pricing with Microsoft. We don't charge you and can't advise on pricing.

If you get stuck with these steps try the microsoft-translator tag on StackExchange.

Other providers

In addition to these built-in providers Loco Translate provides a hookable architecture for adding your own external services. The following plugins are available for manual installation via Git:

Free vs paid

Some of the providers listed above may offer you a free trial or some kind of free quota, so check the information on their websites. However, all the machine translation services we've examined will eventually carry a charge if you're a heavy user.

If you plan on light usage we recommend using a service that provides metered billing rather than a monthly fee. These are often priced per million characters. To put that in perspective Loco Translate itself contains about 13k characters of translatable text. The WordPress core totals about 300k, but you'll probably find that's already translated into your language. We were able to translate dozens of plugins within our free quotas with some of these providers.

Be wary of third party add-ons that offer free, unlimited translations by any of the major technology firms listed here, especially without an API key. They are likely to be doing things that will put you in breach of the terms and conditions of that service. For example: by making it look like you're using their web interface. Such products will likely stop working as and when the providers close their loopholes.

Each service is subject to its individual terms of service and may incur fees. Please refer to the links above for pricing and terms.

Your usage of these services is a legal arrangement between you (the end user of Loco Translate) and the service provider in question. We (Loco) are not party to this agreement. We provide only the software to access their API, which runs on your servers and in your browser.

  • We do not charge you to access these APIs.
  • We do not proxy calls to the APIs via our servers.
  • We do not store or process your access credentials.
  • We do not store or use your translated texts.
  • We are not responsible for what you do with translations.

Attribution

You may be required to publicly display attribution to a service provider when you make use of translations generated by their API. We cannot advise more specifically on this topic. Make sure you check the terms of your chosen provider and abide by them.

Loco Translate will always display attribution to you when text is translated via one of these services. This is done privately in WordPress admin, but what you choose to do with the translation is beyond our control and we are not responsible if you breach your end user agreement with the service provider.

Support

If you experience errors accessing these APIs via Loco Translate feel free to report a bug in the support forum. However, we cannot provide support for the actual API services themselves. That includes dissatisfaction with the quality of translation, or if translated text does not observe your required style or formatting, or is otherwise nonsensical. Also, please don't ask us for help generating API keys. Contact the service provider if you're unable to obtain a working key.

Always check your browsers debugging console and network inspector before reporting an issue. We will need to see the full request sent to the API and the response received. But please redact your API keys.

Available languages

All these services are limited in the languages they support. Loco Translate attempts to find the best supported match for your specific language, but it will always attempt translation even if it's expected to fail. We have found these services sometimes support a language without advertising the fact. We allow the APIs to return an error if the language is not supported, but be aware that this error may be vague.

You may find that your language works, but your particular region or dialect is wrong. For example: translating into Brazilian Portuguese may produce European Portuguese. This is likely to be because the service supports only the language code "pt" and not "pt_BR". Please check with the service provider before reporting this as a bug to us.

Please note that all translations performed within the plugin are assumed to be from English. The source locale of WordPress is "en_US". We strongly recommend against any attempt to use an alternative source language and cannot provide support for doing so.

HTML and formatting

We have found that simple HTML and advanced string formatting (using %s) can come back from translation APIs in a broken state, or sometimes with spaces added or removed. We can't control the quality of automatic translations, so we recommend reviewing them against their source strings for glitches in formatting.

All the translation APIs above support text and HTML translation. Loco Translate performs some fairly basic detection for whether a source string is HTML or not and sends it to the API accordingly. This process is not perfect. In particular the API may require HTML to be "well formed" which can't be guaranteed.

If you have a problem with the formatting of automatic translation, feel free to show us a specific example. We can't promise we can fix it, but we're keen to do what we can to improve the integration.

Limits of automatic translation

The machine translation capabilities offered by these providers are quite incredible. The technology has improved hugely in recent years with developments in machine learning etc.. However, it is still quite far from being a perfect replacement for human translation. Be wary if you are translating into a language you don't understand. You may be amusing your visitors without knowing.

The short snippets of text used in WordPress carry very little context and these APIs don't offer a way to provide any supporting information. For example: "Close window" is pretty obvious in its meaning to a human, but it could be translated as a window that is close, meaning near-by. The API doesn't know that you are translating a web site. Much less the specifics of what the sentence is used for.

Human translators

Human translators are not yet available from within our WordPress plugin, but we're planning to integrate professional services soon. If you're interested in professional translation for your WordPress site then please fill in this form and we'll get back to you as soon as the service is ready.