Using Spree Automation Interfaces for automated translations
Using Spree Automation Interfaces for automated translations
Night Mode

One of the main goals of Spree 4.6, was allowing its users to scale globally. A common challenge in global expansion is providing localized content for multiple languages. While Spree's data model supports product catalogue translations out of the box, there's still a great amount of work required to prepare the actual translations. For a long time, a common approach was to coordinate the process with translation agencies and use mechanisms of import-export to mvoe the translations data around. This has however changed in the recent years, by the improvements in automated translation tools. We're seeing more and more companies taking a more efficient approach of automatically translating their content, and using a translator to proofread and correct the automated translations.
As a part of supporting Spree users, we've recently published a package called Spree Automation Interfaces that makes it easier to implement such automatons on top of Spree.
In this blog post, we will show how to use it to enable automated translations with DeepL.
Multi-language Store Setup
(You can skip this step if your store setup already enabled additional multiple locales).
First, let's go to the Spree admin panel and select Settings -> Store in the sidebar to the left.
In the screen below
You will see a list of "Supported Locales". For the purpose of this guide, we'll add set up additional locales: French and German.

After that, press "Update" at the bottom to save the configuration.
To confirm that the setup works correctly, navigate to a product in the admin panel, and go to its "Translations" tab. You should see a table for filling additional translations - this means that the setup is correct.

At this point, you can provide the translations manually. It's time to automate the process.
Add Spree Automation Interfaces and DeepL gems to your Gemfile
We need to add the following gems:
- spree_automation_interfaces - that brings the capability of automated translations into Spree
- deface - to allow spree_automation_interfaces to add new features to the admin panel
- deepl-rb - which we will use as a translations provider
gem 'spree_automation_interfaces', github: 'spree-contrib/spree_automation_interfaces'
gem 'deface'
gem 'deepl-rb', require: 'deepl'After that run:
bundle installAnd restart your development server.
Translations Provider Implementation
Now, we need to provide an implementation for the Automation Interfaces, that will be called by Spree when the user requests translations to be created.
The required interface is defined as follows:
module Spree
module Products
module Translations
interface _AutomatedTranslationsProvider
def call: (source_attributes: Hash[String, String], source_locale: String, target_locale: String) -> Hash[Symbol | String, String]
end
end
end
endLet's create an implementation in app/services/spree/translations/deepl_translations_provider.rb
module Spree
module Translations
class DeeplTranslationsProvider
def call(source_attributes:, source_locale:, target_locale:)
name = source_attributes['name']
description = source_attributes['description']
translated_name, translated_description = DeepL.translate([name, description], nil, target_locale)
{
'name' => translated_name,
'description' => translated_description
}
end
end
end
endWe also need to initialize DeepL's client. Let's create the following initializer config/initalizers/deepl.rb
DeepL.configure do |config|
config.host = ENV.fetch('DEEPL_HOST', 'https://api-free.deepl.com') # Set api.deepl.com for production API
config.auth_key = ENV.fetch('DEEPL_API_KEY')
endEnabling Automated Translations Provider
Finally, configure Spree to use the provider we've just created
In config/initializers/spree_automation_interfaces.rb
Rails.application.config.after_initialize do
SpreeAutomationInterfaces::Dependencies.products_automated_translations_provider = 'Spree::Translations::DeeplTranslationsProvider'
endIf you now go to the products translations page, you will see a "Translate automatically" button at the top.

Once you click it, it will fetch translations using the provider we've just implemented and add them to the product.

Wrapping Up
This is just a sample use case of the automation interfaces. The gem also provides a set of APIs for triggering automated translations, as well as additional interfaces for triggering automated translations from the code. This may be a good starting point if you'd like to e.g. write a custom Sidekiq worker that will translate all the products in your catalogue.
Explore More Blog Posts
Explore More Blog Posts

Automating Purchase Orders in E-Commerce: How Agentic AI Handles Unstructured Input
In an era of connected e-commerce, it’s easy to assume that every order flows cleanly through APIs or online checkouts. The reality, however, may be very different, especially in industries where B2B and wholesale operations still rely on unstructured, offline, or legacy input formats.

Building AI-Ready Data Platforms: From Infrastructure to Intelligence
Every leader today is expected to have an AI strategy. Yet behind the impressive demos and pilot projects, the truth is that most organisations are not ready for AI. In fact, in recent conversations with CTOs, Heads of Data, and engineering directors across industries, from finance to retail to research, the same story repeats:

How to Build a Self-Correcting Agent for Product Search Using Enthusiast
Shopify just launched AI agents that let shoppers search, explore, and purchase using natural language.