Translation API for E-commerce: Translate Product Listings in 195 Languages
Cross-border e-commerce is growing fast. Shoppers in Germany, Japan, Brazil, and Saudi Arabia are buying from English-language stores — but they convert at much lower rates when product content is in a language they don't speak fluently.
The fix is straightforward: translate your product listings. The challenge is doing it at scale without paying a fortune or maintaining hundreds of translation files manually.
In this guide, we'll show you how to use the SocketsIO Translation API to translate product listings programmatically — covering Python scripts for bulk translation, a Node.js Shopify integration, and a WooCommerce webhook approach.
The Business Case: Why Translate Product Listings?
The numbers are clear:
- 75% of consumers prefer to buy products in their native language (CSA Research)
- 40% won't buy from English-only stores even if they understand English
- Stores that add localized content see 2-3x higher conversion rates in non-English markets
The cost of not translating is lost revenue. The cost of translating with SocketsIO is about $2 per million characters — roughly $1 to translate a catalog of 10,000 products into one language.
What to Translate in an E-commerce Store
Not everything needs translation. Prioritize in this order:
- Product titles — highest impact on search and click-through
- Product descriptions — drives conversion
- Category names and navigation — usability
- Customer reviews — social proof across languages
- Checkout flow — error messages, labels, confirmations
- Email templates — order confirmations, shipping updates
Python: Bulk Translate a Product Catalog
This script reads products from a CSV, translates titles and descriptions, and writes a new CSV with translated content. Useful for any platform that accepts CSV imports (Shopify, WooCommerce, BigCommerce).
#!/usr/bin/env python3 # translate_catalog.py — Bulk translate product catalog via SocketsIO API import csv import time import requests API_KEY = "your-socketsio-api-key" API_URL = "https://api.socketsio.com/v1/translate" TARGET_LANGUAGES = ["de", "fr", "es", "ja", "zh", "ar"] def translate_batch(texts, target_lang): """Translate a list of strings in one API call.""" response = requests.post( API_URL, headers={"X-API-Key": API_KEY, "Content-Type": "application/json"}, json={"q": texts, "target": target_lang, "source": "en"}, timeout=30 ) response.raise_for_status() translations = response.json()["data"]["translations"] return [t["translatedText"] for t in translations] def translate_catalog(input_csv, output_prefix): with open(input_csv, newline="", encoding="utf-8") as f: products = list(csv.DictReader(f)) for lang in TARGET_LANGUAGES: print(f"Translating to {lang}...") # Batch titles and descriptions separately for efficiency titles = [p["title"] for p in products] descriptions = [p["description"] for p in products] translated_titles = translate_batch(titles, lang) time.sleep(0.1) # be polite to the API translated_descs = translate_batch(descriptions, lang) output_file = f"{output_prefix}_{lang}.csv" with open(output_file, "w", newline="", encoding="utf-8") as out: writer = csv.DictWriter(out, fieldnames=products[0].keys()) writer.writeheader() for i, product in enumerate(products): row = product.copy() row["title"] = translated_titles[i] row["description"] = translated_descs[i] writer.writerow(row) print(f" → Saved {output_file} ({len(products)} products)") if __name__ == "__main__": translate_catalog("products.csv", "products_translated")
For a catalog of 10,000 products with 500-character descriptions, this translates everything into 6 languages for about $0.30 total.
Node.js: Shopify Webhook Integration
This approach automatically translates new products when they're added to your Shopify store, using Shopify webhooks and the Shopify Admin API to write translations back.
// shopify-translate-webhook.js // Listens for product/create webhooks and auto-translates const express = require('express'); const app = express(); app.use(express.json()); const SOCKETSIO_KEY = process.env.SOCKETSIO_API_KEY; const SHOPIFY_TOKEN = process.env.SHOPIFY_ADMIN_TOKEN; const SHOPIFY_STORE = process.env.SHOPIFY_STORE_DOMAIN; // e.g. mystore.myshopify.com const TARGET_LANGS = ['de', 'fr', 'es', 'ja']; async function translateText(texts, targetLang) { const res = await fetch('https://api.socketsio.com/v1/translate', { method: 'POST', headers: { 'Content-Type': 'application/json', 'X-API-Key': SOCKETSIO_KEY }, body: JSON.stringify({ q: texts, target: targetLang, source: 'en' }), }); const data = await res.json(); return data.data.translations.map(t => t.translatedText); } app.post('/webhooks/product-created', async (req, res) => { res.sendStatus(200); // Acknowledge immediately const product = req.body; console.log(`Translating product: ${product.title}`); for (const lang of TARGET_LANGS) { const [title, bodyHtml] = await translateText( [product.title, product.body_html], lang ); // Write translation to Shopify via Translations API await fetch( `https://${SHOPIFY_STORE}/admin/api/2024-01/products/${product.id}/translations.json`, { method: 'POST', headers: { 'X-Shopify-Access-Token': SHOPIFY_TOKEN, 'Content-Type': 'application/json' }, body: JSON.stringify({ translation: { locale: lang, title, body_html: bodyHtml } }), } ); console.log(` ✓ Translated to ${lang}`); } }); app.listen(3000, () => console.log('Webhook server running on :3000'));
WooCommerce: PHP Integration
For WooCommerce stores using WPML or Polylang, you can hook into the save_post action to auto-translate products:
// functions.php — Auto-translate WooCommerce products function socketsio_translate_product($post_id, $post) { if ($post->post_type !== 'product' || $post->post_status !== 'publish') return; if (get_post_meta($post_id, '_sio_translated', true)) return; // already done $api_key = 'your-socketsio-api-key'; $target_langs = ['de', 'fr', 'es']; foreach ($target_langs as $lang) { $response = wp_remote_post('https://api.socketsio.com/v1/translate', [ 'headers' => ['Content-Type' => 'application/json', 'X-API-Key' => $api_key], 'body' => json_encode([ 'q' => [$post->post_title, $post->post_content], 'target' => $lang, 'source' => 'en', ]), ]); $data = json_decode(wp_remote_retrieve_body($response), true); $translations = $data['data']['translations']; // Store translations as post meta (use with WPML/Polylang) update_post_meta($post_id, "_title_{$lang}", $translations[0]['translatedText']); update_post_meta($post_id, "_content_{$lang}", $translations[1]['translatedText']); } update_post_meta($post_id, '_sio_translated', true); } add_action('save_post', 'socketsio_translate_product', 10, 2);
Translating Customer Reviews
Reviews are often the most valuable content to translate — they're user-generated, authentic, and drive purchase decisions. Here's how to translate reviews on-demand when a user switches language:
// Translate reviews when language changes (JavaScript) async function translateReviews(reviews, targetLang) { if (targetLang === 'en') return reviews; // No translation needed const reviewTexts = reviews.map(r => r.text); const res = await fetch('https://api.socketsio.com/v1/translate', { method: 'POST', headers: { 'Content-Type': 'application/json', 'X-API-Key': SOCKETSIO_KEY }, body: JSON.stringify({ q: reviewTexts, target: targetLang }), }); const data = await res.json(); return reviews.map((review, i) => ({ ...review, text: data.data.translations[i].translatedText, originalText: review.text, translatedFrom: 'en', })); }
Cost Comparison: Translating a 10,000-Product Catalog
| Provider | Price/1M chars | 10K products × 6 langs | Annual (monthly updates) |
|---|---|---|---|
| Google Translate | $20 | $60 | $720 |
| DeepL API Pro | $25 + $5.49/mo | $75 + base fee | $966 |
| Microsoft Translator | $10 | $30 | $360 |
| SocketsIO | $2 | $6 | $72 |
Assumes 10,000 products × 500 chars avg × 6 languages = 30M characters. Monthly updates assume 10% catalog turnover.
Best Practices for E-commerce Translation
- Cache aggressively — Product descriptions rarely change. Cache translations in your database and only re-translate when content changes.
- Translate at publish time, not request time — Pre-translate when products are created/updated, not when customers browse. This eliminates latency.
- Keep HTML structure — The SocketsIO API preserves HTML tags, so product descriptions with bold text, bullet points, and links translate correctly.
- Detect review language — Use the
/detectendpoint to identify the language of incoming reviews before translating. Don't translate English reviews to English. - Localize, don't just translate — Currency, units (kg vs lb), and date formats need localization beyond translation. Handle these separately.
Getting Started
The SocketsIO Translation API is compatible with Google Translate v2 format, so if you're already using Google Translate, migration is a one-line change:
# Before (Google Translate) API_URL = "https://translation.googleapis.com/language/translate/v2" # After (SocketsIO — same format, 90% less cost) API_URL = "https://api.socketsio.com/v1/translate"
Ready to go global with your e-commerce store?
500K free characters/month. Translate your entire catalog for under $1. No credit card required.
Start Translating Free →