LibreTranslate machine translation for Decidim

Learn how to run LibreTranslate inside your own infrastructure and connect it to Decidim so participant contributions can be translated without a third-party API call. The page covers prerequisites, configuration, data handling and testing.

On this page

How self-hosted machine translation for Decidim keeps contributions in your infrastructure

A public participation team that wants proposals and comments available in several languages usually faces a trade-off: automatic translation is convenient, but sending citizen text to an external translation service can conflict with data protection duties and with the expectations of the public. This section explains the approach that keeps that text inside infrastructure the client controls. Decidim is pointed at a LibreTranslate instance the client runs itself, so the request for translation never leaves the client's network. The exact integration, including the service class, the environment variables and the admin settings that switch translation on, has to be confirmed against the Decidim documentation for the version in use before anyone configures it.

The first decision is where the translation service runs and who operates it. A LibreTranslate server needs its own hosting, network rules, language models and update routine, and it will receive every piece of text that participants submit for translation. Teams should confirm with their security function which hosts may reach it, how logs are retained, and whether the translation endpoint is reachable only from the Decidim application servers. The LibreTranslate project's own documentation should be read for its installation requirements and supported languages, since these determine the quality a participant will see.

Before enabling anything in production, confirm three things for the Decidim release you run: the translation class Decidim expects, the environment variables it reads, and the admin setting that makes translation visible to moderators and participants. The Decidim installation documentation is the starting point, and the release notes for your version should be checked as well. Test on a staging copy with realistic multilingual content, and record which fields are translated, which are not, and how machine output is labelled for readers.

What you need before connecting LibreTranslate to Decidim

Automatic translation depends on three things lining up: a supported Decidim release with the runtime it expects, a network path from that application to a LibreTranslate service you run, and a LibreTranslate deployment whose language coverage and access settings you have confirmed. Check each card before you touch the Decidim configuration.

Choose a supported Decidim branch

Decidim's security policy covers only the last two minor versions until version 1.0, which means the 0.32.x or 0.31.x branch is the one to build on today. Earlier branches such as 0.30.x no longer receive security updates. Pick the branch before you install, because the runtime versions and upgrade steps differ between them. If your instance runs an older release, plan the upgrade first and translate after it is stable.

Decidim security policy

Match the Ruby runtime to the branch

Decidim v0.32 requires Ruby 3.4.7, while v0.31 uses Ruby 3.3.4. Both branches list Node 22.14.x. Install the exact Ruby version the release documentation names, and do not mix a Ruby version from one branch with the Node version from another. Confirm the versions against the installation docs for the tag you deploy, since patch releases can change requirements.

Manual installation guide

Plan PostgreSQL and the database version

The manual installation guide uses PostgreSQL 17.4 or later on Ubuntu 24.04.3 LTS. Translation settings and content are stored alongside the rest of the platform data, so the database must be in a state you can back up before any change. Confirm the database version your chosen Decidim release and your hosting platform support, and schedule a backup before enabling the feature.

Establish the network path to LibreTranslate

The Decidim application server must reach the LibreTranslate endpoint over a private route inside your network, not through a public internet gateway. Decide where the service runs, which hostname and port Decidim will call, and whether traffic crosses a firewall, proxy or service mesh. Test connectivity from the Decidim application host itself, not from your workstation, because the runtime environment is what the feature will use.

Confirm the LibreTranslate version and languages

Before you configure Decidim, record the LibreTranslate release you will run and the language models installed with it. Language coverage varies by model, so confirm the language pairs your participants write in against the LibreTranslate project's documentation rather than assuming full coverage. Ask whether the release exposes the translation API endpoints you need.

Decidim repository

Confirm API key and access settings

Check whether your LibreTranslate deployment requires an API key, and whether it is enabled for the instance you run. If a key is required, store it in your secrets manager and supply it to Decidim through environment variables rather than committing it to configuration files. Also confirm rate limits and request size limits with the LibreTranslate documentation so long contributions do not fail silently.

How a participant contribution moves through the translation service

