Bubble Docs
  • Introduction
  • New? Start Here
  • What is Bubble?
  • The Glossary
  • User manual
    • Getting started
      • What is Bubble?
      • Building your first app
        • Planning features
        • Database structure
        • Design and UX
        • eCommerce and payments
          • Shopping cart
          • Checkout page
          • One-time payments
          • Subscriptions
          • Marketplace
      • Creating and managing apps
      • The Bubble editor
        • Tabs and sections
          • Design tab
            • The element tree
            • The property editor
          • Workflow tab
          • Data tab
          • Styles tab
          • Plugins tab
          • Settings tab
            • Application settings
              • Custom headers/body
              • Visual settings
              • Social media sharing
              • Translating your app
              • Email settings
              • Collaboration
            • Custom domain and DNS
          • Logs tab
        • Tools
          • Key features
          • The search tool
          • The Issue Checker
          • The element tree
          • The element property editor
          • The debugger
          • Notes
        • Previewing your app
      • Transitioning to Bubble from...
        • JavaScript
        • HTML and CSS
        • SQL
    • Design
      • Elements
        • The element hierarchy
          • The element tree
        • The page
        • Containers
          • Groups
          • Repeating groups
          • Table elements
          • Popups
          • Floating groups
          • Group focus
        • Visual elements
        • Input forms
          • Text and numbers
          • Dates and time
          • File uploads
          • Selection controls
        • Reusable Elements
      • Styling
        • Color variables
        • Font variables
        • Styles
        • Custom Fonts
      • Responsive design
        • Building responsive pages
        • Legacy articles
          • The Basics (Legacy)
          • Building Responsive Pages (Legacy)
          • Migrating Legacy Pages
          • Tips When Designing (Legacy)
      • Templates
      • The Component Library
      • Importing from Figma
    • Data
      • The database
        • Data types and fields
        • Creating, saving and deleting data
        • Finding data
        • Displaying data
        • Protecting data with privacy rules
        • The database editor
        • Export/import data
          • Exporting data
          • Importing data (CSV)
        • Working with location data
        • Using Algolia
        • Database structure by app type
          • Marketplace Apps
          • Directory & Listings Apps
          • Social Network Apps
          • SaaS Apps
          • Project Management Apps
          • CRM Apps
          • Professional Services Apps
          • On-demand Apps
          • Documentation/ CMS Apps
          • Applicant Tracking System (ATS) Apps
          • Portfolio Apps
          • Gallery Apps
          • Online Store / Ecommerce Apps
          • Blog Apps
          • Messaging App
          • Dashboards
          • Building Block Apps
          • Bubble as a backend
      • Files
      • Images
      • Static data
        • App texts (translations)
        • Option sets
      • Temporary data
        • Custom states
        • URL parameters
      • User accounts
        • Authentication plugins
          • Facebook plugin
          • Fitbit plugin
          • Google plugin
          • Instagram plugin
          • LinkedIn plugin
          • Pinterest plugin
          • Slack plugin
          • Wistia plugin
          • YouTube plugin
        • Cookies set by Bubble
      • Time, dates and time zones
    • Logic
      • The frontend and backend
      • Workflows
        • Events
          • Frontend events
            • Recurring workflows
            • Custom events
          • Backend events
            • Database trigger events
        • Actions
        • API Workflows
      • Dynamic expressions
      • Conditions
      • Navigation
        • Single-page applications (SPA)
        • Multi-page applications
        • Page slugs
    • Workload
      • Understanding workload
        • Activity types
        • The workload calculation
        • Client-side and server-side processing
      • Tracking workload
        • Measuring
          • Using App Metrics
        • Monitoring
          • Workload notifications
          • Infinite recursion protection
      • Optimizing workload
        • Optimization framework
        • Optimization checklist
          • Page load
          • Searches
          • Workflows and actions
          • Backend workflows
        • Agency showcases
          • Minimum Studio
          • Neam
          • Support Dept
    • Security
      • Bubble's security features
      • Planning app security
      • Client-side and server-side
      • Bubble account security
      • App security
      • Page security
      • Database security
      • API security
        • API Connector security
        • Data API security
        • Workflow API security
      • Flusk
        • Overview
        • Flusk plan features
        • Getting started with Flusk
        • Flusk security tools
          • The Issues Explorer
          • Issue details
          • Tools and settings
            • Pages rating
            • Database rating
        • Flusk FAQ
      • Cookies
      • Security checklist
    • Publishing your app
      • Web app
      • Native mobile app
        • Global native mobile settings
        • iOS App Store
        • Google Play Store
        • Publishing FAQ
    • AI
      • Generate apps with AI
        • About AI app generation
      • AI page designer
      • Connect to AI agents
    • Maintenance
      • Collaborators
      • Version control
        • Best practices: Version control
        • Transitioning from the legacy version control
        • Terminology: Version control
        • Version Control (legacy)
      • Commenting
      • Database maintenance
        • Copying the database
        • Restoring database backups
        • Bulk operations
          • Bulk operation methods compared
        • Wiping change history
      • Performance
        • Hard limits
        • Capacity Usage (legacy)
        • Notes on queries
      • SEO
        • Introduction to SEO
        • SEO: App
        • SEO: Page
      • Testing and debugging
        • Introduction to testing and debugging
        • The debugger
        • The server logs
        • Supported browsers
      • API workflow scheduler
    • Integrations
      • API
        • Introduction to APIs
          • What is a RESTful API?
        • The Bubble API
          • Bubble API terminology
          • Authentication
            • How to authenticate
            • No authentication
            • As a User
            • As an admin
          • The Data API
            • Data API Privacy Rules
            • Data API endpoints
            • Data API requests
          • The Workflow API
            • Workflow API privacy rules
            • Workflow API endpoints
            • API workflows
              • Creating API workflows
              • Scheduling API workflows
              • Recursive API workflows
              • API Workflow Scheduler
              • Case: Stripe notifications
        • The API Connector
          • Authentication
          • API Connector security
          • API guides
            • OpenAI
              • Authentication
              • Calls
                • ChatGPT
                  • Chat
            • Google Translate
              • How to setup Google API keys
          • Streaming API
        • API security
        • Plugins that connect to APIs
        • API Glossary
      • Plugins
        • What Plugins Can Do
        • Installing and using Plugins
        • Authentication plugins
        • Special Plugins
      • SQL Database Connector
      • Bubble App Connector
      • WorkOS
        • WorkOS SSO
        • WorkOS API
    • Infrastructure
      • Sub-apps
      • Bubble release tiers
      • Hosting and scaling
        • How Bubble hosting works
        • Scaling with Bubble
        • CDN (Cloudflare)
        • Bubble app names
        • Domain and DNS
      • Compliance
        • GDPR
        • SOC 2 Type II
        • HIPAA
        • Other frameworks and standards
    • Bubble for Enterprise
      • Hosting and infrastructure
        • Dedicated instance
          • The Dedicated editor experience
          • Technical specs
          • Main cluster dependencies
          • Customizable options
          • Migration process
            • Pre-migration
            • During migration
            • Post-migration
      • Security and compliance
        • Single sign-on (SSO)
        • GDPR
        • SOC 2 Type II
        • HIPAA
        • Other frameworks
        • Bubble's security features
      • Admin and collaboration
      • Priority support
      • Billing and Payment Guideline for Dedicated Instances
  • Core Reference
    • Using the core reference
    • Bubble's Interface
      • Design tab
      • Design tab (Legacy)
      • Workflow tab
      • Data tab
      • Styles tab
      • Styles tab (Legacy)
      • Plugins tab
      • Settings tab
      • Logs tab
      • Template tab
      • Toolbar
      • Top and context menu options
      • Deployment and version control
        • Deployment & Version Control Dropdown (legacy)
      • Notes
    • Elements
      • General properties
      • General properties (Legacy)
      • Styling properties
      • Styling Properties (Legacy)
      • Responsive Properties
      • Responsive Properties (Legacy)
      • Conditional formatting
      • States
      • Page Element
        • Page Element (Legacy)
      • Visual Elements
      • Containers
      • Container Layout Types
      • Containers (Legacy)
      • Input Forms
      • Reusable Elements
      • Element Templates (legacy)
    • Workflows
    • Events
      • General events
      • Element events
      • Custom events
      • Recurring event
      • Database trigger event
    • Actions
      • Account
      • Navigation
      • Data (things)
      • Email
      • Element
      • Custom
    • Data
      • Data Sources
      • Operators and comparisons
      • Search
      • Privacy
    • Styles
    • API
      • The Bubble API
        • The Data API
          • Authentication
          • Data API endpoints
          • Data API requests
        • The Workflow API
      • The API Connector
        • Authentication
        • Adding calls
    • Bubble-made Plugins
      • AddtoAny Share Buttons
      • Airtable
      • API Connector
      • Blockspring
      • Box
      • Braintree
      • Bubble App Connector
      • Chart.js
      • Circle Music Player
      • Draggable Elements
      • Dropzone
      • Facebook
      • Fitbit
      • Full Calendar
      • Google
      • Google Analytics
      • Google Optimize
      • Google Places
      • Ionic Elements
      • iTunes
      • Slidebar Menu
      • LinkedIn
      • Localize Translation
      • Mixpanel
      • Mouse & Keyboard Interactions
      • Multiselect Dropdown
      • Progress Bar
      • Rich Text Editor
      • Rich Text Editor (Legacy)
      • Screenshotlayer
      • SelectPDF
      • Slack
      • Segment
      • Slick Slideshow
      • SQL Database Connector
      • Star Rating
      • Stripe
      • Tinder-like Element
      • Twitter
      • YouTube
      • Zapier
    • Application Settings
      • App plan
      • General
      • Domain / email
      • Languages
      • SEO / metatags
      • API
      • Collaboration
      • Sub-apps
      • Versions
  • Account & Marketplace
    • Account and billing
      • Pricing and plans
        • Plans and billing
        • Billing cycle
        • FAQ: Pricing and Workload
      • Account Management
      • Building Apps for Others
      • Selling on the Marketplace
      • Plans & Billing (legacy)
    • Official Bubble Certification
      • Hiring certified developers
    • Building Plugins
      • The Plugin Editor
      • General Settings
      • Updating to Plugin API v4
      • Adding API Connections
      • Building Elements
      • Building Actions
      • Loading Data
      • Publishing and versioning
      • Github Integration
    • Building Templates
    • Application and data ownership
    • Marketplace policies
    • Bug reports
  • Vulnerability Disclosure Policy
  • Beta features
    • About the Beta features section
    • Native mobile apps 🔒
      • Introduction
        • What is a native mobile app?
        • Native mobile vs. web development
        • Differences in native and web elements
        • Native mobile app terminology
      • Building
        • Views and navigation
        • Native mobile actions
        • Components and gestures
        • Device resources
          • Location services
          • Camera/photo library
      • Previewing
      • Publishing
