Internationalization extension for SQLAlchemy models
Switch branches/tags
Nothing to show
Latest commit 95d4099 Jan 31, 2017 @kvesteri Fix formatting
Failed to load latest commit information.
tests Fix formatting Jan 30, 2017
.gitignore Added project skeleton Oct 5, 2012
README.rst Convert readthedocs links for their .org -> .io migration for hosted … Jun 2, 2016
tox.ini Add py34 to supported platforms Sep 30, 2014



Build Status Version Status Downloads

Internationalization extension for SQLAlchemy models.


  • Stores translations in separate tables.
  • Reflects translation table structures based on parent model table structure.
  • Supports forcing of given locale.
  • Good performance (uses proxy dicts and other advanced SQLAlchemy concepts for performance optimization)

Basic Usage

Consider you have already defined SQLAlchemy connections and declarative base as follows:

from sqlalchemy import create_engine
from sqlalchemy.ext.declarative import declarative_base

engine = create_engine(
Base = declarative_base()

You only need to define two things, first you have to make the desired mapper translatable using make_translatable() function. Internally this function attaches two sqlalchemy event listeners for given mapper.

NOTICE: Calling make_translatable() for given mapper should happen only once per application.

from sqlalchemy_i18n import make_translatable


Secondly you need to define translatable models. In the following example we add translatable Article model with two translatable properties (name and content).

import sqlalchemy as sa
from sqlalchemy_i18n import Translatable, translation_base

class Article(Base, Translatable):
    id = sa.Column(sa.Integer, autoincrement=True, primary_key=True)
    description = sa.Column(sa.UnicodeText)

class ArticleTranslation(translation_base(Article)):
    __tablename__ = 'article_translation'

    name = sa.Column(sa.Unicode(255))
    content = sa.Column(sa.UnicodeText)