The flow starts when a participant saves a proposal or comment in the Decidim application server. The save enqueues a job on the background queue that Decidim runs through ActiveJob, and the worker sends the text to the LibreTranslate container on the internal network. The translated text is then written back to PostgreSQL. Check that every hop stays inside the client network boundary and that no edge leaves it for an external translation provider, including through DNS or proxy settings.

Translation stays inside the client network, with no external provider in the path.

Configuring LibreTranslate and turning on translation in Decidim

This sequence connects a privately hosted LibreTranslate service to a Decidim organization and turns on automatic translation for participant contributions. Each step ends with a check that confirms the service, the settings and the translated output before the feature reaches participants.

  1. Confirm the translation integration point for your version

    Before any deployment, the platform engineer and the Decidim administrator check the official Decidim documentation for the exact version in production or staging. They confirm which translation service class is supported, which environment variables it reads, and where the admin setting lives, because these details change between minor versions. Record the version number, the documented names and the page you used. Ask the vendor or the Decidim community to confirm anything the docs leave open. This step is done when the team has a written list of required settings for that version.

  2. Deploy LibreTranslate on a private address

    The infrastructure team runs LibreTranslate inside the same network boundary as the Decidim application, on an address that participants cannot reach directly. They install the languages the organization needs, following the LibreTranslate documentation, and restrict inbound access to the Decidim application servers and workers. Confirm the model storage, compute capacity and language list with the team that will operate it. This step is done when the service starts cleanly and the languages endpoint from the application host returns the expected language codes.

  3. Set the environment variables the docs name

    The Decidim operator adds the service address, any API key the LibreTranslate deployment requires, and the other variables named in the version's installation documentation to the production environment. Store the key in the secrets manager used for the rest of the platform, not in source control or in shared configuration files. Keep a record of each value and who changed it. This step is done when the variables are present in the running environment of the web and worker processes, and a configuration check shows no missing values.

  4. Restart the application and background workers

    The operator restarts the Rails application and every background job process so the new environment variables load. Restarting only the web process leaves workers running with old settings, which can make translation requests fail silently or go to the wrong address. Check the logs of both process types for startup errors that mention the translation service. This step is done when all processes have restarted, the logs show no configuration errors, and the application responds normally to a page request.

  5. Enable translation in the organization admin settings

    A Decidim administrator for the chosen organization opens the admin panel and enables automatic translation in the settings for that organization only. Select the languages participants will see, and confirm that the settings match the languages installed in LibreTranslate. Multi-organization instances need this step for each organization that should use the feature. Record who enabled it and when. This step is done when the setting is saved and the admin panel shows translation as active for the selected organization.

  6. Run a test contribution and check the translation

    A test user in a non-production or staging organization creates a proposal or comment in one language, then opens it in another language. The tester checks that the translated text appears in the correct field, that the original text is still shown and that the translation does not expose data outside the private network. Also check the application log for requests to the LibreTranslate address. This step is done when the test contribution shows a correct translation, the log confirms the request went to the private service, and the team signs off before enabling the feature for participants.

Where the service class and admin settings fit in the configuration

A Decidim translation integration has two layers that must agree: a service class in the application that calls LibreTranslate, and admin settings that decide which organizations and content types use it. Think of the service class as the adapter that receives text and returns a translation, and the admin settings as the switches that turn that adapter on for a given tenant. The exact class names, environment variable names and admin labels must be copied from the Decidim documentation for the version you run, not from memory or from an older blog post. Decidim's own docs for each release are the reference for the names, and the install and update pages linked from this section are the places to start.

Before anything reaches production, run the change in a staging copy built from the same Decidim version, the same database snapshot and the same LibreTranslate endpoint you plan to use. Confirm that the service class loads, that environment variables are read at boot, that the admin setting appears for each organization, and that a test participant contribution is translated and stored as expected. Check the failure path too: stop LibreTranslate in staging and confirm what a participant sees and whether the original text is still saved. Record the exact commit, gem versions and configuration values so the production change can be repeated.

Keep any local override outside the upstream Decidim code. Put custom translation logic in your own module or a separate application layer that Decidim loads, rather than editing files inside the gem or the checked-out framework. Store your own configuration in a versioned repository and keep the environment variables in your deployment tooling. When you move to the next minor version, the upstream diff stays small and your overrides can be reviewed on their own, which is the main reason an upgrade stays manageable. Follow the upgrade guide for each release, since it may change database structures or internal classes that your override depends on.

