Skip to main content

How to Add a Translation API to WordPress

This guide shows you how to integrate the Langbly translation API with WordPress to automatically translate your site's content. We'll cover two popular approaches: Loco Translate (for plugin/theme strings) and TranslatePress (for full-site translation).

Prerequisites

  • WordPress 6.0+ with PHP 7.4+
  • A Langbly API key (sign up free, 500K characters/month)

Option 1: Loco Translate + Langbly

Best for: Translating plugin and theme strings (.po files)

Step 1: Install Loco Translate

  1. Go to Plugins → Add New in your WordPress admin
  2. Search for "Loco Translate"
  3. Install and activate it

Step 2: Install the Langbly Plugin

  1. Download langbly-for-loco-translate.zip from langbly.com
  2. Go to Plugins → Add New → Upload Plugin
  3. Upload the zip file and activate

Step 3: Configure Your API Key

Add this line to your wp-config.php (above the "stop editing" line):

define( 'LANGBLY_API_KEY', 'your-api-key-here' );

Step 4: Start Translating

  1. Go to Loco Translate in the admin sidebar
  2. Choose a plugin or theme to translate
  3. Click New Language and select your target language
  4. In the translation editor, select one or more strings
  5. Choose Langbly from the auto-translate dropdown
  6. Click to translate, and you're done!

Batch Translation

Select multiple strings (Ctrl/Cmd + click), then use auto-translate to translate them all at once. Langbly handles batches efficiently, translating up to 128 strings per API call.

Option 2: TranslatePress + Langbly

Best for: Full-site translation with visual editing

Step 1: Install TranslatePress

  1. Go to Plugins → Add New
  2. Search for "TranslatePress"
  3. Install and activate the free version

Step 2: Install the Langbly Plugin

  1. Download langbly-for-translatepress.zip from langbly.com
  2. Go to Plugins → Add New → Upload Plugin
  3. Upload the zip file and activate

Step 3: Configure

  1. Go to Settings → TranslatePress → General
  2. Add a second language (e.g., Dutch, German, French)
  3. Go to Settings → TranslatePress → Automatic Translation
  4. Set "Enable Automatic Translation" to Yes
  5. Select Langbly as the translation engine
  6. Enter your API key
  7. Save changes

Step 4: View Your Translated Site

Visit any page on your site and use the language switcher. TranslatePress will automatically translate the page using Langbly.

Step 5: Edit Translations Visually

  1. Click the Translate Page button in the admin bar
  2. Hover over any text and click the pencil icon
  3. Edit the translation in the sidebar
  4. Save changes

Cost Comparison

Provider1M Characters5M Characters100M Characters
Langbly$19 (Starter)$19 (Starter)$199 (Scale)
Google Translate$20$100$2,000
DeepL$25$125$2,500

Langbly is 81–90% cheaper than Google Translate ($20/M) and 85–92% cheaper than DeepL ($25/M) for the same WordPress translation workflow.

Why Langbly for WordPress?

  • Superior quality: Context-aware translations that sound natural
  • Dutch expertise: Custom locale rules for Dutch translations
  • 500K free characters/month: Enough to translate a small site completely free
  • Placeholder preservation: %s, %d, {name} placeholders are never translated
  • Simple API key auth: No complex OAuth or cloud console setup

Next Steps