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
- Go to Plugins → Add New in your WordPress admin
- Search for "Loco Translate"
- Install and activate it
Step 2: Install the Langbly Plugin
- Download
langbly-for-loco-translate.zipfrom langbly.com - Go to Plugins → Add New → Upload Plugin
- 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
- Go to Loco Translate in the admin sidebar
- Choose a plugin or theme to translate
- Click New Language and select your target language
- In the translation editor, select one or more strings
- Choose Langbly from the auto-translate dropdown
- 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
- Go to Plugins → Add New
- Search for "TranslatePress"
- Install and activate the free version
Step 2: Install the Langbly Plugin
- Download
langbly-for-translatepress.zipfrom langbly.com - Go to Plugins → Add New → Upload Plugin
- Upload the zip file and activate
Step 3: Configure
- Go to Settings → TranslatePress → General
- Add a second language (e.g., Dutch, German, French)
- Go to Settings → TranslatePress → Automatic Translation
- Set "Enable Automatic Translation" to Yes
- Select Langbly as the translation engine
- Enter your API key
- 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
- Click the Translate Page button in the admin bar
- Hover over any text and click the pencil icon
- Edit the translation in the sidebar
- Save changes
Cost Comparison
| Provider | 1M Characters | 5M Characters | 100M 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