Tolgee Localization Plugin
Integrate Tolgee's powerful translation management platform with Medusa to easily add multilingual support to your e-commerce store.
Overview
This plugin connects Medusa V2 with Tolgee, an open-source localization platform, enabling seamless translation management for your product data without the complexity of traditional CMS systems. Manage translations in-context, leverage AI-powered suggestions, and collaborate with your team on multilingual content.
Features
- Tolgee Integration - Connect Medusa with Tolgee localization platform
- In-Context Translation - Translate content with real-time preview on your storefront
- AI-Powered Translations - Automatic translation suggestions via:
- DeepL
- Google Translate
- AWS Translate
- Collaborative Workflows - Team review and approval processes
- Admin Widget - Manage translations directly from Medusa admin
- Auto-Sync - Automatic synchronization when models are added or removed
- Custom Attributes - Support for custom model fields
- Multiple Models - Translate products, collections, categories, and more
- MedusaJS v2 Compatible - Built for Medusa V2
Supported Models
The plugin supports translation for:
- Products - Product names and descriptions
- Product Variants - Variant titles and descriptions
- Product Options - Option names
- Collections - Collection titles and descriptions
- Categories - Category names and descriptions
- Product Types - Type names
- Tags - Tag values
- Shipping Options - Shipping option names
Requirements
- MedusaJS v2
- Node.js (latest LTS recommended)
- Tolgee account (free or paid)
- Tolgee API key
Installation
Install the plugin using npm:
npm install medusa-plugin-tolgee
Configuration
Step 1: Set Up Tolgee
- Create a free account at tolgee.io
- Create a new project for your Medusa store
- Generate an API key with appropriate permissions
- Note your Tolgee API URL
Step 2: Environment Variables
Add Tolgee credentials to your .env file:
TOLGEE_API_URL=https://app.tolgee.io
TOLGEE_API_KEY=your_tolgee_api_key
TOLGEE_PROJECT_ID=your_project_id
Step 3: Plugin Configuration
Add the plugin to your medusa-config.js:
const plugins = [
// ... other plugins
{
resolve: "medusa-plugin-tolgee",
options: {
api_url: process.env.TOLGEE_API_URL,
api_key: process.env.TOLGEE_API_KEY,
project_id: process.env.TOLGEE_PROJECT_ID,
// Optional: Default language
default_language: "en",
// Optional: Custom attributes to translate
custom_attributes: {
product: ["meta_title", "meta_description"],
},
},
},
]
Step 4: Sync Models
After installation, sync your Medusa models with Tolgee through the admin panel:
- Log into Medusa admin
- Navigate to the Tolgee section
- Click “Sync Models”
- Wait for synchronization to complete
Usage
Admin Panel
Translation Management Widget
The plugin adds a translation widget to the Medusa admin:
- View Translations - See all translations for a model
- Edit Translations - Update translations directly
- Add Languages - Add new language support
- Sync Status - View synchronization status
Managing Translations
- Navigate to a product, collection, or category
- Open the Tolgee translation widget
- Select target language
- Edit translations
- Save changes
Automatic Synchronization
The plugin automatically syncs with Tolgee when:
- New products are created
- Products are updated
- Products are deleted
- Collections, categories, or other supported models change
Frontend Integration
Using Medusa SDK
Access translated content through linked properties:
import { sdk } from "@medusajs/medusa"
// Fetch product with translations
const product = await sdk.store.product.retrieve(productId, {
fields: "+translations.*",
})
// Access translated title
const translatedTitle = product.translations.find(
t => t.language_code === "es"
)?.title || product.title
Using Tolgee React Hook
For in-context translation on the frontend:
import { T } from "@tolgee/react"
function ProductTitle({ product }) {
return (
<h1>
<T keyName={`product.${product.id}.title`}>
{product.title}
</T>
</h1>
)
}
AI-Powered Translation
Automatic Translation Suggestions
Enable AI translation in Tolgee:
- Configure translation provider (DeepL, Google, or AWS)
- Add API credentials in Tolgee dashboard
- Use “Auto-translate” feature for suggestions
Translation Providers
DeepL
- High-quality translations
- Supports 30+ languages
- Best for European languages
Google Translate
- Wide language coverage
- 100+ languages
- Good general-purpose translator
AWS Translate
- Enterprise-grade
- Custom terminology support
- Neural machine translation
Collaborative Translation
Team Workflows
- Translators - Add and edit translations
- Reviewers - Review and approve translations
- Approvers - Final approval before publishing
Review Process
- Translator submits translation
- Reviewer checks translation quality
- Reviewer approves or requests changes
- Translation goes live after approval
Custom Attributes
Translate custom fields in your models:
{
resolve: "medusa-plugin-tolgee",
options: {
// ... other options
custom_attributes: {
product: [
"meta_title",
"meta_description",
"seo_keywords",
"specifications",
],
product_variant: [
"color_name",
"size_name",
],
collection: [
"banner_text",
"meta_title",
],
},
},
}
Languages
Adding Languages
-
In Tolgee Dashboard:
- Navigate to Languages
- Click “Add Language”
- Select language code (e.g., es, fr, de)
- Save
-
Sync with Medusa:
- New language automatically available
- Start translating content
Language Codes
Use standard ISO language codes:
en- Englishes- Spanishfr- Frenchde- Germanja- Japanesezh- Chinese- And many more…
Translation States
Track translation progress:
- Untranslated - No translation exists
- Translated - Translation added but not reviewed
- Reviewed - Translation reviewed and approved
- Outdated - Source text changed since translation
Best Practices
- Consistent Naming - Use consistent key names for translations
- Context - Provide context for translators
- Review Process - Always review translations before publishing
- AI as Assistant - Use AI for suggestions, not final translations
- Regular Sync - Keep Tolgee and Medusa synchronized
- Backup - Export translations regularly
- Testing - Test translations in staging environment
Use Cases
Global E-commerce
- Sell products in multiple countries
- Localize product descriptions
- Multi-language customer support
Multi-Regional Stores
- Country-specific product information
- Regional pricing and descriptions
- Local language support
Content Management
- Translate marketing content
- Localize SEO metadata
- Multi-language blog posts
Performance
Caching
The plugin caches translations for performance:
- Translations loaded on startup
- Updates synced in background
- Minimal impact on response time
Optimization
Best practices for performance:
- Sync during off-peak hours
- Use batch operations for bulk updates
- Cache frequently accessed translations