Skip to main content
RapidDev - Software Development Agency
bubble-tutorial

How to set up API calls with Google's translation service in Bubble.io: Step-by-

You can integrate Google Cloud Translation into your Bubble app using the API Connector plugin to send text and receive translations in real time. This tutorial covers getting a Google Cloud API key, configuring the API Connector with the correct request format, handling language detection, and building a translation UI with source and target language selectors.

What you'll learn

  • How to obtain and configure a Google Cloud Translation API key
  • How to set up the API Connector for Google Translate requests
  • How to build a translation interface with language selection
  • How to handle batch translations and language detection
Book a free consultation
4.9Clutch rating
600+Happy partners
17+Countries served
190+Team members
Intermediate7 min read20-25 minAll Bubble plans (Google Cloud account required)March 2026RapidDev Engineering Team
TL;DR

You can integrate Google Cloud Translation into your Bubble app using the API Connector plugin to send text and receive translations in real time. This tutorial covers getting a Google Cloud API key, configuring the API Connector with the correct request format, handling language detection, and building a translation UI with source and target language selectors.

Overview: Setting Up Google Translation API Calls in Bubble

This tutorial walks you through connecting your Bubble app to Google Cloud Translation API v2. You will configure the API Connector to send text for translation, parse the response, and display results. We also cover language detection and batch translation for translating multiple strings in a single request. This is essential for apps serving multilingual audiences or building translation tools.

Prerequisites

  • A Bubble account with the API Connector plugin installed
  • A Google Cloud account with billing enabled
  • A Google Cloud Translation API key
  • Basic familiarity with the API Connector plugin in Bubble

Step-by-step guide

1

Get your Google Cloud Translation API key

Go to console.cloud.google.com and create a new project or select an existing one. Navigate to APIs & Services → Library. Search for Cloud Translation API and click Enable. Then go to APIs & Services → Credentials. Click Create Credentials → API key. Copy the generated API key. For security, click Restrict Key and limit it to the Cloud Translation API only. Note: Google charges approximately $20 per million characters translated.

Pro tip: Set a daily quota limit in the Google Cloud Console under APIs & Services → Cloud Translation API → Quotas to prevent unexpected charges.

Expected result: You have a Google Cloud API key restricted to the Cloud Translation API.

2

Configure the API Connector for translation requests

In your Bubble editor, go to the Plugins tab and open the API Connector. Click Add another API and name it Google Translate. Add a new call named Translate Text. Set the method to POST. Set the URL to https://translation.googleapis.com/language/translate/v2?key=[api_key]. Add a parameter api_key marked as Private (so it stays server-side). For the body, set it to JSON and enter the request body with dynamic parameters for the text to translate, target language, and optional source language.

API Connector payload
1POST https://translation.googleapis.com/language/translate/v2?key=[api_key]
2
3Headers:
4 Content-Type: application/json
5
6Body (JSON):
7{
8 "q": "[text_to_translate]",
9 "target": "[target_language]",
10 "source": "[source_language]",
11 "format": "text"
12}
13
14Sample Response:
15{
16 "data": {
17 "translations": [
18 {
19 "translatedText": "Bonjour le monde",
20 "detectedSourceLanguage": "en"
21 }
22 ]
23 }
24}

Expected result: The API call is configured with parameters for text, target language, and source language.

3

Initialize and test the API call

In the API Connector, set the parameter values for initialization: api_key to your Google Cloud API key, text_to_translate to Hello world, target_language to fr (French), and source_language to en (English). Click Initialize call. Bubble will send the request and display the response structure. You should see data → translations → translatedText with the value Bonjour le monde. Click Save after successful initialization. Set the call's Use as setting to Action (so you can call it from workflows).

Pro tip: Mark the source_language parameter as optional by unchecking the Required checkbox. When omitted, Google auto-detects the source language.

Expected result: The API call initializes successfully and Bubble can read the translatedText and detectedSourceLanguage from the response.

4

Build the translation user interface

On a new or existing page, add the following elements: a Multiline Input for the source text, a Dropdown for the source language (with Option Set values like en-English, fr-French, es-Spanish, de-German, etc.), a Dropdown for the target language (same options), a Translate Button, and a Text element or Multiline Input (read-only) for displaying the translated result. Add a Custom State on the page called translated_text (type text) to store the translation result.

Expected result: A translation interface with input area, language selectors, translate button, and output area is visible on the page.

5

Create the translation workflow

Go to the Workflow tab and create a workflow for When Button Translate is clicked. Add the action Plugins → Google Translate - Translate Text. Set text_to_translate to Multiline Input Source's value, target_language to Dropdown Target Language's value (the language code like fr or es), and source_language to Dropdown Source Language's value. After the API call, add Set state of page with translated_text = Result of step 1's data translations first item translatedText. Then set the output Text element's data source to the page's translated_text custom state.

Expected result: Clicking Translate sends the text to Google, receives the translation, and displays it in the output area.

6

Add language detection support

