Skip to content
Connect your Flask apps to PhraseApp, the powerful in-context-translation solution.
Branch: master
Clone or download
Latest commit 5cf9d65 Jul 25, 2016
Type Name Latest commit message Commit time
Failed to load latest commit information.
flask_phrase use In-Context-Editor v2, change Flask config keys Jul 15, 2015
LICENSE use In-Context-Editor v2, change Flask config keys Jul 15, 2015 add license file Jun 21, 2016


This adapter lets you connect your Flask application to PhraseApp and integrate the powerful In-Context-Editor into your apps.

How does it work?

Flask-Phrase provides In-Context translating facilities to your Flask app by hooking into Flask-Babel's gettext function. It exposes the underlying key names to the JavaScript editor that is provided by PhraseApp.

To get started with PhraseApp you need to sign up for a free account.

Install and Setup

Install the package with pip:

pip install Flask-Phrase

Add the following to your Flask app configuration (app.config or file)


Your app code should look something like this:

from flask import Flask, [...]
from flask.ext.babel import Babel
from flask_phrase import Phrase, gettext, ngettext
app = Flask(__name__)
babel = Babel(app)
phrase = Phrase(app)

Last step: add the PhraseApp JavaScript snippet to your base layout file with the folling tag. This should go inside the section of your template file:

    projectId: "YOUR-PROJECT-ID"
(function() {
    var phraseapp = document.createElement('script'); phraseapp.type = 'text/javascript'; phraseapp.async = true;
    phraseapp.src = ['https://', '', new Date().getTime()].join('');
    var s = document.getElementsByTagName('script')[0]; s.parentNode.insertBefore(phraseapp, s);

You can find your Project-ID in the PhraseApp Translation Center.


Set the PHRASEAPP_ENABLED to True/False to enable or disable In-Context-Editing. When set to False, it will fall back to standard Flask-Babel's gettext functions. Disable PhraseApp for production environments at any time!


You can’t perform that action at this time.