Flask

Flask

Flask is a lightweight Python web framework designed for simplicity and flexibility. It's widely used for building web applications and APIs with minimal boilerplate.

Install Translate.website on Flask

Running your web application on Flask? You don't need any Flask extensions, pip packages, or before_request hooks to make your Flask app multilingual.

By adding a single script tag to your Jinja2 base template, you inject the Translate.website script across your entire Flask application at once. Flask's Jinja2 template inheritance means you only add it once — in your base template — and it automatically appears on every route that extends it.

Once set up, Translate.website detects visitor language preferences and displays translated content in real time — for static routes, dynamic routes, and Blueprint routes alike.

This guide walks you through the entire setup from start to finish.

Flask official website

Add Translate.website to Your Flask Jinja2 Template

Flask's Jinja2 template inheritance makes this simple — add the script once to your base template and it loads on every page. Here's exactly how to set it up.

Before You Begin

  • An active Translate.website account with your snippet ready.
  • A Flask app with Jinja2 templates.
  • A base template (base.html or similar) that all routes extend.
  • No pip installs or Flask extensions required.
01

Get Your Translate.website Snippet

Log in to app.translate.website and copy your integration snippet.

  • Log in to app.translate.website
  • Navigate to Settings → Snippet
  • Copy the full <script> tag with your data-site-id
Translate.website dashboard showing the snippet settings page
02

Add the Script to Your Jinja2 Base Template

Flask uses Jinja2 templating. Your base template (usually base.html or layout.html) is the template all other templates extend using {% extends %}. Add the Translate.website script here to inject it across your entire Flask application.

  • Open your Flask base template — typically templates/base.html or templates/layout.html.
  • Inside the <head> block, find the closing </head> tag.
  • Paste your Translate.website snippet just before </head>.
  • Save the file.
  • If you use Flask Blueprints, make sure this is the root base template that all other templates extend.
Flask Jinja2 base.html template with Translate.website script tag added before closing head tag
03

Run Flask and Verify

Start your Flask development server and verify the script loads.

  • Run: flask run or python app.py
  • Open http://localhost:5000 in your browser.
  • Check DevTools → Network for the Translate.website script.
  • The translation widget should appear on your Flask pages.
  • For production: deploy using Gunicorn, uWSGI, or your preferred WSGI server.
Browser showing Flask app with Translate.website translation widget visible

🚀 What Happens After Saving?

Flask renders your Jinja2 templates server-side and includes the Translate.website script in the HTML sent to browsers. The script then runs client-side to detect visitor language and display translations.

This approach works for all Flask pages — static routes, dynamic routes with parameters, and Blueprint routes.

⚠ Recommended: Clear Cache

If you're using a CDN, reverse proxy cache, or any Flask-Caching configuration, clear your cache after saving your template to ensure all visitors receive the updated HTML with the script included.

🔁 Safe & Reversible

This integration is completely reversible. To remove Translate.website from your Flask app, simply delete the script tag from your base template and save. No Flask extensions were installed, no app configuration was changed, and nothing was permanently altered in your project.

💡 Why This Method Is Recommended

  • Uses Jinja2 template inheritance — add once, works across all Flask routes.
  • Compatible with Flask 1.x, 2.x, and 3.x.
  • No Flask extensions, blueprints modifications, or before_request hooks needed.
  • Reversible — delete the script tag from your base template to uninstall.

Ready to make your Flask app multilingual?

One script in your Jinja2 base template and your entire Flask application is instantly multilingual.

What are you waiting for?

Your Dubbing, Subtitles, Captions in one place

Signup free!

©2026  Translate.website All rights reserved.