Create a second API call in the API Connector named Detect Language. Set the method to POST and the URL to https://translation.googleapis.com/language/translate/v2/detect?key=[api_key]. The body should be {"q": "[text_to_detect]"}. Initialize it with sample text. On your page, add a Detect Language button. Create a workflow that calls this API, reads the response's language code, and automatically sets the Source Language dropdown to the detected language. This is a great convenience feature for users who do not know the source language.

API Connector payload
1POST https://translation.googleapis.com/language/translate/v2/detect?key=[api_key]
2
3Body:
4{
5 "q": "[text_to_detect]"
6}
7
8Response:
9{
10 "data": {
11 "detections": [
12 [
13 {
14 "language": "en",
15 "confidence": 1.0
16 }
17 ]
18 ]
19 }
20}

Expected result: The app can auto-detect the language of the input text and set the source language dropdown accordingly.

Complete working example

API Connector payload
1{
2 "api_name": "Google Translate",
3 "calls": [
4 {
5 "name": "Translate Text",
6 "method": "POST",
7 "url": "https://translation.googleapis.com/language/translate/v2?key=[api_key]",
8 "headers": {
9 "Content-Type": "application/json"
10 },
11 "body": {
12 "q": "[text_to_translate]",
13 "target": "[target_language]",
14 "source": "[source_language]",
15 "format": "text"
16 },
17 "parameters": {
18 "api_key": { "private": true, "required": true },
19 "text_to_translate": { "private": false, "required": true },
20 "target_language": { "private": false, "required": true },
21 "source_language": { "private": false, "required": false }
22 },
23 "use_as": "Action"
24 },
25 {
26 "name": "Detect Language",
27 "method": "POST",
28 "url": "https://translation.googleapis.com/language/translate/v2/detect?key=[api_key]",
29 "headers": {
30 "Content-Type": "application/json"
31 },
32 "body": {
33 "q": "[text_to_detect]"
34 },
35 "parameters": {
36 "api_key": { "private": true, "required": true },
37 "text_to_detect": { "private": false, "required": true }
38 },
39 "use_as": "Action"
40 }
41 ]
42}

Common mistakes when setting up API calls with Google's translation service in Bubble.io: Step-by-

Why it's a problem: Putting the API key in a non-private parameter

How to avoid: Always mark the api_key parameter as Private in the API Connector so it stays server-side.

Why it's a problem: Using language names instead of ISO codes

How to avoid: Store language codes in an Option Set with a Display attribute for the name and an Attribute for the code. Pass the code to the API.

Why it's a problem: Not setting a billing quota on the Google Cloud project

How to avoid: Set daily character limits in Google Cloud Console → APIs & Services → Cloud Translation API → Quotas.

Best practices

  • Always mark API keys as Private in the API Connector to prevent browser exposure
  • Use ISO 639-1 language codes stored in an Option Set for clean language selection
  • Cache frequently translated phrases in your database to reduce API calls and costs
  • Set quota limits in Google Cloud Console to prevent unexpected billing spikes
  • Show a loading indicator while the API call is in progress for better user experience
  • Handle API errors gracefully — show a friendly message if translation fails
  • Consider Google's pricing ($20 per million characters) when estimating costs for your app

Still stuck?

Copy one of these prompts to get a personalized, step-by-step explanation.

ChatGPT Prompt

I want to add Google Cloud Translation to my Bubble.io app using the API Connector. I need to translate text between languages with auto-detection. My Google Cloud API key is ready. Can you give me the exact API Connector configuration including URL, headers, body format, and parameter settings?

Bubble Prompt

Help me integrate Google Translation into my app. I need a page where users can paste text, select source and target languages, and see the translation. Use the API Connector to call Google Cloud Translation API v2.

Frequently asked questions

How much does Google Cloud Translation cost?

Google charges approximately $20 per million characters for Translation API v2. The first 500,000 characters per month are free. Set budget alerts in Google Cloud to monitor spending.

Can I translate multiple texts in one API call?

Yes. The q parameter accepts an array of strings. Send multiple q values in the request body to translate them all in a single call, which is more efficient than individual requests.

Do I need to specify the source language?

No. If you omit the source parameter, Google automatically detects the source language. The detected language is returned in the response as detectedSourceLanguage.

Can I use the free Google Translate instead of the paid API?

Google does not offer a free translation API for production use. The cloud.google.com API with the free tier (500K chars/month) is the legitimate option. Third-party scraping services exist but violate Google's terms of service.

How do I handle translation errors in my workflow?

Check the API response status. If the call fails, the Result of step will be empty. Add a conditional action that shows an error message when the translation result is empty or the API returns an error code.

Can RapidDev help build a multilingual app with translation features?

Yes. RapidDev can help build full multilingual applications including real-time translation, language preference management, and localized content delivery using Google Translate or other translation APIs.

RapidDev

Talk to an Expert

Our team has built 600+ apps. Get personalized help with your project.

Book a free consultation

Need help with your project?

Our experts have built 600+ apps and can accelerate your development. Book a free consultation — no strings attached.

Book a free consultation

We put the rapid in RapidDev

Need a dedicated strategic tech and growth partner? Discover what RapidDev can do for your business! Book a call with our team to schedule a free, no-obligation consultation. We'll discuss your project and provide a custom quote at no cost.