Mapping content, locales and translation settings

This table maps each Decidim content type to its source locale, target locales, translation trigger and audience. Use it to decide which content should translate automatically, which should wait for a participant request, and which needs a human check before it goes public. Confirm every locale code and trigger setting in your own release before go-live.

Content typeSource and target localesTrigger: automatic or on requestWho sees the translation
ProposalsAuthor's language to each locale the organization enablesConfirm whether your release translates on publish or on requestParticipants viewing that locale; original text stays available
CommentsCommenter's language to enabled target localesConfirm whether high-volume comments can be set to on requestReaders in other locales; moderators should review the original
Meeting textLanguage of the meeting description and minutesConfirm whether minutes from linked pads are includedAttendees and public visitors in the target locale
Process descriptionsOrganization's default locale as the sourceConfirm which admin roles can enable or trigger translationPublic visitors; editors should check wording before publishing
Legal and policy textDefault locale only, with approved translationsManual, after human reviewPublic visitors once an editor approves the translated version
Locale to LibreTranslate codeEach Decidim locale tag mapped to a LibreTranslate language code (for example, en or es)Set once in configurationConfirm every code against both projects' supported language lists before go-live
Regional variantsLocales such as regional variants that may lack a direct codeTest each pair before enabling itMismatches can produce failed or wrong-language output, so confirm each pair

Security controls for a self-hosted translation service

Translation sends participant contributions to a service you run, so the security questions shift from a vendor's terms to your own network, secrets, logs and role model. The six controls below cover access, credentials, logging, retention, permissions and patching, and each one needs an owner before the integration goes live.

Keep the endpoint private

Run LibreTranslate on a network path that only the Decidim application servers can reach, not on a public address. Confirm which hosts can open connections to the translation port, and block everything else at the firewall or security group. A reachable translation API is an open text-processing service that anyone on the internet could query. Test the restriction from outside your network, not only from inside it.

Manage the API key as a secret

If you enable an API key on LibreTranslate, store it in your secrets manager or as a protected environment variable on the Decidim hosts, never in the repository or in a shared admin note. Limit who can read it and rotate it on a schedule and whenever someone with access leaves. Confirm with your operations team where the key is injected, because copies in container images or log output are a common leak path.

Review what LibreTranslate logs

Check the request logging settings of your LibreTranslate deployment and decide whether submitted text ever reaches a log file, a reverse proxy access log or a log shipper. Participant contributions can contain personal data, so logs that store full request bodies widen the set of systems that hold it. Confirm the exact logging behavior of your installed version and the retention period of every log store involved.

Set retention for translations

Decide how long translated text remains anywhere outside Decidim's own records. Translations cached or stored by the integration should have a defined retention period, and a process to purge them when the source contribution is hidden, deleted or withdrawn. Align this with the retention rules in your privacy program and document who approves the period. Ask the implementer to show where translated copies are written and how they are removed.

Restrict who can trigger translation

Decide which Decidim roles can start an automatic or manual translation, and configure the integration so only those roles can do it. Limiting the trigger reduces the volume of text sent to the service and the number of accounts that can cause load or misuse. Review role assignments in the admin panel after each change, and test with a non-admin account that the restricted action is refused.

Patch Decidim and LibreTranslate

Keep both Decidim and LibreTranslate on versions that still receive security fixes. Decidim supports only its last two minor versions with security updates until version 1.0, and its security policy gives implementers a window to apply patches before details are disclosed: two months for standard vulnerabilities and four months for critical ones. Report suspected Decidim vulnerabilities to security@decidim.org or through GitHub Security Advisories, and schedule LibreTranslate updates on the same cycle.

Standard patch window
2 months
Critical patch window
4 months
Decidim security policy

Testing translation before participants see it