Powered by GitBook
On this page
  • Authenticating
  • Setting up the call
  • The endpoint
  • The parameters
  • Initializing the call
  • Using the call

Was this helpful?

  1. User manual
  2. Integrations
  3. API
  4. The API Connector
  5. API guides

Google Translate

Use Bubble's API Connector to connect to Google's Translate API and automatically translate text strings in your app.

Last updated 11 months ago

Was this helpful?

The API Connector is a powerful tool to connect to external applications and services.

In this article we'll look at how you can easily connect to and use their to translate strings of text in your app.

Useful resources

Setting up an API key with Google Cloud For this guide you will need to set up an API key with Google Cloud. If you don't have an API key, you can follow the video tutorial in the link below to set one up: Video: Activating the Google Cloud Translation API You will also need to activate the Cloud Translation API in your Google Cloud dashboard. This guide shows you how to: Article: [external] Google Cloud Translation Quickstart Guide You may find the Google Cloud Translation Quickstart Guide useful as you go through this case. Article: [external]

Authenticating

The first step to set up our API call is to ensure we have the proper authentication. From our Introduction to APIs article you'll remember that authentication is the process of identifying who the is in order to determine what they should have access to.

First, you'll need to find your Google Cloud API key. You'll find this in your (or set one up using our ):

Log in to the Google dashboard to find your unique API key.

