Skip to main content

SQLAlchemy internationalisation

Project description

traduki: SQLAlchemy internationalisation

The traduki package provides internationalisation helper classes for SQLAlchemy-based projects.


pip install traduki


traduki usage example:

from sqlalchemy.ext.declarative import declarative_base

Base = declarative_base()

import traduki

def get_current_language():
    """Current language callback for our project."""
    return request.locale

def get_language_chain():
    """Language chain (fallback rule) callback for our project."""
    return {'*': request.locale}

i18n_attributes = traduki.initialize(Base, ['en', 'ru'], get_current_language, get_language_chain)

Session = sessionmaker(bind=engine)
sess = Session()

class MyModel(Base)

    title_id = i18n_attributes.i18n_column(nullable=False, unique=False)
    title = i18n_attributes.i18n_relation(title_id)

my_object = MyModel()
my_object.title = {'en': 'English title', 'pt': 'Portugese title'}

assert sess.refresh(my_object).title.get_dict() == {'en': 'English title', 'pt': 'Portugese title'}


If you have questions, bug reports, suggestions, etc. please create an issue on the GitHub project page.


This software is licensed under the MIT license

See License

© 2018 Paylogic International.



  • Fix a bug where the get_ordered_languages would mutate in place the list of configured languages.


  • Fix UnicodeDecodeError when installing this library on python 3 on some configurations.


  • Fix python 3 compatibility
  • Declare support for python 2.7, 3.5, 3.6, 3.7, 3.8


  • Do not use deprecated AttributeExtension, use Attribute Events instead.


  • Use an OR operator for LIKE_OPS to find matches in all language columns.


  • Fix get_text_from_dict raising an exception when no language can be detected.


  • Initial public release

Project details

Download files

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

Source Distribution

traduki-1.3.2.tar.gz (6.7 kB view hashes)

Uploaded source

Built Distribution

traduki-1.3.2-py2.py3-none-any.whl (8.1 kB view hashes)

Uploaded py2 py3

Supported by

AWS AWS Cloud computing Datadog Datadog Monitoring Facebook / Instagram Facebook / Instagram PSF Sponsor Fastly Fastly CDN Google Google Object Storage and Download Analytics Huawei Huawei PSF Sponsor Microsoft Microsoft PSF Sponsor NVIDIA NVIDIA PSF Sponsor Pingdom Pingdom Monitoring Salesforce Salesforce PSF Sponsor Sentry Sentry Error logging StatusPage StatusPage Status page