Start with one source locale and one target locale from your agreed mapping, on a staging copy of the platform. This isolates whether the translation service and the Decidim integration work before more languages add variables.

  • Content to submit: one proposal, one comment, one meeting description and one participatory process description, each written in the source locale with a short sentence, a paragraph, a link and a proper noun.
  • Expected stored text: the source text stays exactly as entered. The translation is stored as a separate value for the target locale, without overwriting the original. Confirm this behavior against the translation fields in your installed version.
  • Expected displayed text: target-locale visitors see the translated text, labeled the way your configuration specifies. Source-locale visitors continue to see the original.
  • Log entries to inspect: the outgoing request and response entries for the translation service, and the background job logs for each item. Confirm the exact message text in your version, then search for errors and match each entry to a content ID.
  • Editing checks: edit the source text of one item, save, and record whether its translation is marked as outdated, regenerated or left unchanged.

Check that every outcome matches your agreed mapping before you add a second locale.

Why translations are missing or fail and how to fix them

This table lists the failures that most often leave Decidim translations missing or erroring after LibreTranslate is enabled. Each row gives the likely cause, how to confirm it in logs or settings, and the fix, so you can work through the checks in order. Start with the background job process and the organization settings, since they account for many of the silent failures.

FailureLikely causeHow to confirmFix
LibreTranslate host unreachable from workersThe service address resolves on the web host but not from the machine or container that runs background jobs, or a firewall or network policy blocks that path.Check the job worker log for connection errors or timeouts. Run a test request to the service address from the worker host or container.Open the network path from the worker to the LibreTranslate port, and confirm the address and port are the ones the workers can reach.
Language code does not match the Decidim localeThe code Decidim sends to the service is not one the LibreTranslate instance supports, or the organization's default locale differs from the codes you expected.Compare the language list reported by your LibreTranslate instance with the locales enabled for each organization. Look for rejected language errors in the logs.Map each Decidim locale to a supported code in the configuration, and confirm the list again after any locale change.
Environment variable set on the web process onlyThe variables were added to the web service definition but not to the background job service, so jobs run with the feature off or with the wrong address.Print the environment of both the web and job processes and compare the values. Check the job log for messages showing translation is disabled.Set the same variables for every process that runs Decidim code, restart all of them, and recheck with a new contribution.
Translation enabled for one organization onlyThe setting was switched on in one organization in a multi-organization instance, so content in other organizations is never sent for translation.Open the translation settings in the admin panel for each organization and compare them. Check which organization the affected content belongs to.Enable the feature for each organization that needs it, then test with content from each one.
Text exceeds the service size limitLong contributions, such as proposals or meeting descriptions, are longer than the input size the LibreTranslate instance accepts.Look for request-size or validation errors in the job log for long items only. Compare the failing text length with the limit set on your LibreTranslate instance.Confirm the instance's input limit with your operator, raise it if your hardware and policy allow, and plan how long contributions are handled, such as splitting or leaving them untranslated.
Upgrade overwrote a local overrideA Decidim upgrade replaced a file or view you had changed to support translation, so the custom behavior disappeared without an error.Compare your override files with the new release's versions after the upgrade. Check whether the translation controls or service calls changed in the release notes.Reapply the override on top of the new version, record it in your upgrade checklist, and retest translation in a staging copy before production.

Questions teams ask before connecting machine translation to Decidim

What drives the effort of adding LibreTranslate to Decidim?

The effort depends on four things: how many languages the platform must translate between, how much participant content will be translated, where the service will run, and whether the translation flow needs custom code beyond the settings Decidim already exposes. Each language pair adds testing work, because translation quality varies and reviewers need to check the output in each direction. Content volume affects load and queueing on the translation service. Hosting decides who builds and patches the server, and where it sits relative to the Decidim application. Custom code is needed only when the default behavior does not match your moderation or publishing rules, so ask whether the scope includes any changes to Decidim itself.

How long does a LibreTranslate integration take?

Duration follows scope. A single Decidim instance, one hosting model, a small set of languages and no custom code is a smaller job than a multi-tenant setup with several languages, a separate staging environment and custom review workflows. No duration is given here because none is researched for this integration. Ask for a written scope that lists the languages, the hosting target, the environments to be configured, the testing steps and the handover, then ask for the timeline tied to those items. DeployOpen plans most engagements as fixed scope, with scope, deliverables and timelines agreed in writing before work starts.