API keys should be kept private to prevent unauthorized access and potential misuse of the associated API.

First, we will create a new API call by clicking the Add another API button in the API Connector settings. We can name the API Google Cloud, since this authentication covers all services that you have activated in the Cloud dashboard.

As you can see in the illustration above, Google asks us to pass the API key as a query parameter, which means we include it as a parameter in the endpoint URL.

Passing the API key in the URL is considered secure because the API key is routed through the Bubble server. This means that the API key is never visible to the users of your app. While in , the key is encrypted with HTTPS encryption.

Returning to the API Connector settings, let's set it up as follows:

  1. Open the Authentication dropdown to select the authentication method

  2. Pick Private key in URL

  3. Set the Key name to key. This is the name of the URL parameter Google is looking for.

  4. Finally, paste your API key in the Key value field.

Many API providers offer a test API key that let's you play around with the API without manipulating actual data. If you would like to use a test key in the Development version if your app, you can paste that key in the Development key value field visible in the screenshot above. Bubble will automatically use the test key for the development version and the live key for the live version.

That's all there is to it – we have now told Google who we are. When we authenticate with that API key, Google will proceed to check what we (the client) should have access to. Since we activated the Cloud Translation API, Google knows that we have access to that particular resource.

Setting up the call

The next step is to set up the actuall call. The call we are looking for is one that lets us send a string of text, specify a language and then have Google return a translated version of the text we sent. Bubble will already have created an empty call called API call. Click the expand link on that call to expose its settings.

