Skip to main content

No project description provided

Project description

Muffin-Babel – an extension to Muffin that adds localization support with help of babel.

Build Status


  • python >= 3.5.3


Muffin-Babel should be installed using pip:

pip install muffin-babel


Add muffin_babel to PLUGINS in your Muffin application config:

import muffin

app = muffin.Application(



Setup a locale selector function:
def set_locale(request):
    """ Return locale from GET lang-param or automatically. """
    return request.GET.get(

        # Get locale based on user settings

Use,, function in your code:

def index(request):


The Muffin-Babel has integration with Muffin-Jinja2, so if you have muffin_jinja2 plugin enabled, the plugin provides gettext and ngettext function in Jinja2 templates’ context.


muffin_jinja2 should be enabled before muffin_babel in your application configuration.


BABEL_CONFIGURE_JINJA2 Install i18n support to Muffin-Jinja2 (True)
BABEL_DEFAULT_LOCALE Set default locale (en)
BABEL_DOMAIN Set default domain (messages)
BABEL_LOCALES_DIRS List of directories where locales are leaving
BABEL_SOURCES_MAP Babel sources map
BABEL_OPTIONS_MAP Babel options map


The plugin adds two commands to your Muffin application.

Extract messages

Extract strings from your application to locales:

$ muffin app_module extract_messages [OPTIONS] appdir

Translate .po files and compile translations:

$ muffin app_module compile_messages [OPTIONS]

Bug tracker

If you have any suggestions, bug reports or annoyances please report them to the issue tracker at


Development of Muffin-Babel happens at:


  • klen (Kirill Klenov)


Licensed under a MIT license.

Project details

Download files

Download the file for your platform. If you're not sure which to choose, learn more about installing packages.

Filename, size & hash SHA256 hash help File type Python version Upload date
muffin_babel-0.4.5-py2.py3-none-any.whl (7.0 kB) Copy SHA256 hash SHA256 Wheel py2.py3
muffin-babel-0.4.5.tar.gz (7.1 kB) Copy SHA256 hash SHA256 Source None

Supported by

Elastic Elastic Search Pingdom Pingdom Monitoring Google Google BigQuery Sentry Sentry Error logging AWS AWS Cloud computing DataDog DataDog Monitoring Fastly Fastly CDN SignalFx SignalFx Supporter DigiCert DigiCert EV certificate StatusPage StatusPage Status page