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 (create an account and add payment details; the first 500K input characters each month are included)

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$2.50$22.50$497.50
Google Translate$10$90$1,990
DeepLCheck live Growth planCheck live planCheck live plan

The totals above apply both providers' first 500K monthly characters before calculating additional usage. Langbly charges $5 per 1M additional input characters, a 75% lower rate than Google Cloud Translation Basic's published $20 rate 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
  • First 500K input characters included each month: Payment details activate API access, but this monthly usage has no charge
  • Placeholder preservation: %s, %d, {name} placeholders are never translated
  • Simple API key auth: No complex OAuth or cloud console setup

Next Steps​