What must our organization provide before the work starts?

Plan to provide the following before the work starts:

  • Infrastructure where LibreTranslate and Decidim can run, such as cloud accounts, data center capacity or an air-gapped network
  • Network access between the Decidim application servers and the translation service, plus the rules that allow it
  • A test environment that mirrors production closely enough to validate translations and settings
  • Language decisions, including which languages are enabled and which content types are translated
  • A named content owner who approves translation behavior and reviews sample output

Missing any of these usually moves work from build to waiting, which affects both timeline and cost.

Can our internal team set up machine translation for Decidim alone?

An internal team with Ruby on Rails, container or Linux operations, and Decidim experience can usually handle the setup, provided it has time to read the upgrade and installation documentation for the Decidim version it runs. The work touches environment variables, a service class for the translation provider, and admin settings, so the team needs someone who can test them end to end. Check whether your team has capacity for security review of the translation service, since it will process participant text. If one of these skills is missing, a partner can fill the gap under a written scope while your team keeps ownership of the platform.

What recurring work follows launch?

After launch, the recurring work covers three areas. First, updates to LibreTranslate and Decidim, both of which publish releases that need review and testing. Decidim's update guide asks teams to upgrade one minor version at a time, following each release's instructions and backing up the database first, and its security policy supports only the last two minor versions with security updates. Second, monitoring of the translation service for availability, errors and queue behavior. Third, retesting translation behavior after each Decidim upgrade, because custom code and configuration can break silently. Ask any provider to state which of these they run as a retainer and which stay with your team.

Does the translation service need security review?

Yes. Translation services receive participant contributions, which may include personal data, so the review should check where the service runs, who can reach it, how logs are kept, and whether any text leaves your infrastructure. Self-hosting keeps the content inside your control, but the setup still needs access rules, patch routines and a retention decision. Decidim's security policy asks implementers to apply patches within set grace periods for standard and critical vulnerabilities, so include both platforms in your patch plan. DeployOpen can test the configured setup as part of its security testing work.

Why does this page not show a price?

DeployOpen does not publish a price list, because the cost depends on the written scope. The main components are the work to plan and configure the translation service, the integration work in Decidim, testing across languages and environments, and any ongoing support you choose to buy. Infrastructure cost is separate and depends on your hosting choices. To compare quotes, ask each provider for the same written scope, the same list of languages and environments, the testing steps, the handover items and a clear split between one-time work and recurring support.

How DeployOpen scopes and delivers a self-hosted translation integration

DeployOpen plans, builds and hands over a LibreTranslate integration for Decidim inside infrastructure your organization controls. The work starts with a written scope that names which contributions are translated, which services run where, and what your team must confirm before build begins.

How we scope

  • Map which Decidim content types should be machine translated and which should stay in the original language
  • Confirm where LibreTranslate will run, its network path to Decidim, and the hosting constraints of your environment
  • Agree the written scope, deliverables and timeline before any work starts, since engagements are fixed-scope

How we build

  • Install and configure LibreTranslate in your infrastructure and connect it to the Decidim service class and environment variables
  • Set the admin translation settings per organization and test translations on representative contributions
  • Check that no participant content leaves your network during translation and record the evidence for your reviewers

How we hand over

  • Document the deployment, environment variables, admin settings and the upgrade steps tied to each Decidim minor version
  • Provide a runbook for language model updates, service restarts, failure handling and rollback
  • Walk your platform and security teams through the configuration so they can review it against your own requirements

How we support

  • Offer ongoing support, upgrades and continuous testing as a retainer after the handover
  • Retest the translation setup when Decidim or LibreTranslate receives a version change that affects the integration
  • Agree the support scope and response expectations in writing, and confirm them against your own service needs

Sources and further reading

Talk to our team.

Tell us what you're working on, whether it's a deployment, an audit, a security test or a cyber range. You'll speak with an engineer who can help you scope it.

  • 30-minute call: free, with no obligation.
  • NDA on request: we can sign before you share details.
  • Clear next steps: a scope and plan after the call.