Translate Your Bubble.io App
Add multilingual support to your Bubble.io application using Langbly's translation API. This guide covers setting up the API Connector, translating dynamic content, and building a language switcher.
Overview​
Bubble.io apps can call external APIs using the API Connector plugin. You'll configure Langbly as an API data source, then use it to translate text anywhere in your app: page content, database fields, user-generated content, or dynamic elements.
Prerequisites​
- A Bubble.io account (free or paid)
- A Langbly API key (sign up free, 500K chars/month included)
Step 1: Install the API Connector Plugin​
- In your Bubble editor, go to Plugins (left sidebar)
- Click Add plugins
- Search for API Connector
- Click Install (it's a free, official Bubble plugin)
Step 2: Configure the Langbly API​
- Go to Plugins → API Connector
- Click Add another API
- Configure the API:
| Setting | Value |
|---|---|
| API Name | Langbly |
| Authentication | Private key in header |
| Key name | X-API-Key |
| Key value | Your Langbly API key |
- Click Add another call and configure:
| Setting | Value |
|---|---|
| Name | Translate |
| Method | POST |
| URL | https://api.langbly.com/language/translate/v2 |
| Body type | JSON |
| Body | See below |
Request Body​
{
"q": "<text>",
"target": "<target_lang>",
"source": "<source_lang>",
"format": "text"
}
Mark each parameter as dynamic by unchecking "Private" for <text>, <target_lang>, and <source_lang>.
- Click Initialize call to test. Use:
- text:
Hello world - target_lang:
nl - source_lang:
en
- text:
You should see a response with translatedText: "Hallo wereld".
Step 3: Use Translations in Your App​
Option A: Translate on Page Load​
- Add a Text element to your page
- Set its data source to: Get data from an external API → Langbly - Translate
- Configure the parameters:
text: The text you want to translate (can be dynamic, e.g., from your database)target_lang: The user's preferred language (e.g., from a custom state or URL parameter)source_lang:en(or leave empty for auto-detect)
- Set the element's text to: This Langbly - Translate's data's translations's first item's translatedText
Option B: Translate on Button Click​
- Add a Button element
- In the workflow, add action: Plugins → Langbly - Translate
- Set the parameters dynamically
- Store the result in a custom state or display it directly
Option C: Translate Database Content​
- Create a workflow triggered by database changes (e.g., new record created)
- Call Langbly API with the new content
- Store the translated text in a separate field (e.g.,
title_nl,title_de)
Step 4: Build a Language Switcher​
-
Add a Dropdown element with language options:
- English (en)
- Dutch (nl)
- German (de)
- French (fr)
- Spanish (es)
-
Store the selected value in a custom state called
current_languageon the page -
Use this state as the
target_langparameter in your API calls -
Persist the choice: Save the selected language to the current user's profile so it persists across sessions
URL-Based Language Switching​
Alternatively, use URL parameters:
yourapp.com/page?lang=nl- Read with: Get data from page URL → parameter
lang - Default to
enif not set
Step 5: Translate HTML Content (Rich Text)​
For Bubble's Rich Text elements:
- Create a second API call in the API Connector:
| Setting | Value |
|---|---|
| Name | TranslateHTML |
| Method | POST |
| URL | https://api.langbly.com/language/translate/v2 |
| Body | {"q": "<html>", "target": "<target_lang>", "format": "html"} |
- Use this call for Rich Text content. Langbly preserves all HTML tags and attributes.
Performance Tips​
- Cache translations: Store translated content in your database to avoid re-translating the same text
- Translate in bulk: If you have multiple texts, combine them into the
qarray:{"q": ["Hello", "Goodbye"], "target": "nl"} - Use source language: Always specify
sourcewhen you know it, since auto-detection adds a small overhead - Static content: For labels and navigation text that don't change, translate once and store the results
Example: Multilingual Blog​
- Database: Add
title_nl,title_de,body_nl,body_defields to your Blog Post type - On create: Workflow triggers Langbly API for each target language, stores results
- On display: Conditional logic shows
title_nlwhencurrent_languageisnl, etc. - Language switcher: Dropdown in the header, value stored in user profile
Pricing​
| Plan | Price | Characters/mo | Typical Bubble Usage |
|---|---|---|---|
| Free | $0 | 500K | Small apps, testing |
| Starter | $19/mo | 5M | Medium apps with dynamic content |
| Growth | $69/mo | 25M | Large apps, user-generated content |
| Scale | $199/mo | 100M | Enterprise Bubble apps |
Troubleshooting​
"API call failed"​
- Check your API key is correct in the API Connector settings
- Ensure the key is set as
X-API-Keyheader (notAuthorization) - Test the call with the Initialize button
Slow translations​
- Use caching (store translations in your database)
- Specify the source language instead of auto-detecting
- Keep individual translation requests under 5,000 characters
Missing translations​
- Check that your
target_langparameter is a valid ISO 639-1 code - Ensure the text parameter isn't empty
- Look at the API response for error messages
Next Steps​
- API Reference: Full API documentation
- Glossary Support: Enforce consistent terminology
- Formality Control: Formal vs informal tone
- HTML Translation: Preserving markup during translation