Now let's use this information to set up the call in the API Connector.

The endpoint

First, we'll instruct the API Connector to seek out the resource we want to reach. As you can see in the screenshot above, Google spells it out for us in the header that says HTTP method and URL. This tells us that the is POST and the URL is https://translation.googleapis.com/language/translate/v2

Let's look at what that looks like in the API Connector:

  1. First, we'll set Use as to Data, since we want to use the response (the translated string) as a data source

  2. Next, we'll set the Data type to JSON, since the documentation told us that this is the format Google prefers

  3. We'll set the HTTP method to be POST, since we are initiating an action (translating text)

  4. Finally, we paste the URL from the documentation.

We have now set up the necessary settings for the call, and constructed the endpoint by combining the HTTP method and the resource URL.

The parameters

The next step is to set up the needed parameters. After all, an API call that translates text won't get us far if we don't tell it what text to translate and what language to translate it to!

Looking again at the documentation (the same screenshot as earlier) we can see that Cloud Translate asks for a few parameters:

  • "q" = The string that we want to translate

  • "source" = the language we are translating from (optional)

  • "target" = the language we are translating to

  • "format" = the format we want returned (text) (optional)

If we don't include a source language, Cloud Translate will try to recognize the language on its own. Let's set up the two required parameters: the string (q) and the target language (target). We'll also include a value that we can use to test that the call works:

Initializing the call

Initializing the call means that we run it once in order to get a response. Initializing serves two purposes:

  • It lets us know whether the call was successful or not

  • It provides us with a response that tells Bubble what the returned JSON data looks like. This in turn lets us set up the call as a data source, since Bubble knows its structure.

If everything is set up correctly, Bubble should display the following response. From here you can choose what fields to ignore, and what to include in the final call:

If you click the Show raw data link you can see the JSON-formatted text that Google returned:

{
    "data": {
        "translations": [
            {
                "translatedText": "Merci de traduire ceci",
                "detectedSourceLanguage": "en"
            }
        ]
    }
}

As you can see, the translatedText parameter returned the translated string, and the detectedSourceLanguage returned the language code of the source language.

Using the call

Now that the call has been set up to be a data source and we have initalized it, we can start using it in our application and translate texts on the fly. To find the data source we created, we use the Get data from external API data source:

That's how easily you can use the API Connector to set up an API call that you can then use around your app as a data source or an action.

Now, let's study the to see what kind of authentication they require:

Google tells us in their documentation that they accept passing the API key as a query parameter.

Again we need to consult the documentation. shows us an example with the and the parameters:

Google's documentation offers a neat overview of the call we need.
We need to include some sample data in the Value field to initialize the call. You can find the list of language abbreviations on .
After initializing, Bubble shows us the data that was returned from Google.
Google Cloud API documentation
Google's Cloud Translation Quickstart guide
Google Cloud
Translate service
How to setup Google API keys
Enabling a Google Cloud API
Google Cloud Translation Quickstart Guide
Google Cloud dashboard
video tutorial on how to set up Google Cloud API keys
Wikipedia