Skip to content

Translation Services

Sveltia CMS comes with a handy translation API integration so that you can translate any text field from another locale without leaving the Content Editor.

Supported Services

Currently, the following services are supported:

Future Plans

Earlier versions of Sveltia CMS included DeepL integration, but we had to disable it due to an API limitation. It may be reintroduced in the future when we find a suitable workaround. Support for a CORS proxy is being considered.

More translation services will be added in the future.

Choosing a Service

A few notes to help you choose a service:

  • NMT is specialized for translations, while LLMs are more general-purpose.
  • NMT is fast, while LLMs may produce more natural, context-aware translations.
  • Google offers free tiers, while Anthropic and OpenAI require a paid plan.
  • With Gemini’s free tier, API input and output may be used to improve their products. As their terms state, do not send sensitive or confidential information while using the free tier. Consider using the paid plan or other services if this is a concern.

Requirements

You need to obtain an API key from the translation service provider of your choice. Some services may require you to set up billing information, even for free tiers. See the instructions below for each service:

  • Google Cloud Translation
    1. Sign in or sign up for Google Cloud and create a new project.
    2. Enable the Cloud Translation API. It’s free up to 500,000 characters per month.
    3. Create a new API key and copy it.
  • Google Gemini
    1. Sign in or sign up for Google AI Studio.
    2. A new API key is created automatically for your account. Or create a new one if needed, and copy it.
  • Anthropic
    1. Sign in or sign up for Claude Developer Platform.
    2. Add a credit balance (minimum $5) to your account.
    3. Create a new API key and copy it.
  • OpenAI
    1. Sign in or sign up for OpenAI Platform and create a new project.
    2. Add a credit balance (minimum $5) to your account.
    3. Create a new API key and copy it.

CSP Settings

If your site uses a Content Security Policy (CSP), You may need to update it to allow requests to translation service providers . See the CSP documentation for more details.

Configuration

You need to enable the i18n support in your configuration file with multiple locales to use the translation feature.

Using the Translation Feature

  1. Create a new API key for the translation service of your choice, as described above.
  2. Open an entry in Sveltia CMS.
  3. Click on the Translation button on the pane header or each field, right next to the 3-dot menu.
  4. Select a translation service from the dropdown menu and paste your API key when prompted.
  5. The field(s) will be automatically translated.

Note that the Translation button on the pane header only translates empty fields, while in-field Translation buttons override any filled text.

You can also provide your API keys in the Settings dialog or change the default translation service. API keys are stored securely in the browser’s local storage, so you don’t need to enter them every time.

Multi-user setups

If your CMS instance is used by multiple users, you as an administrator need to distribute your API key to all users to let them use the translation feature.

Alternatively, each user can provide their own API key. However, this is not recommended for instances with non-technical end-users because generating and managing API keys may be challenging for them.

Excluding Text from Translation

If you don’t want some text to be translated, use the HTML translate attribute or notranslate class:

html
<div translate="no">...</div>
html
<span class="notranslate">...</span>

For LLMs, you can also use the notranslate comment to exclude specific parts of Markdown content from translation:

html
<!-- notranslate -->...<!-- /notranslate -->
html
{/* notranslate */}...{/* /notranslate */}

Released under the MIT License.