Metadata-Version: 2.1
Name: traduki
Version: 1.3.3
Summary: SQLAlchemy internationalisation
Home-page: https://github.com/paylogic/traduki
Author: Paylogic International
Author-email: developers@paylogic.com
License: MIT
Keywords: sqlalchemy i18n internationalisation
Classifier: Development Status :: 5 - Production/Stable
Classifier: Intended Audience :: Developers
Classifier: Programming Language :: Python :: 2
Classifier: Programming Language :: Python :: 2.7
Classifier: Programming Language :: Python :: 3
Classifier: Programming Language :: Python :: 3.5
Classifier: Programming Language :: Python :: 3.6
Classifier: Programming Language :: Python :: 3.7
Classifier: Programming Language :: Python :: 3.8
License-File: LICENSE.txt
Requires-Dist: SQLAlchemy
Requires-Dist: six >=1.9.0

traduki: SQLAlchemy internationalisation
========================================

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

.. image:: https://api.travis-ci.org/paylogic/traduki.png
   :target: https://travis-ci.org/paylogic/traduki
.. image:: https://img.shields.io/pypi/v/traduki.svg
   :target: https://crate.io/packages/traduki/
.. image:: https://coveralls.io/repos/paylogic/traduki/badge.png?branch=master
   :target: https://coveralls.io/r/paylogic/traduki


Installation
------------

.. sourcecode::

    pip install traduki


Usage
-----

traduki usage example:

.. code-block:: python

    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)
        """Title."""

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

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


Contact
-------

If you have questions, bug reports, suggestions, etc. please create an issue on
the `GitHub project page <http://github.com/paylogic/traduki>`_.


License
-------

This software is licensed under the `MIT license <http://en.wikipedia.org/wiki/MIT_License>`_

See `License <https://github.com/paylogic/traduki/blob/master/LICENSE.txt>`_


© 2018 Paylogic International.

Changelog
=========

1.3.3
-----
* Fix sqlalchemy 2.0 compatibility warning by using `sqlalchemy.orm.Mapper` instead of `sqlalchemy.orm.mapper`.

1.3.2
-----
* Fix a bug where the `get_ordered_languages` would mutate in place the list of configured languages.

1.3.1
-----
* Fix UnicodeDecodeError when installing this library on python 3 on some configurations.

1.3.0
-----

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

1.2.0
-----

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

1.1.0
-----

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

1.0.1
-----

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

1.0.0
-----

* Initial public release
